1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/fontservices/textbase/tgdi/TGdiServer.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,123 @@
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 "TGdiServer.h"
1.26 +#include "TTYPES.H"
1.27 +#include "TBiDi.h"
1.28 +#include "TBiDiDefect.h"
1.29 +#include "TLineBreak.h"
1.30 +#include "TGlyphSel.h"
1.31 +
1.32 +/* Path to the script
1.33 +z:\GraphicsTest\gditest.script
1.34 +*/
1.35 +
1.36 +_LIT(KServerName,"TTextBaseServer");
1.37 +
1.38 +CTGdiServer* CTGdiServer::NewL()
1.39 +/**
1.40 + @return - Instance of the test server
1.41 + Same code for Secure and non-secure variants
1.42 + Called inside the MainL() function to create and start the
1.43 + CTestServer derived server.
1.44 + */
1.45 + {
1.46 + CTGdiServer * server = new (ELeave) CTGdiServer();
1.47 + CleanupStack::PushL(server);
1.48 + // CServer base class call
1.49 + server->StartL(KServerName);
1.50 + CleanupStack::Pop(server);
1.51 + return server;
1.52 + }
1.53 +
1.54 +
1.55 +LOCAL_C void MainL()
1.56 +//
1.57 +// Secure variant
1.58 +// Much simpler, uses the new Rendezvous() call to sync with the client
1.59 +//
1.60 + {
1.61 +#if (defined __DATA_CAGING__)
1.62 + RProcess().DataCaging(RProcess::EDataCagingOn);
1.63 + RProcess().SecureApi(RProcess::ESecureApiOn);
1.64 +#endif
1.65 + CActiveScheduler* sched=NULL;
1.66 + sched=new(ELeave) CActiveScheduler;
1.67 + CActiveScheduler::Install(sched);
1.68 + CTGdiServer* server = NULL;
1.69 + // Create the CTestServer derived server
1.70 + TRAPD(err,server = CTGdiServer::NewL());
1.71 + if(!err)
1.72 + {
1.73 + // Sync with the client and enter the active scheduler
1.74 + RProcess::Rendezvous(KErrNone);
1.75 + sched->Start();
1.76 + }
1.77 + delete server;
1.78 + delete sched;
1.79 + }
1.80 +
1.81 +GLDEF_C TInt E32Main()
1.82 +
1.83 +/** @return - Standard Epoc error code on process exit
1.84 + Secure variant only
1.85 + Process entry point. Called by client using RProcess API
1.86 +*/
1.87 + {
1.88 + __UHEAP_MARK;
1.89 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.90 + if(cleanup == NULL)
1.91 + {
1.92 + return KErrNoMemory;
1.93 + }
1.94 + TRAPD(err,MainL());
1.95 + // This if statement is here just to shut up RVCT, which would otherwise warn
1.96 + // that err was set but never used
1.97 + if (err)
1.98 + {
1.99 + err = KErrNone;
1.100 + }
1.101 + delete cleanup;
1.102 + __UHEAP_MARKEND;
1.103 + return KErrNone;
1.104 + }
1.105 +
1.106 +CTestStep* CTGdiServer::CreateTestStep(const TDesC& aStepName)
1.107 +/**
1.108 + @return - A CTestStep derived instance
1.109 + Secure and non-secure variants
1.110 + Implementation of CTestServer pure virtual
1.111 + */
1.112 + {
1.113 + CTestStep* testStep = NULL;
1.114 + if(aStepName == KTTypesStep)
1.115 + testStep = new CTTypesStep();
1.116 + else if(aStepName == KTBiDiStep)
1.117 + testStep = new CTBiDiStep();
1.118 + else if(aStepName == KTBiDiDefectStep)
1.119 + testStep = new CTBiDiDefectStep();
1.120 + else if(aStepName == KTLineBreakStep)
1.121 + testStep = new CTLineBreakStep();
1.122 + else if(aStepName == KTGlyphSelectionStep)
1.123 + testStep = new CTGlyphSelectionStep();
1.124 +
1.125 + return testStep;
1.126 + }