fbs/fontandbitmapserver/tfbs/TFbsServer.cpp
changeset 0 5d03bc08d59c
child 36 01a6848ebfd7
child 163 bbf46f59e123
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2005-2009 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 
       
    41  
       
    42 /* Path to the script
       
    43 
       
    44 z:\GraphicsTest\fbstest.script
       
    45 
       
    46 */
       
    47 
       
    48 CTFbsServer* CTFbsServer::NewL()
       
    49 /**
       
    50    @return - Instance of the test server
       
    51    Same code for Secure and non-secure variants
       
    52    Called inside the MainL() function to create and start the
       
    53    CTestServer derived server.
       
    54  */
       
    55 	{
       
    56 	CTFbsServer * server = new (ELeave) CTFbsServer();
       
    57 	CleanupStack::PushL(server);
       
    58 	
       
    59 	// Get server name from process so we can use SetCap to change the capabilites and use this server with a different filename
       
    60 	RProcess handle = RProcess();
       
    61 	TParsePtrC serverName(handle.FileName());
       
    62 	
       
    63 	// CServer base class call
       
    64 	server->StartL(serverName.Name());
       
    65 	CleanupStack::Pop(server);
       
    66 	return server;
       
    67 	}
       
    68 
       
    69 
       
    70 LOCAL_C void MainL()
       
    71 //
       
    72 // Secure variant
       
    73 // Much simpler, uses the new Rendezvous() call to sync with the client
       
    74 //
       
    75 	{
       
    76  	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    77 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    78 
       
    79 	CActiveScheduler* sched=NULL;
       
    80 	sched=new(ELeave) CActiveScheduler;
       
    81 	CActiveScheduler::Install(sched);
       
    82 	CTFbsServer* server = NULL;
       
    83 	// Create the CTestServer derived server
       
    84 	TRAPD(err,server = CTFbsServer::NewL());
       
    85 	if(!err)
       
    86 		{
       
    87 		// Sync with the client and enter the active scheduler
       
    88 		RProcess::Rendezvous(KErrNone);
       
    89 		sched->Start();
       
    90 		}
       
    91 	delete server;
       
    92 	delete sched;
       
    93 	}
       
    94 
       
    95 /** @return - Standard Epoc error code on process exit
       
    96     Secure variant only
       
    97     Process entry point. Called by client using RProcess API
       
    98 */
       
    99 GLDEF_C TInt E32Main()
       
   100 	{
       
   101 	__UHEAP_MARK;
       
   102 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
   103 	if(cleanup == NULL)
       
   104 		{
       
   105 		return KErrNoMemory;
       
   106 		}
       
   107 	TRAPD(err,MainL());
       
   108 	if (err)
       
   109 	    {
       
   110 	    RProcess handle = RProcess();
       
   111 		TParsePtrC serverName(handle.FileName());
       
   112 		RDebug::Print(_L("CTFbsServer::MainL - Error: %d"), err);
       
   113 	   	User::Panic(serverName.Name(),err);
       
   114 	    }
       
   115 	delete cleanup;
       
   116 	__UHEAP_MARKEND;
       
   117 	return KErrNone;
       
   118     }
       
   119 
       
   120 CTestStep* CTFbsServer::CreateTestStep(const TDesC& aStepName)
       
   121 /**
       
   122    @return - A CTestStep derived instance
       
   123    Secure and non-secure variants
       
   124    Implementation of CTestServer pure virtual
       
   125  */
       
   126 	{
       
   127 	CTestStep* testStep = NULL;
       
   128 
       
   129 	if(aStepName == KTAllocStep)
       
   130 		{
       
   131 		testStep = new CTAllocStep();
       
   132 		}
       
   133 	else if(aStepName == KTBitmapStep)
       
   134 		{
       
   135 		testStep = new CTBitmapStep();
       
   136 		}
       
   137 	else if(aStepName == KTCleanStep)
       
   138 		{
       
   139 		testStep = new CTCleanStep();
       
   140 		}
       
   141 	else if(aStepName == KTFbsStep)
       
   142 		{
       
   143 		testStep = new CTFbsStep();
       
   144 		}
       
   145 	else if(aStepName == KTCompressedStep)
       
   146 		{
       
   147 		testStep = new CTCompressedStep();
       
   148 		}
       
   149 	else if(aStepName == KTRalcStep)
       
   150 		{
       
   151 		testStep = new CTRalcStep();
       
   152 		}
       
   153 	else if(aStepName == KTFbsDefectStep)
       
   154 		{
       
   155 		testStep = new CTFbsDefectStep();
       
   156 		}
       
   157 	else if(aStepName == KTStreamIdCacheStep)
       
   158 		{
       
   159 		testStep = new CTStreamIdCacheStep();
       
   160 		}
       
   161 	else if(aStepName == KTFbsSecureStep)
       
   162 		{
       
   163 		testStep = new CTFbsSecureStep();
       
   164 		}
       
   165 	else if(aStepName == KTFileStep)
       
   166 		{
       
   167 		testStep = new CTFileStep();
       
   168 		}
       
   169 	else if(aStepName == KTGetAllBitmapsCapabilityStep)
       
   170 		{
       
   171 		testStep = new CTGetAllBitmapsCapabilityStep();
       
   172 		}	
       
   173 	else if(aStepName == KTIPCTestStep)
       
   174 		{
       
   175 		testStep = new CTIPCTestStep();
       
   176 		}
       
   177 	else if(aStepName == KTExtendedBitmapStep)
       
   178 		{
       
   179 		testStep = new CTExtendedBitmapStep();
       
   180 		}
       
   181 	else if(aStepName == KTExtendedBitmapNegativeStep)
       
   182 		{
       
   183 		testStep = new CTExtendedBitmapNegativeStep();
       
   184 		}
       
   185 	else if(aStepName == KTExtendedBitmapLegacyStep)
       
   186 		{
       
   187 		testStep = new CTExtendedBitmapLegacyStep();
       
   188 		}
       
   189 	else if(aStepName == KTExtendedBitmapPanicStep)
       
   190 		{
       
   191 		testStep = new CTExtendedBitmapPanicStep();
       
   192 		}
       
   193 	else if(aStepName == KTWDPStep)
       
   194 		{
       
   195 		testStep = new CTWDPStep();
       
   196 		}
       
   197 	
       
   198 	return testStep;
       
   199 	}