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