graphicsdeviceinterface/gdi/tgdi/TGdiServer.cpp
changeset 0 5d03bc08d59c
child 171 414d4b727fd9
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 "TGdiServer.h"
       
    23 #include "TRGB.H"
       
    24 #include "TTYPES.H"
       
    25 #include "TBiDi.h"
       
    26 #include "TBiDiDefect.h"
       
    27 #include "TLineBreak.h"
       
    28 #include "TGlyphSel.h"
       
    29  
       
    30 /* Path to the script
       
    31 z:\GraphicsTest\gditest.script
       
    32 */
       
    33 
       
    34 _LIT(KServerName,"TGdiServer");
       
    35 
       
    36 CTGdiServer* CTGdiServer::NewL()
       
    37 /**
       
    38    @return - Instance of the test server
       
    39    Same code for Secure and non-secure variants
       
    40    Called inside the MainL() function to create and start the
       
    41    CTestServer derived server.
       
    42  */
       
    43 	{
       
    44 	CTGdiServer * server = new (ELeave) CTGdiServer();
       
    45 	CleanupStack::PushL(server);
       
    46 	// CServer base class call
       
    47 	server->StartL(KServerName);
       
    48 	CleanupStack::Pop(server);
       
    49 	return server;
       
    50 	}
       
    51 
       
    52 
       
    53 LOCAL_C void MainL()
       
    54 //
       
    55 // Secure variant
       
    56 // Much simpler, uses the new Rendezvous() call to sync with the client
       
    57 //
       
    58 	{
       
    59 #if (defined __DATA_CAGING__)
       
    60  	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    61 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    62 #endif
       
    63 	CActiveScheduler* sched=NULL;
       
    64 	sched=new(ELeave) CActiveScheduler;
       
    65 	CActiveScheduler::Install(sched);
       
    66 	CTGdiServer* server = NULL;
       
    67 	// Create the CTestServer derived server
       
    68 	TRAPD(err,server = CTGdiServer::NewL());
       
    69 	if(!err)
       
    70 		{
       
    71 		// Sync with the client and enter the active scheduler
       
    72 		RProcess::Rendezvous(KErrNone);
       
    73 		sched->Start();
       
    74 		}
       
    75 	delete server;
       
    76 	delete sched;
       
    77 	}
       
    78 
       
    79 GLDEF_C TInt E32Main()
       
    80 
       
    81 /** @return - Standard Epoc error code on process exit
       
    82     Secure variant only
       
    83     Process entry point. Called by client using RProcess API
       
    84 */
       
    85 	{
       
    86 	__UHEAP_MARK;
       
    87 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    88 	if(cleanup == NULL)
       
    89 		{
       
    90 		return KErrNoMemory;
       
    91 		}
       
    92 	TRAPD(err,MainL());
       
    93 	// This if statement is here just to shut up RVCT, which would otherwise warn
       
    94 	// that err was set but never used
       
    95 	if (err)
       
    96 	    {
       
    97 	    err = KErrNone;
       
    98 	    }
       
    99 	delete cleanup;
       
   100 	__UHEAP_MARKEND;
       
   101 	return KErrNone;
       
   102     }
       
   103 
       
   104 CTestStep* CTGdiServer::CreateTestStep(const TDesC& aStepName)
       
   105 /**
       
   106    @return - A CTestStep derived instance
       
   107    Secure and non-secure variants
       
   108    Implementation of CTestServer pure virtual
       
   109  */
       
   110 	{
       
   111 	CTestStep* testStep = NULL;
       
   112 	if(aStepName == KTRgbStep)
       
   113 		testStep = new CTRgbStep();
       
   114 	else if(aStepName == KTTypesStep)
       
   115 		testStep = new CTTypesStep();
       
   116 	else if(aStepName == KTBiDiStep)
       
   117 		testStep = new CTBiDiStep();
       
   118 	else if(aStepName == KTBiDiDefectStep)
       
   119 		testStep = new CTBiDiDefectStep();
       
   120 	else if(aStepName == KTLineBreakStep)
       
   121 		testStep = new CTLineBreakStep();
       
   122 	else if(aStepName == KTGlyphSelectionStep)
       
   123 		testStep = new CTGlyphSelectionStep();
       
   124 
       
   125 	return testStep;
       
   126 	}