os/graphics/fbs/fontandbitmapserver/tfbs/TFbsServer.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/fbs/fontandbitmapserver/tfbs/TFbsServer.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,228 @@
     1.4 +// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +/**
    1.20 + @file
    1.21 + @test
    1.22 + @internalComponent - Internal Symbian test code 
    1.23 +*/
    1.24 +
    1.25 +#include "TFbsServer.h"
    1.26 +#include "TALLOC.H"
    1.27 +#include "TBitmap.h"
    1.28 +#include "TCLEAN.H"
    1.29 +#include "TFBS.H"
    1.30 +#include "tcompressed.h"
    1.31 +#include "TRalc.h"
    1.32 +#include "TFBSDefect.h"
    1.33 +#include "TStreamIdCache.h"
    1.34 +#include "TSecureFBS.h"
    1.35 +#include "trfile.h"
    1.36 +#include "TGetAllBitmapsCapability.h"
    1.37 +#include "tipctest.h"
    1.38 +#include "textendedbitmap.h"
    1.39 +#include "textendedbitmapnegative.h"
    1.40 +#include "textendedbitmaplegacy.h"
    1.41 +#include "textendedbitmappanic.h"
    1.42 +#include "twdp.h"
    1.43 +#include "tfonttableandglyph.h"
    1.44 +#include "tfbsglyphdata.h"
    1.45 +#include "tfbsglyphdatapanic.h"
    1.46 +#include "tfbsglyphdataoutlineshadow.h"
    1.47 +#include "tglyphatlas.h"
    1.48 +#include "tfbsoogm.h"
    1.49 +
    1.50 +/* Path to the script
    1.51 +
    1.52 +z:\GraphicsTest\fbstest.script
    1.53 +
    1.54 +*/
    1.55 +
    1.56 +CTFbsServer* CTFbsServer::NewL()
    1.57 +/**
    1.58 +   @return - Instance of the test server
    1.59 +   Same code for Secure and non-secure variants
    1.60 +   Called inside the MainL() function to create and start the
    1.61 +   CTestServer derived server.
    1.62 + */
    1.63 +	{
    1.64 +	CTFbsServer * server = new (ELeave) CTFbsServer();
    1.65 +	CleanupStack::PushL(server);
    1.66 +	
    1.67 +	// Get server name from process so we can use SetCap to change the capabilites and use this server with a different filename
    1.68 +	RProcess handle = RProcess();
    1.69 +	TParsePtrC serverName(handle.FileName());
    1.70 +	
    1.71 +	// CServer base class call
    1.72 +	server->StartL(serverName.Name());
    1.73 +	CleanupStack::Pop(server);
    1.74 +	return server;
    1.75 +	}
    1.76 +
    1.77 +
    1.78 +LOCAL_C void MainL()
    1.79 +//
    1.80 +// Secure variant
    1.81 +// Much simpler, uses the new Rendezvous() call to sync with the client
    1.82 +//
    1.83 +	{
    1.84 + 	RProcess().DataCaging(RProcess::EDataCagingOn);
    1.85 +	RProcess().SecureApi(RProcess::ESecureApiOn);
    1.86 +
    1.87 +	CActiveScheduler* sched=NULL;
    1.88 +	sched=new(ELeave) CActiveScheduler;
    1.89 +	CActiveScheduler::Install(sched);
    1.90 +	CTFbsServer* server = NULL;
    1.91 +	// Create the CTestServer derived server
    1.92 +	TRAPD(err,server = CTFbsServer::NewL());
    1.93 +	if(!err)
    1.94 +		{
    1.95 +		// Sync with the client and enter the active scheduler
    1.96 +		RProcess::Rendezvous(KErrNone);
    1.97 +		sched->Start();
    1.98 +		}
    1.99 +	delete server;
   1.100 +	delete sched;
   1.101 +	}
   1.102 +
   1.103 +/** @return - Standard Epoc error code on process exit
   1.104 +    Secure variant only
   1.105 +    Process entry point. Called by client using RProcess API
   1.106 +*/
   1.107 +GLDEF_C TInt E32Main()
   1.108 +	{
   1.109 +	__UHEAP_MARK;
   1.110 +	CTrapCleanup* cleanup = CTrapCleanup::New();
   1.111 +	if(cleanup == NULL)
   1.112 +		{
   1.113 +		return KErrNoMemory;
   1.114 +		}
   1.115 +	TRAPD(err,MainL());
   1.116 +	if (err)
   1.117 +	    {
   1.118 +	    RProcess handle = RProcess();
   1.119 +		TParsePtrC serverName(handle.FileName());
   1.120 +		RDebug::Print(_L("CTFbsServer::MainL - Error: %d"), err);
   1.121 +	   	User::Panic(serverName.Name(),err);
   1.122 +	    }
   1.123 +	delete cleanup;
   1.124 +	__UHEAP_MARKEND;
   1.125 +	return KErrNone;
   1.126 +    }
   1.127 +
   1.128 +CTestStep* CTFbsServer::CreateTestStep(const TDesC& aStepName)
   1.129 +/**
   1.130 +   @return - A CTestStep derived instance
   1.131 +   Secure and non-secure variants
   1.132 +   Implementation of CTestServer pure virtual
   1.133 + */
   1.134 +	{
   1.135 +	CTestStep* testStep = NULL;
   1.136 +
   1.137 +	if(aStepName == KTAllocStep)
   1.138 +		{
   1.139 +		testStep = new CTAllocStep();
   1.140 +		}
   1.141 +	else if(aStepName == KTBitmapStep)
   1.142 +		{
   1.143 +		testStep = new CTBitmapStep();
   1.144 +		}
   1.145 +	else if(aStepName == KTCleanStep)
   1.146 +		{
   1.147 +		testStep = new CTCleanStep();
   1.148 +		}
   1.149 +	else if(aStepName == KTFbsStep)
   1.150 +		{
   1.151 +		testStep = new CTFbsStep();
   1.152 +		}
   1.153 +	else if(aStepName == KTCompressedStep)
   1.154 +		{
   1.155 +		testStep = new CTCompressedStep();
   1.156 +		}
   1.157 +	else if(aStepName == KTRalcStep)
   1.158 +		{
   1.159 +		testStep = new CTRalcStep();
   1.160 +		}
   1.161 +	else if(aStepName == KTFbsDefectStep)
   1.162 +		{
   1.163 +		testStep = new CTFbsDefectStep();
   1.164 +		}
   1.165 +	else if(aStepName == KTStreamIdCacheStep)
   1.166 +		{
   1.167 +		testStep = new CTStreamIdCacheStep();
   1.168 +		}
   1.169 +	else if(aStepName == KTFbsSecureStep)
   1.170 +		{
   1.171 +		testStep = new CTFbsSecureStep();
   1.172 +		}
   1.173 +	else if(aStepName == KTFileStep)
   1.174 +		{
   1.175 +		testStep = new CTFileStep();
   1.176 +		}
   1.177 +	else if(aStepName == KTGetAllBitmapsCapabilityStep)
   1.178 +		{
   1.179 +		testStep = new CTGetAllBitmapsCapabilityStep();
   1.180 +		}	
   1.181 +	else if(aStepName == KTIPCTestStep)
   1.182 +		{
   1.183 +		testStep = new CTIPCTestStep();
   1.184 +		}
   1.185 +	else if(aStepName == KTExtendedBitmapStep)
   1.186 +		{
   1.187 +		testStep = new CTExtendedBitmapStep();
   1.188 +		}
   1.189 +	else if(aStepName == KTExtendedBitmapNegativeStep)
   1.190 +		{
   1.191 +		testStep = new CTExtendedBitmapNegativeStep();
   1.192 +		}
   1.193 +	else if(aStepName == KTExtendedBitmapLegacyStep)
   1.194 +		{
   1.195 +		testStep = new CTExtendedBitmapLegacyStep();
   1.196 +		}
   1.197 +	else if(aStepName == KTExtendedBitmapPanicStep)
   1.198 +		{
   1.199 +		testStep = new CTExtendedBitmapPanicStep();
   1.200 +		}
   1.201 +	else if(aStepName == KTWDPStep)
   1.202 +		{
   1.203 +		testStep = new CTWDPStep();
   1.204 +		}
   1.205 +   	else if(aStepName == KTFontTableAndGlyphStep)
   1.206 +        {
   1.207 +        testStep = new CTFontAndGlyphStep();
   1.208 +        }
   1.209 +	else if(aStepName == KTFbsGlyphDataStep)
   1.210 +		{
   1.211 +		testStep = new CTFbsGlyphDataStep();
   1.212 +		}
   1.213 +    else if(aStepName == KTFbsGlyphDataPanicStep)
   1.214 +        {
   1.215 +        testStep = new CTFbsGlyphDataPanicStep();
   1.216 +        }
   1.217 +    else if(aStepName == KTFbsGlyphDataOutlineAndShadowStep)
   1.218 +        {
   1.219 +        testStep = new CTFbsGlyphDataOutlineAndShadowStep();
   1.220 +        }
   1.221 +    else if(aStepName == KTGlyphAtlasStep)
   1.222 +    	{
   1.223 +		testStep = new CTGlyphAtlasStep();
   1.224 +    	}
   1.225 +    else if(aStepName == KTFbsOogmStep)
   1.226 +        {
   1.227 +        testStep = new CTFbsOogmStep();
   1.228 +        }
   1.229 +
   1.230 +	return testStep;
   1.231 +	}