os/graphics/fbs/fontandbitmapserver/tfbs/TFbsServer.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @test
sl@0
    19
 @internalComponent - Internal Symbian test code 
sl@0
    20
*/
sl@0
    21
sl@0
    22
#include "TFbsServer.h"
sl@0
    23
#include "TALLOC.H"
sl@0
    24
#include "TBitmap.h"
sl@0
    25
#include "TCLEAN.H"
sl@0
    26
#include "TFBS.H"
sl@0
    27
#include "tcompressed.h"
sl@0
    28
#include "TRalc.h"
sl@0
    29
#include "TFBSDefect.h"
sl@0
    30
#include "TStreamIdCache.h"
sl@0
    31
#include "TSecureFBS.h"
sl@0
    32
#include "trfile.h"
sl@0
    33
#include "TGetAllBitmapsCapability.h"
sl@0
    34
#include "tipctest.h"
sl@0
    35
#include "textendedbitmap.h"
sl@0
    36
#include "textendedbitmapnegative.h"
sl@0
    37
#include "textendedbitmaplegacy.h"
sl@0
    38
#include "textendedbitmappanic.h"
sl@0
    39
#include "twdp.h"
sl@0
    40
#include "tfonttableandglyph.h"
sl@0
    41
#include "tfbsglyphdata.h"
sl@0
    42
#include "tfbsglyphdatapanic.h"
sl@0
    43
#include "tfbsglyphdataoutlineshadow.h"
sl@0
    44
#include "tglyphatlas.h"
sl@0
    45
#include "tfbsoogm.h"
sl@0
    46
sl@0
    47
/* Path to the script
sl@0
    48
sl@0
    49
z:\GraphicsTest\fbstest.script
sl@0
    50
sl@0
    51
*/
sl@0
    52
sl@0
    53
CTFbsServer* CTFbsServer::NewL()
sl@0
    54
/**
sl@0
    55
   @return - Instance of the test server
sl@0
    56
   Same code for Secure and non-secure variants
sl@0
    57
   Called inside the MainL() function to create and start the
sl@0
    58
   CTestServer derived server.
sl@0
    59
 */
sl@0
    60
	{
sl@0
    61
	CTFbsServer * server = new (ELeave) CTFbsServer();
sl@0
    62
	CleanupStack::PushL(server);
sl@0
    63
	
sl@0
    64
	// Get server name from process so we can use SetCap to change the capabilites and use this server with a different filename
sl@0
    65
	RProcess handle = RProcess();
sl@0
    66
	TParsePtrC serverName(handle.FileName());
sl@0
    67
	
sl@0
    68
	// CServer base class call
sl@0
    69
	server->StartL(serverName.Name());
sl@0
    70
	CleanupStack::Pop(server);
sl@0
    71
	return server;
sl@0
    72
	}
sl@0
    73
sl@0
    74
sl@0
    75
LOCAL_C void MainL()
sl@0
    76
//
sl@0
    77
// Secure variant
sl@0
    78
// Much simpler, uses the new Rendezvous() call to sync with the client
sl@0
    79
//
sl@0
    80
	{
sl@0
    81
 	RProcess().DataCaging(RProcess::EDataCagingOn);
sl@0
    82
	RProcess().SecureApi(RProcess::ESecureApiOn);
sl@0
    83
sl@0
    84
	CActiveScheduler* sched=NULL;
sl@0
    85
	sched=new(ELeave) CActiveScheduler;
sl@0
    86
	CActiveScheduler::Install(sched);
sl@0
    87
	CTFbsServer* server = NULL;
sl@0
    88
	// Create the CTestServer derived server
sl@0
    89
	TRAPD(err,server = CTFbsServer::NewL());
sl@0
    90
	if(!err)
sl@0
    91
		{
sl@0
    92
		// Sync with the client and enter the active scheduler
sl@0
    93
		RProcess::Rendezvous(KErrNone);
sl@0
    94
		sched->Start();
sl@0
    95
		}
sl@0
    96
	delete server;
sl@0
    97
	delete sched;
sl@0
    98
	}
sl@0
    99
sl@0
   100
/** @return - Standard Epoc error code on process exit
sl@0
   101
    Secure variant only
sl@0
   102
    Process entry point. Called by client using RProcess API
sl@0
   103
*/
sl@0
   104
GLDEF_C TInt E32Main()
sl@0
   105
	{
sl@0
   106
	__UHEAP_MARK;
sl@0
   107
	CTrapCleanup* cleanup = CTrapCleanup::New();
sl@0
   108
	if(cleanup == NULL)
sl@0
   109
		{
sl@0
   110
		return KErrNoMemory;
sl@0
   111
		}
sl@0
   112
	TRAPD(err,MainL());
sl@0
   113
	if (err)
sl@0
   114
	    {
sl@0
   115
	    RProcess handle = RProcess();
sl@0
   116
		TParsePtrC serverName(handle.FileName());
sl@0
   117
		RDebug::Print(_L("CTFbsServer::MainL - Error: %d"), err);
sl@0
   118
	   	User::Panic(serverName.Name(),err);
sl@0
   119
	    }
sl@0
   120
	delete cleanup;
sl@0
   121
	__UHEAP_MARKEND;
sl@0
   122
	return KErrNone;
sl@0
   123
    }
sl@0
   124
sl@0
   125
CTestStep* CTFbsServer::CreateTestStep(const TDesC& aStepName)
sl@0
   126
/**
sl@0
   127
   @return - A CTestStep derived instance
sl@0
   128
   Secure and non-secure variants
sl@0
   129
   Implementation of CTestServer pure virtual
sl@0
   130
 */
sl@0
   131
	{
sl@0
   132
	CTestStep* testStep = NULL;
sl@0
   133
sl@0
   134
	if(aStepName == KTAllocStep)
sl@0
   135
		{
sl@0
   136
		testStep = new CTAllocStep();
sl@0
   137
		}
sl@0
   138
	else if(aStepName == KTBitmapStep)
sl@0
   139
		{
sl@0
   140
		testStep = new CTBitmapStep();
sl@0
   141
		}
sl@0
   142
	else if(aStepName == KTCleanStep)
sl@0
   143
		{
sl@0
   144
		testStep = new CTCleanStep();
sl@0
   145
		}
sl@0
   146
	else if(aStepName == KTFbsStep)
sl@0
   147
		{
sl@0
   148
		testStep = new CTFbsStep();
sl@0
   149
		}
sl@0
   150
	else if(aStepName == KTCompressedStep)
sl@0
   151
		{
sl@0
   152
		testStep = new CTCompressedStep();
sl@0
   153
		}
sl@0
   154
	else if(aStepName == KTRalcStep)
sl@0
   155
		{
sl@0
   156
		testStep = new CTRalcStep();
sl@0
   157
		}
sl@0
   158
	else if(aStepName == KTFbsDefectStep)
sl@0
   159
		{
sl@0
   160
		testStep = new CTFbsDefectStep();
sl@0
   161
		}
sl@0
   162
	else if(aStepName == KTStreamIdCacheStep)
sl@0
   163
		{
sl@0
   164
		testStep = new CTStreamIdCacheStep();
sl@0
   165
		}
sl@0
   166
	else if(aStepName == KTFbsSecureStep)
sl@0
   167
		{
sl@0
   168
		testStep = new CTFbsSecureStep();
sl@0
   169
		}
sl@0
   170
	else if(aStepName == KTFileStep)
sl@0
   171
		{
sl@0
   172
		testStep = new CTFileStep();
sl@0
   173
		}
sl@0
   174
	else if(aStepName == KTGetAllBitmapsCapabilityStep)
sl@0
   175
		{
sl@0
   176
		testStep = new CTGetAllBitmapsCapabilityStep();
sl@0
   177
		}	
sl@0
   178
	else if(aStepName == KTIPCTestStep)
sl@0
   179
		{
sl@0
   180
		testStep = new CTIPCTestStep();
sl@0
   181
		}
sl@0
   182
	else if(aStepName == KTExtendedBitmapStep)
sl@0
   183
		{
sl@0
   184
		testStep = new CTExtendedBitmapStep();
sl@0
   185
		}
sl@0
   186
	else if(aStepName == KTExtendedBitmapNegativeStep)
sl@0
   187
		{
sl@0
   188
		testStep = new CTExtendedBitmapNegativeStep();
sl@0
   189
		}
sl@0
   190
	else if(aStepName == KTExtendedBitmapLegacyStep)
sl@0
   191
		{
sl@0
   192
		testStep = new CTExtendedBitmapLegacyStep();
sl@0
   193
		}
sl@0
   194
	else if(aStepName == KTExtendedBitmapPanicStep)
sl@0
   195
		{
sl@0
   196
		testStep = new CTExtendedBitmapPanicStep();
sl@0
   197
		}
sl@0
   198
	else if(aStepName == KTWDPStep)
sl@0
   199
		{
sl@0
   200
		testStep = new CTWDPStep();
sl@0
   201
		}
sl@0
   202
   	else if(aStepName == KTFontTableAndGlyphStep)
sl@0
   203
        {
sl@0
   204
        testStep = new CTFontAndGlyphStep();
sl@0
   205
        }
sl@0
   206
	else if(aStepName == KTFbsGlyphDataStep)
sl@0
   207
		{
sl@0
   208
		testStep = new CTFbsGlyphDataStep();
sl@0
   209
		}
sl@0
   210
    else if(aStepName == KTFbsGlyphDataPanicStep)
sl@0
   211
        {
sl@0
   212
        testStep = new CTFbsGlyphDataPanicStep();
sl@0
   213
        }
sl@0
   214
    else if(aStepName == KTFbsGlyphDataOutlineAndShadowStep)
sl@0
   215
        {
sl@0
   216
        testStep = new CTFbsGlyphDataOutlineAndShadowStep();
sl@0
   217
        }
sl@0
   218
    else if(aStepName == KTGlyphAtlasStep)
sl@0
   219
    	{
sl@0
   220
		testStep = new CTGlyphAtlasStep();
sl@0
   221
    	}
sl@0
   222
    else if(aStepName == KTFbsOogmStep)
sl@0
   223
        {
sl@0
   224
        testStep = new CTFbsOogmStep();
sl@0
   225
        }
sl@0
   226
sl@0
   227
	return testStep;
sl@0
   228
	}