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