|
1 // Copyright (c) 2007-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 "tgdifontrenderingperf.h" |
|
23 |
|
24 //Number of iterations each test is executed |
|
25 |
|
26 const TInt KIterations = 5; |
|
27 |
|
28 //Font file and font file related information |
|
29 |
|
30 _LIT16(KTestIndicFontFile, "C:\\s60ssb_v500.ttf"); |
|
31 _LIT16(KTestIndicFontFaceName, "Series 60 Sans"); |
|
32 |
|
33 //Test data for Reading and writing simulation usecases |
|
34 |
|
35 _LIT16(KHindi1,"\x0930\x093C\x094D\x0915\x0915\x094D\x0915\x0930\x094D\x0915\x0915\x094D\x0930\x0915\x094D\x0937\x0915\x094D\x0930\x094D\x092A\x0020\x092E\x094D\x200D\x092E\x093F\x200D"); |
|
36 _LIT16(KHindi2,"\x0930\x093C\x094D\x0915\x0915\x094D\x0915\x0930\x094D\x0915\x0915\x094D\x0930\x0915\x094D\x0937\x0915\x094D\x0930\x094D\x092A\x0020\x092E\x094D\x200D\x092E\x093F\x200D\x0930\x093C\x094D\x0915\x0915\x094D\x0915\x0930\x094D\x0915\x0915\x094D\x0930\x0915\x094D\x0937\x0915\x094D\x0930\x094D\x092A\x0020\x092E\x094D\x200D\x092E\x093F\x200D\x0930\x093C\x094D\x0915\x0915\x094D\x0915\x0930\x094D\x0915\x0915\x094D\x0930\x0915\x094D\x0937\x0915\x094D\x0930\x094D\x092A\x0020\x092E\x094D\x200D\x092E\x093F\x200D\x0930\x093C\x094D\x0915\x0915\x094D\x0915\x0930\x094D\x0915\x0915\x094D\x0930\x0915\x094D\x0937\x0915\x094D\x0930\x094D\x092A\x0020\x092E\x094D\x200D\x092E\x093F\x200D\x0930\x093C\x094D\x0915\x0915\x094D\x0915\x0930\x094D\x0915\x0915\x094D\x0930\x0915\x094D\x0937\x0915\x094D"); |
|
37 |
|
38 _LIT16(KKannada1,"\x0CB0\x0CBC\x0CCD\x0C95\x0C95\x0CCD\x0C95\x0CB0\x0CCD\x0C95\x0C95\x0CCD\x0CB0\x0C95\x0CCD\x0CB\x0C95\x0CCD\x0CB0\x0CCD\x0CAA\x0020\x0CAE\x0CCD\x200D\x0CAE\x0CBF\x200D"); |
|
39 _LIT16(KKannada2,"\x0CB0\x0CBC\x0CCD\x0C95\x0C95\x0CCD\x0C95\x0CB0\x0CCD\x0C95\x0C95\x0CCD\x0CB0\x0C95\x0CCD\x0CB7\x0C95\x0CCD\x0CB0\x0CCD\x0CAA\x0020\x0CAE\x0CCD\x200D\x0CAE\x0CBF\x200D\x0CB0\x0CBC\x0CCD\x0C95\x0C95\x0CCD\x0C95\x0CB0\x0CCD\x0C95\x0C95\x0CCD\x0CB0\x0C95\x0CCD\x0CB7\x0C95\x0CCD\x0CB0\x0CCD\x0CAA\x0020\x0CAE\x0CCD\x200D\x0CAE\x0CBF\x200D\x0CB0\x0CBC\x0CCD\x0C95\x0C95\x0CCD\x0C95\x0CB0\x0CCD\x0C95\x0C95\x0CCD\x0CB0\x0C95\x0CCD\x0CB7\x0C95\x0CCD\x0CB0\x0CCD\x0CAA\x0020\x0CAE\x0CCD\x200D\x0CAE\x0CBF\x200D\x0CB0\x0CBC\x0CCD\x0C95\x0C95\x0CCD\x0C95\x0CB0\x0CCD\x0C95\x0C95\x0CCD\x0CB0\x0C95\x0CCD\x0CB7\x0C95\x0CCD\x0CB0\x0CCD\x0CAA\x0020\x0CAE\x0CCD\x200D\x0CAE\x0CBF\x200D\x0CB0\x0CBC\x0CCD\x0C95\x0C95\x0CCD\x0C95\x0CB0\x0CCD\x0C95\x0C95\x0CCD\x0CB0\x0C95\x0CCD\x0CB7\x0C95\x0CCD"); |
|
40 |
|
41 _LIT16(KGujarati1,"\x0AB0\x0ABC\x0ACD\x0A95\x0A95\x0ACD\x0A95\x0AB0\x0ACD\x0A95\x0A95\x0ACD\x0AB0\x0A95\x0ACD\x0AB7\x0A95\x0ACD\x0AB0\x0ACD\x0AAA\x0020\x0AAE\x0ACD\x200D\x0AAE\x0ABF\x200D"); |
|
42 _LIT16(KGujarati2,"\x0AB0\x0ABC\x0ACD\x0A95\x0A95\x0ACD\x0A95\x0AB0\x0ACD\x0A95\x0A95\x0ACD\x0AB0\x0A95\x0ACD\x0AB7\x0A95\x0ACD\x0AB0\x0ACD\x0AAA\x0020\x0AAE\x0ACD\x200D\x0AAE\x0ABF\x200D\x0AB0\x0ABC\x0ACD\x0A95\x0A95\x0ACD\x0A95\x0AB0\x0ACD\x0A95\x0A95\x0ACD\x0AB0\x0A95\x0ACD\x0AB7\x0A95\x0ACD\x0AB0\x0ACD\x0AAA\x0020\x0AAE\x0ACD\x200D\x0AAE\x0ABF\x200D\x0AB0\x0ABC\x0ACD\x0A95\x0A95\x0ACD\x0A95\x0AB0\x0ACD\x0A95\x0A95\x0ACD\x0AB0\x0A95\x0ACD\x0AB7\x0A95\x0ACD\x0AB0\x0ACD\x0AAA\x0020\x0AAE\x0ACD\x200D\x0AAE\x0ABF\x200D\x0AB0\x0ABC\x0ACD\x0A95\x0A95\x0ACD\x0A95\x0AB0\x0ACD\x0A95\x0A95\x0ACD\x0AB0\x0A95\x0ACD\x0AB7\x0A95\x0ACD\x0AB0\x0ACD\x0AAA\x0020\x0AAE\x0ACD\x200D\x0AAE\x0ABF\x200D\x0AB0\x0ABC\x0ACD\x0A95\x0A95\x0ACD\x0A95\x0AB0\x0ACD\x0A95\x0A95\x0ACD\x0AB0\x0A95\x0ACD\x0AB7\x0A95\x0ACD"); |
|
43 |
|
44 //Testcase name used as one of the parameter for ResultsAnalysisAverageByNumberOfIterations() function. |
|
45 |
|
46 _LIT16(KHindiLang1,"Hindi Reading"); |
|
47 _LIT16(KHindiLang2,"Hindi Writing"); |
|
48 |
|
49 _LIT16(KKannadaLang1,"Kannada Reading"); |
|
50 _LIT16(KKannadaLang2,"Kannada Writing"); |
|
51 |
|
52 _LIT16(KGujaratiLang1,"Gujarati Reading"); |
|
53 _LIT16(KGujaratiLang2,"Gujarati Writing"); |
|
54 |
|
55 // Conversion of the test data into constant pointer variables |
|
56 |
|
57 TPtrC ptrHindiReading(KHindi1()); |
|
58 TPtrC ptrHindiWriting(KHindi2()); |
|
59 TPtrC ptrKannadaReading(KKannada1); |
|
60 TPtrC ptrKannadaWriting(KKannada2); |
|
61 TPtrC ptrGujaratiReading(KGujarati1); |
|
62 TPtrC ptrGujaratiWriting(KGujarati2); |
|
63 TInt err; |
|
64 |
|
65 |
|
66 LOCAL_C void ResetAndDestroyRImplInfoPtrArray(TAny* aPtr) |
|
67 { |
|
68 RImplInfoPtrArray* array = reinterpret_cast <RImplInfoPtrArray*> (aPtr); |
|
69 array->ResetAndDestroy(); |
|
70 } |
|
71 |
|
72 LOCAL_C void LoadOpenFontLibrariesL(CFontStore* aFontStore) |
|
73 { |
|
74 RImplInfoPtrArray implementationArray; |
|
75 TCleanupItem cleanup(ResetAndDestroyRImplInfoPtrArray, &implementationArray); |
|
76 CleanupStack::PushL(cleanup); |
|
77 TInt error; |
|
78 TInt ecomerror; |
|
79 TInt ecomnotready; |
|
80 TUid uid = {KUidOpenFontRasterizerPlunginInterface}; |
|
81 |
|
82 // Making sure that no race situation arises |
|
83 // If ECom is not ready, give it another chance and try again. if it still doesn't work |
|
84 // after the third try, then it just carries on quietly and fails... |
|
85 for (ecomnotready =0; ecomnotready <3; ecomnotready++) |
|
86 { |
|
87 TRAP(ecomerror,REComSession::ListImplementationsL(uid,implementationArray)); |
|
88 if (ecomerror != KErrNone) |
|
89 { |
|
90 break; |
|
91 } |
|
92 } |
|
93 |
|
94 const TInt availCount = implementationArray.Count(); |
|
95 for (TInt count=0;count<availCount;++count) |
|
96 { |
|
97 const CImplementationInformation* info = implementationArray[count]; |
|
98 TUid rasterizerUid = info->ImplementationUid(); |
|
99 // Create a rasterizer |
|
100 COpenFontRasterizer* rasterizer= NULL; |
|
101 rasterizer = COpenFontRasterizer::NewL(rasterizerUid); |
|
102 CleanupStack::PushL(rasterizer); |
|
103 // Install it in the font store. |
|
104 TRAP(error,aFontStore->InstallRasterizerL(rasterizer)); |
|
105 if (error) |
|
106 { |
|
107 CleanupStack::PopAndDestroy(rasterizer); |
|
108 } |
|
109 CleanupStack::Pop(rasterizer); |
|
110 } |
|
111 |
|
112 CleanupStack::PopAndDestroy(&implementationArray); |
|
113 } |
|
114 |
|
115 CTGDIFontRenderingPerf::CTGDIFontRenderingPerf() |
|
116 { |
|
117 SetTestStepName(KTGDIFontRenderingPerfName); |
|
118 } |
|
119 |
|
120 CTGDIFontRenderingPerf::~CTGDIFontRenderingPerf() |
|
121 { |
|
122 |
|
123 } |
|
124 |
|
125 TVerdict CTGDIFontRenderingPerf::doTestStepPreambleL() |
|
126 { |
|
127 CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL(); |
|
128 return TestStepResult(); |
|
129 } |
|
130 |
|
131 /** |
|
132 Override of base class pure virtual |
|
133 Our implementation only gets called if the base class doTestStepPreambleL() did |
|
134 not leave. That being the case, the current test result value will be EPass. |
|
135 |
|
136 @return - TVerdict code |
|
137 */ |
|
138 TVerdict CTGDIFontRenderingPerf::doTestStepL() |
|
139 { |
|
140 GCP2IndicPerformanceTestL(); |
|
141 return TestStepResult(); |
|
142 } |
|
143 |
|
144 TVerdict CTGDIFontRenderingPerf::doTestStepPostambleL() |
|
145 { |
|
146 return TestStepResult(); |
|
147 } |
|
148 |
|
149 void CTGDIFontRenderingPerf::GCP2IndicPerformanceTestL() |
|
150 { |
|
151 /** |
|
152 @SYMTestCaseID GRAPHICS-UI-BENCH-0079 |
|
153 @SYMTestCaseDesc GDI performance testing for Hindi |
|
154 @SYMTestPriority High |
|
155 @SYMTestActions Attempt to simulate Reading of the Hindi text |
|
156 @SYMTestExpectedResults Time taken by GetCharacterPositon2() API to process the Hindi unicode values when all the values are passed once. |
|
157 @SYMPREQ 19: Performance testing for Ogmha |
|
158 */ |
|
159 |
|
160 SetTestStepID(_L("GRAPHICS-UI-BENCH-0079")); |
|
161 GCP2ReadingTextPerfL(ptrHindiReading,KHindiLang1); |
|
162 RecordTestResultL(); |
|
163 |
|
164 /** |
|
165 @SYMTestCaseID GRAPHICS-UI-BENCH-0080 |
|
166 @SYMTestCaseDesc GDI Performace testing for Hindi |
|
167 @SYMTestPriority High |
|
168 @SYMTestActions Attempt to compose Simulate writing Hindi Text. |
|
169 @SYMTestExpectedResults Time taken by GetCharacterPositon2() API to process the Hindi unicode values when each value is given at once |
|
170 @SYMPREQ 19: Performance testing for Ogmha |
|
171 */ |
|
172 SetTestStepID(_L("GRAPHICS-UI-BENCH-0080")); |
|
173 GCP2TypingTextPerfL(ptrHindiWriting,KHindiLang2); |
|
174 RecordTestResultL(); |
|
175 |
|
176 /** |
|
177 @SYMTestCaseID GRAPHICS-UI-BENCH-0081 |
|
178 @SYMTestCaseDesc GDI Performace testing for Kannada |
|
179 @SYMTestPriority High |
|
180 @SYMTestActions Attempt to compose Simulate Reading Kannada Text. |
|
181 @SYMTestExpectedResults Time taken by GetCharacterPositon2() API to process the Kannada unicode values when all values are given at once |
|
182 @SYMPREQ 19: Performance testing for Ogmha |
|
183 */ |
|
184 SetTestStepID(_L("GRAPHICS-UI-BENCH-0081")); |
|
185 GCP2ReadingTextPerfL(ptrKannadaReading,KKannadaLang1); |
|
186 RecordTestResultL(); |
|
187 |
|
188 /** |
|
189 @SYMTestCaseID GRAPHICS-UI-BENCH-0082 |
|
190 @SYMTestCaseDesc GDI Performace testing for Kannada |
|
191 @SYMTestPriority High |
|
192 @SYMTestActions Attempt to compose Simulate writing Kannada Text. |
|
193 @SYMTestExpectedResults Time taken by GetCharacterPositon2() API to process the Kannada unicode values when single value is given at once |
|
194 @SYMPREQ 19: Performance testing for Ogmha |
|
195 */ |
|
196 SetTestStepID(_L("GRAPHICS-UI-BENCH-0082")); |
|
197 GCP2TypingTextPerfL(ptrKannadaWriting,KKannadaLang2); |
|
198 RecordTestResultL(); |
|
199 |
|
200 /** |
|
201 @SYMTestCaseID GRAPHICS-UI-BENCH-0083 |
|
202 @SYMTestCaseDesc GDI Performace testing for Gujarati |
|
203 @SYMTestPriority High |
|
204 @SYMTestActions Attempt to compose Simulate Reading Gujarati Text. |
|
205 @SYMTestExpectedResults Time taken by GetCharacterPositon2() API to process the Gujarati unicode values when all values are given at once |
|
206 @SYMPREQ 19: Performance testing for Ogmha |
|
207 */ |
|
208 SetTestStepID(_L("GRAPHICS-UI-BENCH-0083")); |
|
209 GCP2ReadingTextPerfL(ptrGujaratiReading,KGujaratiLang1); |
|
210 RecordTestResultL(); |
|
211 |
|
212 /** |
|
213 @SYMTestCaseID GRAPHICS-UI-BENCH-0084 |
|
214 @SYMTestCaseDesc GDI Performace testing for Gujarati |
|
215 @SYMTestPriority High |
|
216 @SYMTestActions Attempt to compose Simulate writing Gujarati Text. |
|
217 @SYMTestExpectedResults Time taken by GetCharacterPositon2() API to process the Gujarati unicode values when each value is given at once |
|
218 @SYMPREQ 19: Performance testing for Ogmha |
|
219 */ |
|
220 SetTestStepID(_L("GRAPHICS-UI-BENCH-0084")); |
|
221 GCP2TypingTextPerfL(ptrGujaratiWriting,KGujaratiLang2); |
|
222 RecordTestResultL(); |
|
223 |
|
224 |
|
225 REComSession::FinalClose(); |
|
226 } |
|
227 |
|
228 /* |
|
229 This function is simulation of the Reading a document |
|
230 @param aPtr is the Testdata ie. unicode values for each language which are passed as input to GetCharacterPosition2() |
|
231 @param aTestCaseName is the name of the test case which is used as one of the parameter to ResultsAnalysisAverageByNumberOfIterations() |
|
232 */ |
|
233 void CTGDIFontRenderingPerf::GCP2ReadingTextPerfL(TPtrC aPtr,const TDesC& aTestCaseName ) |
|
234 { |
|
235 //Setting up the required Font |
|
236 CFontStore* fontStore = CFontStore::NewL(&User::Heap()); |
|
237 CleanupStack::PushL(fontStore); |
|
238 LoadOpenFontLibrariesL(fontStore); |
|
239 //Adding any required font files |
|
240 TUid fontFileUid = fontStore->AddFileL(KTestIndicFontFile); |
|
241 TFontSpec testFontSpec(KTestIndicFontFaceName,15); |
|
242 CFbsTypefaceStore* ts = CFbsTypefaceStore::NewL(NULL); |
|
243 CleanupStack::PushL(ts); |
|
244 CFbsFont* font = NULL; |
|
245 ts->GetNearestFontToDesignHeightInTwips((CFont* &)font,testFontSpec); |
|
246 iTestText.SetLength(aPtr.Length()); |
|
247 for(TInt i = 0; i < aPtr.Length(); i++) |
|
248 { |
|
249 iTestText[i]=aPtr[i]; |
|
250 } |
|
251 // Do the testing |
|
252 iParam.iDirection = CFont::EHorizontal; |
|
253 iParam.iFlags = CFont::TPositionParam::EFLogicalOrder; |
|
254 RShapeInfo shapeInfo; |
|
255 iParam.iText.Set(iTestText); |
|
256 iProfiler->InitResults(); |
|
257 for(TInt j = 0; j<KIterations ;j++) |
|
258 { |
|
259 iParam.iPosInText = 0; |
|
260 |
|
261 while (iParam.iPosInText < (iTestText.Length())) |
|
262 { |
|
263 iParam.iPen.iX = iParam.iPen.iY = 0; |
|
264 font->GetCharacterPosition2(iParam,shapeInfo); |
|
265 } |
|
266 shapeInfo.Close(); |
|
267 iProfiler->MarkResultSetL(); |
|
268 } |
|
269 iProfiler->ResultsAnalysisAverageByNumberOfIterations(aTestCaseName,0,0,0,KIterations); |
|
270 //Tidying Up |
|
271 CleanupStack::PopAndDestroy(ts); |
|
272 fontStore->RemoveFile(fontFileUid); |
|
273 CleanupStack::PopAndDestroy(fontStore); |
|
274 |
|
275 } |
|
276 |
|
277 /* |
|
278 This function is simulation of the Typing |
|
279 @param aPtr is the Testdata ie. unicode values for each language which are passed as input to GetCharacterPosition2() |
|
280 @param aTestCaseName is the name of the test case which is used as one of the parameter to ResultsAnalysisAverageByNumberOfIterations() |
|
281 */ |
|
282 |
|
283 void CTGDIFontRenderingPerf::GCP2TypingTextPerfL(TPtrC aPtr,const TDesC& aTestCaseName) |
|
284 { |
|
285 //Setting up the required Font |
|
286 CFontStore* fontStore = CFontStore::NewL(&User::Heap()); |
|
287 CleanupStack::PushL(fontStore); |
|
288 LoadOpenFontLibrariesL(fontStore); |
|
289 //Adding any required font files |
|
290 TUid fontFileUid = fontStore->AddFileL(KTestIndicFontFile); |
|
291 TFontSpec testFontSpec(KTestIndicFontFaceName,15); |
|
292 CFbsTypefaceStore* ts = CFbsTypefaceStore::NewL(NULL); |
|
293 CleanupStack::PushL(ts); |
|
294 CFbsFont* font = NULL; |
|
295 ts->GetNearestFontToDesignHeightInTwips((CFont* &)font,testFontSpec); |
|
296 iTestText1.SetLength(aPtr.Length()); |
|
297 for(TInt i = 0; i < aPtr.Length(); i++) |
|
298 { |
|
299 iTestText1[i]=aPtr[i]; |
|
300 } |
|
301 iParam.iDirection = CFont::EHorizontal; |
|
302 iParam.iFlags = CFont::TPositionParam::EFLogicalOrder; |
|
303 iProfiler->InitResults(); |
|
304 for(TInt j = 0; j < KIterations ;j++) |
|
305 { |
|
306 TBuf<130> testText3(0); |
|
307 for (TInt length = 0; length < (aPtr.Length()); length++) |
|
308 { |
|
309 testText3.Append(iTestText1[length]); |
|
310 iParam.iText.Set(testText3); |
|
311 iParam.iPosInText = 0; |
|
312 iParam.iPen.iX = iParam.iPen.iY = 0; |
|
313 TInt k = testText3.Length(); |
|
314 iParam.iPen.iX = iParam.iPen.iY = 0; |
|
315 TInt prev_pos_inText = iParam.iPosInText; |
|
316 for (TInt m =0 ; m<5; m++) |
|
317 { |
|
318 iParam.iPosInText = prev_pos_inText; |
|
319 RShapeInfo shapeInfo; |
|
320 while (iParam.iPosInText <(testText3.Length())) |
|
321 { |
|
322 iParam.iPen.iX = iParam.iPen.iY = 0; |
|
323 font->GetCharacterPosition2(iParam,shapeInfo); |
|
324 } |
|
325 shapeInfo.Close(); |
|
326 } |
|
327 } |
|
328 iProfiler->MarkResultSetL(); |
|
329 } |
|
330 iProfiler->ResultsAnalysisAverageByNumberOfIterations(aTestCaseName,0,0,0,KIterations); |
|
331 CleanupStack::PopAndDestroy(ts); |
|
332 fontStore->RemoveFile(fontFileUid); |
|
333 CleanupStack::PopAndDestroy(fontStore); |
|
334 } |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 |