|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32test.h> |
|
20 #include <bitdev.h> |
|
21 #include <graphics/shapeimpl.h> |
|
22 #include <badesca.h> |
|
23 #include "testData.h" |
|
24 #include <ecom/ecom.h> |
|
25 #include <ecom/implementationproxy.h> |
|
26 #include <e32math.h> |
|
27 #include <graphics/openfontrasterizer.h> |
|
28 #include <graphics/openfontconstants.h> |
|
29 |
|
30 //add filenames for any test data here |
|
31 const TText16* KTestFilenames[] = |
|
32 { |
|
33 //created from original iculayoutengine test data |
|
34 (const TText16*) L"z:\\test\\data\\tnr_dev_otshaperdata1.dat", |
|
35 //created from input data provided by licensee |
|
36 (const TText16*) L"z:\\test\\data\\tnr_dev_otshaperdata2.dat", |
|
37 //created from input data provided by licensee |
|
38 (const TText16*) L"z:\\test\\data\\tnr_dev_otshaperdata3.dat", |
|
39 //created from input data provided by licensee |
|
40 (const TText16*) L"z:\\test\\data\\tnr_dev_otshaperdata4.dat", |
|
41 // Data to test defect fix DEF078032 |
|
42 (const TText16*) L"z:\\test\\data\\tnr_dev_otshaperdata5.dat", |
|
43 //created from input data provided by licensee |
|
44 (const TText16*) L"z:\\test\\data\\shaperkannadadata1.dat", |
|
45 // created from Kannada sample text |
|
46 (const TText16*) L"z:\\test\\data\\shaperkannadadata2.dat", |
|
47 // created from Kannada sample text |
|
48 (const TText16*) L"z:\\test\\data\\shaperkannadadata3.dat", |
|
49 // created from Gujarati sample text taken from the web |
|
50 (const TText16*) L"z:\\test\\data\\shapergujaratidata1.dat", |
|
51 // created from Gujarati sample text taken from the web |
|
52 (const TText16*) L"z:\\test\\data\\shapergujaratidata2.dat", |
|
53 // created from Gujarati sample text given by the licensee |
|
54 (const TText16*) L"z:\\test\\data\\shapergujaratidata3.dat", |
|
55 // created from Bengali sample text given by the licensee |
|
56 (const TText16*) L"z:\\test\\data\\shaperbengalidata1.dat", |
|
57 // created from Bengali sample text given by the licensee |
|
58 (const TText16*) L"z:\\test\\data\\shaperbengalidata2.dat", |
|
59 // created from Bengali sample text given by the licensee |
|
60 (const TText16*) L"z:\\test\\data\\shaperbengalidata3.dat", |
|
61 // created from Tamil sample text given by the licensee |
|
62 (const TText16*) L"z:\\test\\data\\shapertamildata1.dat", |
|
63 // created from Tamil sample text given by the licensee |
|
64 (const TText16*) L"z:\\test\\data\\shapertamildata2.dat", |
|
65 // created from Tamil sample text given by the licensee |
|
66 (const TText16*) L"z:\\test\\data\\shapertamildata3.dat", |
|
67 // created from Telugu sample text given by the licensee |
|
68 (const TText16*) L"z:\\test\\data\\shapertelugudata1.dat", |
|
69 // created from Telugu sample text given by the licensee |
|
70 (const TText16*) L"z:\\test\\data\\shapertelugudata2.dat", |
|
71 // created from Telugu sample text given by the licensee |
|
72 (const TText16*) L"z:\\test\\data\\shapertelugudata3.dat", |
|
73 // Test for Gurmukhi digit |
|
74 (const TText16*) L"z:\\test\\data\\shapergurmukhi1.dat", |
|
75 (const TText16*) L"z:\\test\\data\\shapergurmukhi2.dat", |
|
76 (const TText16*) L"z:\\test\\data\\shapergurmukhi3.dat", |
|
77 (const TText16*) L"z:\\test\\data\\shapergurmukhi4.dat", |
|
78 (const TText16*) L"z:\\test\\data\\shapergurmukhi5.dat", |
|
79 // Test for Malayalam digit |
|
80 (const TText16*) L"z:\\test\\data\\shapermalayalam1.dat", |
|
81 (const TText16*) L"z:\\test\\data\\shapermalayalam2.dat", |
|
82 (const TText16*) L"z:\\test\\data\\shapermalayalam3.dat", |
|
83 (const TText16*) L"z:\\test\\data\\shapermalayalam4.dat", |
|
84 (const TText16*) L"z:\\test\\data\\shapermalayalam5.dat" |
|
85 }; |
|
86 |
|
87 /** |
|
88 Number of test data files of each of the scripts/languages bein tests. |
|
89 Must change these if KTestFilnames[] above is changed |
|
90 */ |
|
91 const TInt KHindiTestDataIndex = 0; |
|
92 const TInt KNumberOfHindiTestDataFiles = 5; |
|
93 const TInt KKannadaTestDataIndex = 5; |
|
94 const TInt KNumberOfKannadaTestDataFiles = 3; |
|
95 const TInt KGujaratiTestDataIndex = 8; |
|
96 const TInt KNumberOfGujaratiTestDataFiles = 3; |
|
97 const TInt KBengaliTestDataIndex = 11; |
|
98 const TInt KNumberOfBengaliTestDataFiles = 3; |
|
99 const TInt KTamilTestDataIndex = 14; |
|
100 const TInt KNumberOfTamilTestDataFiles = 3; |
|
101 const TInt KTeluguTestDataIndex = 17; |
|
102 const TInt KNumberOfTeluguTestDataFiles = 3; |
|
103 const TInt KGurmukhiTestDataIndex = 20; |
|
104 const TInt KNumberOfGurmukhiTestDataFiles = 5; |
|
105 const TInt KMalayalamTestDataIndex = 25; |
|
106 const TInt KNumberOfMalayalamTestDataFiles = 5; |
|
107 |
|
108 const TUint32 KDevanagariScriptCode = 0x64657661; |
|
109 const TUint32 KKannadaScriptCode = 0x6B6E6461; |
|
110 const TUint32 KHindiLanguageCode = 0x48494E20; |
|
111 const TUint32 KKannadaLanguageCode = 0x4B414E20; |
|
112 const TUint32 KGujaratiScriptCode = 0x67756A72; |
|
113 const TUint32 KGujaratiLanguageCode = 0x47554A20; |
|
114 const TUint32 KBengaliScriptCode = 0x62656E67; |
|
115 const TUint32 KBengaliLanguageCode = 0x42454E20; |
|
116 const TUint32 KTamilScriptCode = 0x74616D6C; |
|
117 const TUint32 KTamilLanguageCode = 0x54414D20; |
|
118 const TUint32 KTeluguScriptCode = 0x74656C75; |
|
119 const TUint32 KTeluguLanguageCode = 0x54454C20; |
|
120 const TUint32 KGurmukhiScriptCode = 0x67757275; |
|
121 const TUint32 KGurmukhiLanguageCode = 0; |
|
122 const TUint32 KMalayalamScriptCode = 0x6d6c796d; |
|
123 const TUint32 KMalayalamLanguageCode = 0x4d4c5220; |
|
124 |
|
125 |
|
126 // For RTest |
|
127 //************************************************************************************** |
|
128 static RTest TheTest(_L("TC_SHAP_shapeText")); |
|
129 static void Check(TInt aValue, TInt aLine) |
|
130 { |
|
131 if(!aValue) |
|
132 { |
|
133 TheTest(EFalse, aLine); |
|
134 } |
|
135 } |
|
136 |
|
137 static void Check(TInt aValue, TInt aExpected, TInt aLine) |
|
138 { |
|
139 if(aValue != aExpected) |
|
140 { |
|
141 RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); |
|
142 TheTest(EFalse, aLine); |
|
143 } |
|
144 } |
|
145 |
|
146 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__) |
|
147 #define TEST(arg) ::Check((arg), __LINE__) |
|
148 |
|
149 // Convenience methods |
|
150 //************************************************************************************** |
|
151 |
|
152 /* |
|
153 Used for cleanup of RImplInfoArray implementationArray below |
|
154 This method is stolen from FbsTop.cpp |
|
155 */ |
|
156 LOCAL_C void ResetAndDestroyRImplInfoPtrArray(TAny* aPtr) |
|
157 { |
|
158 RImplInfoPtrArray* array = reinterpret_cast <RImplInfoPtrArray*> (aPtr); |
|
159 array->ResetAndDestroy(); |
|
160 } |
|
161 |
|
162 /* |
|
163 Load all ECOM implemented rasterizer DLLs. |
|
164 This method is stolen from CFbTop::LoadOpenFontLibraries() |
|
165 */ |
|
166 LOCAL_C void LoadOpenFontLibraries(CFontStore* aFontStore) |
|
167 { |
|
168 |
|
169 RImplInfoPtrArray implementationArray; |
|
170 TCleanupItem cleanup(ResetAndDestroyRImplInfoPtrArray, &implementationArray); |
|
171 CleanupStack::PushL(cleanup); |
|
172 TInt error; |
|
173 TInt ecomerror; |
|
174 TInt ecomnotready; |
|
175 TUid uid = {KUidOpenFontRasterizerPlunginInterface}; |
|
176 |
|
177 // Making sure that no race situation arises |
|
178 // If ECom is not ready, give it another chance and try again. if it still doesn't work |
|
179 // after the third try, then it just carries on quietly and fails... |
|
180 for (ecomnotready =0; ecomnotready <3; ecomnotready++) |
|
181 { |
|
182 TRAP(ecomerror,REComSession::ListImplementationsL(uid,implementationArray)); |
|
183 if (!ecomerror) |
|
184 { |
|
185 break; |
|
186 } |
|
187 else |
|
188 { |
|
189 ecomerror = 0; |
|
190 User::After(0); |
|
191 } |
|
192 } |
|
193 |
|
194 const TInt availCount = implementationArray.Count(); |
|
195 for (TInt count=0;count<availCount;++count) |
|
196 { |
|
197 const CImplementationInformation* info = implementationArray[count]; |
|
198 TUid rasterizerUid = info->ImplementationUid(); |
|
199 // Create a rasterizer |
|
200 COpenFontRasterizer* rasterizer=0; |
|
201 TRAP(error,rasterizer = COpenFontRasterizer::NewL(rasterizerUid)); |
|
202 if (!error) |
|
203 { |
|
204 // Install it in the font store. |
|
205 TRAP(error,aFontStore->InstallRasterizerL(rasterizer)); |
|
206 if (error) |
|
207 delete rasterizer; |
|
208 } |
|
209 } |
|
210 CleanupStack::PopAndDestroy(&implementationArray); |
|
211 |
|
212 } |
|
213 |
|
214 LOCAL_C RPointerArray<CTestData> SetupTestData(CDesC16ArrayFlat* aFilenames) |
|
215 { |
|
216 RPointerArray<CTestData> testDataArr(1);// = new(ELeave) CArrayFixFlat<CTestData>(1); |
|
217 |
|
218 for (TInt i = 0; i<aFilenames->Count(); i++) |
|
219 { |
|
220 CTestData* temp = new(ELeave) CTestData; |
|
221 temp->Internalize((*aFilenames)[i]); |
|
222 testDataArr.AppendL(temp); |
|
223 } |
|
224 |
|
225 return testDataArr; |
|
226 } |
|
227 |
|
228 |
|
229 // test methods |
|
230 //************************************************************************************** |
|
231 |
|
232 /** |
|
233 @file |
|
234 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-1479 |
|
235 @SYMTestCaseDesc Simple test of the shaper |
|
236 @SYMTestPriority High |
|
237 @SYMTestActions Simple test to shape some text using the shaper, and test that the output is as expected. Does not perform any OOM testing. |
|
238 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
239 @SYMPREQ PREQ18 |
|
240 */ |
|
241 void doShapeText(CBitmapFont* font, CTestData& aTestData, const TUint32 aScript, |
|
242 const TUint32 aLang, TBool aCheckOutput = EFalse) |
|
243 { |
|
244 TheTest.Next(_L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-1479 ")); |
|
245 TInt err; |
|
246 |
|
247 //set up the shaper |
|
248 CShaper* theShaper = NULL; |
|
249 CShaperFactory* shaperFactory = NULL; |
|
250 |
|
251 RImplInfoPtrArray implementationArray; |
|
252 TCleanupItem cleanup(ResetAndDestroyRImplInfoPtrArray, &implementationArray); |
|
253 CleanupStack::PushL(cleanup); |
|
254 TInt error; |
|
255 TInt ecomerror; |
|
256 TInt ecomnotready; |
|
257 TUid uid = {KUidShaperFactoryPlunginInterface}; |
|
258 |
|
259 // Making sure that no race situation arises between FBserv and Ecom |
|
260 // If ECom is not ready, give it another chance and try again. if it still doesn't work |
|
261 // after the third try, then it just carries on quietly and fails... |
|
262 for (ecomnotready =0; ecomnotready <3; ecomnotready++) |
|
263 { |
|
264 |
|
265 TRAP(ecomerror,REComSession::ListImplementationsL(uid,implementationArray)); |
|
266 if (!ecomerror) |
|
267 { |
|
268 break; |
|
269 } |
|
270 else |
|
271 { |
|
272 ecomerror = 0; |
|
273 User::After(0); |
|
274 } |
|
275 } |
|
276 |
|
277 const TInt availCount = implementationArray.Count(); |
|
278 for (TInt count=0;count<availCount;++count) |
|
279 { |
|
280 const CImplementationInformation* info = implementationArray[count]; |
|
281 TUid shaperFactoryUid = info->ImplementationUid(); |
|
282 // Create a shaper factory |
|
283 TRAP(error,shaperFactory = CShaperFactory::NewL(shaperFactoryUid)); |
|
284 TEST2(error, KErrNone); |
|
285 // Create a shaper |
|
286 TRAPD(err, theShaper = shaperFactory->NewShaperL(font, aScript, aLang, &User::Heap())); |
|
287 TEST2(err, KErrNone); |
|
288 } |
|
289 CleanupStack::PopAndDestroy(&implementationArray); |
|
290 |
|
291 CleanupStack::PushL(shaperFactory); |
|
292 CleanupStack::PushL(theShaper); |
|
293 |
|
294 // create the data to be shaped |
|
295 // this uses hindiTestData, defined in testData.h |
|
296 CShaper::TInput input; |
|
297 input.iText = aTestData.iTextInput; |
|
298 input.iStart = aTestData.iStart; |
|
299 input.iEnd = aTestData.iEnd; |
|
300 |
|
301 TInt textLength = input.iText->Length(); |
|
302 |
|
303 //create shape header, and shape the text |
|
304 TShapeHeader* output = NULL; |
|
305 err = theShaper->ShapeText(output, input, &User::Heap()); |
|
306 TEST2(err,KErrNone); |
|
307 CleanupStack::PopAndDestroy(theShaper); |
|
308 CleanupStack::PopAndDestroy(shaperFactory); |
|
309 REComSession::FinalClose(); |
|
310 |
|
311 CleanupStack::PushL(output); |
|
312 |
|
313 if (aCheckOutput) |
|
314 { |
|
315 // check the contents of output |
|
316 TEST(output->iGlyphCount == aTestData.iGlyphCount); |
|
317 TEST(output->iCharacterCount == aTestData.iCharacterCount); |
|
318 |
|
319 // First iGlyphCount * 4 bytes of the output buffer contain the glyph codes as 2byte values |
|
320 // Compare against expected. |
|
321 TInt i=0; |
|
322 TUint32* shapePtr32 = (reinterpret_cast<TUint32*>(&output->iBuffer[0])); |
|
323 for (i=0; i < output->iGlyphCount; i++) |
|
324 { |
|
325 TEST2(*shapePtr32, (*aTestData.iGlyphs)[i]); |
|
326 shapePtr32++; |
|
327 } |
|
328 |
|
329 // next iGlyphCount * 4 bytes contain the postions in which the glyphs should be drawn, x and y axes. |
|
330 // Compare against expected |
|
331 TUint16* shapePtr16 = (reinterpret_cast<TUint16*>(shapePtr32)); |
|
332 for (i=0; i < output->iGlyphCount*2; i++) |
|
333 { |
|
334 //check X or Y position |
|
335 TEST2(*shapePtr16,(*aTestData.iPositions)[i]); |
|
336 shapePtr16++; |
|
337 } |
|
338 |
|
339 // check advance |
|
340 TEST(*shapePtr16 == aTestData.iAdvance.iX); |
|
341 shapePtr16++; |
|
342 TEST(*shapePtr16 == aTestData.iAdvance.iY); |
|
343 shapePtr16++; |
|
344 |
|
345 // next iGlyphCount * 2 bytes contain the coresponding indices of this character in the original string. |
|
346 // Compare against expected |
|
347 for (i=0; i < output->iGlyphCount; i++) |
|
348 { |
|
349 TEST2(*shapePtr16, (*aTestData.iIndices)[i]); |
|
350 shapePtr16++; |
|
351 } |
|
352 } |
|
353 |
|
354 |
|
355 CleanupStack::PopAndDestroy(output); |
|
356 } |
|
357 |
|
358 void shapeText(CBitmapFont* font, CTestData& aTestData, const TUint32 aScript, |
|
359 const TUint32 aLang, TBool aCheckOutput = EFalse) |
|
360 { |
|
361 __UHEAP_MARK; |
|
362 TInt heapSizeAtStart = 0; |
|
363 User::Heap().AllocSize(heapSizeAtStart); |
|
364 |
|
365 RDebug::Print(_L("Heap memory utilized is now %d\n"), heapSizeAtStart); |
|
366 |
|
367 doShapeText(font, aTestData, aScript, aLang, aCheckOutput); |
|
368 // check the heap used by the shaper |
|
369 RHeap* heap = &User::Heap(); |
|
370 heap->Check(); |
|
371 TInt heapSizeAtEnd = 0; |
|
372 TInt heapCellsUsed = heap->AllocSize(heapSizeAtEnd); |
|
373 if (heapCellsUsed) |
|
374 { |
|
375 TheTest.Printf(_L("This test leaked %d\n"), heapSizeAtEnd - heapSizeAtStart); |
|
376 } |
|
377 __UHEAP_MARKEND; |
|
378 } |
|
379 |
|
380 void doOomShapeText(CBitmapFont* font, CTestData& aTestData, const TUint32 aScript, const TUint32 aLang); |
|
381 /** |
|
382 @file |
|
383 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-1480 |
|
384 @SYMTestCaseDesc Simple OOM test of shaper |
|
385 @SYMTestPriority High |
|
386 @SYMTestActions OOM testing for the shaper. Also ensures no leaks. |
|
387 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
388 @SYMPREQ PREQ18 |
|
389 */ |
|
390 void oomShapeText(CBitmapFont* font, CTestData& aTestData, const TUint32 aScript, const TUint32 aLang) |
|
391 { |
|
392 __UHEAP_MARK; |
|
393 TheTest.Next(_L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-1480 ")); |
|
394 doOomShapeText(font,aTestData, aScript, aLang); |
|
395 __UHEAP_MARKEND; |
|
396 } |
|
397 |
|
398 void doOomShapeText(CBitmapFont* font, CTestData& aTestData, const TUint32 aScript, const TUint32 aLang) |
|
399 { |
|
400 TInt count = 0; |
|
401 TInt err = KErrNone; |
|
402 TInt heapCellsUsed, heapSizeAtEnd, heapSizeAtStart; |
|
403 CShaper* theShaper = NULL; |
|
404 CShaperFactory* shaperFactory = NULL; |
|
405 TShapeHeader* output = NULL; |
|
406 |
|
407 User::Heap().AllocSize(heapSizeAtStart); |
|
408 |
|
409 // create the data to be shaped |
|
410 CShaper::TInput input; |
|
411 input.iText = aTestData.iTextInput; |
|
412 input.iStart = aTestData.iStart; |
|
413 input.iEnd = aTestData.iEnd; |
|
414 |
|
415 //set up shaper, shape, delete shaper in oom loop |
|
416 RImplInfoPtrArray implementationArray; |
|
417 TCleanupItem cleanup(ResetAndDestroyRImplInfoPtrArray, &implementationArray); |
|
418 CleanupStack::PushL(cleanup); |
|
419 TInt error; |
|
420 TInt ecomerror; |
|
421 TInt ecomnotready; |
|
422 TUid uid = {KUidShaperFactoryPlunginInterface}; |
|
423 |
|
424 // Making sure that no race situation arises between FBserv and Ecom |
|
425 // If ECom is not ready, give it another chance and try again. if it still doesn't work |
|
426 // after the third try, then it just carries on quietly and fails... |
|
427 for (ecomnotready =0; ecomnotready <3; ecomnotready++) |
|
428 { |
|
429 |
|
430 TRAP(ecomerror,REComSession::ListImplementationsL(uid,implementationArray)); |
|
431 if (!ecomerror) |
|
432 { |
|
433 break; |
|
434 } |
|
435 else |
|
436 { |
|
437 ecomerror = 0; |
|
438 User::After(0); |
|
439 } |
|
440 } |
|
441 |
|
442 const TInt availCount = implementationArray.Count(); |
|
443 for (TInt count=0;count<availCount;++count) |
|
444 { |
|
445 const CImplementationInformation* info = implementationArray[count]; |
|
446 TUid shaperFactoryUid = info->ImplementationUid(); |
|
447 // Create a shaper factory |
|
448 //CShaperFactory* shaperFactory = 0; |
|
449 TRAP(error,shaperFactory = CShaperFactory::NewL(shaperFactoryUid)); |
|
450 TEST2(error, KErrNone); |
|
451 //CleanupStack::PushL(shaperFactory); |
|
452 } |
|
453 CleanupStack::PopAndDestroy(&implementationArray); |
|
454 |
|
455 do |
|
456 { |
|
457 count += 1; |
|
458 __UHEAP_FAILNEXT(count); |
|
459 |
|
460 // Create a shaper |
|
461 TRAPD(err, theShaper = shaperFactory->NewShaperL(font, aScript, aLang, &User::Heap())); |
|
462 |
|
463 //shape text |
|
464 if (theShaper) |
|
465 { |
|
466 err = theShaper->ShapeText(output, input, &User::Heap()); |
|
467 TEST2(err,KErrNone); |
|
468 } |
|
469 |
|
470 //free output; to be done by the caller of ShapeText |
|
471 delete output; |
|
472 output = NULL; |
|
473 |
|
474 //does not check the output for now |
|
475 delete theShaper; |
|
476 delete shaperFactory; |
|
477 REComSession::FinalClose(); |
|
478 |
|
479 }while ((err==KErrNoMemory)||(err==KErrGeneral)); |
|
480 __UHEAP_RESET; |
|
481 |
|
482 // check the heap used by the shaper |
|
483 RHeap* heap = &User::Heap(); |
|
484 heap->Check(); |
|
485 heapCellsUsed = heap->AllocSize(heapSizeAtEnd); |
|
486 if (heapCellsUsed) |
|
487 { |
|
488 TheTest.Printf(_L("This test leaked %d.\n"), heapSizeAtEnd - heapSizeAtStart); |
|
489 } |
|
490 } |
|
491 |
|
492 void doRepeatShapeText(CBitmapFont* font, CTestData& aTestData, const TUint32 aScript, const TUint32 aLang); |
|
493 |
|
494 /** |
|
495 @file |
|
496 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-1481 |
|
497 @SYMTestCaseDesc Tests that the shaper can handle multiple calls to ShapeText |
|
498 @SYMTestPriority High |
|
499 @SYMTestActions Makes multiple calls to CShaper::ShapeText with small amounts of text to be shaped |
|
500 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
501 @SYMPREQ PREQ18 |
|
502 */ |
|
503 void repeatShapeText(CBitmapFont* aFont, CTestData& aTestData, const TUint32 aScript, const TUint32 aLang) |
|
504 { |
|
505 __UHEAP_MARK; |
|
506 TheTest.Next(_L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-1481 ")); |
|
507 doRepeatShapeText(aFont, aTestData, aScript, aLang); |
|
508 __UHEAP_MARKEND; |
|
509 } |
|
510 |
|
511 void doRepeatShapeText(CBitmapFont* font, CTestData& aTestData, const TUint32 aScript, const TUint32 aLang) |
|
512 { |
|
513 TInt err; |
|
514 |
|
515 //set up the shaper |
|
516 CShaper* theShaper = NULL; |
|
517 CShaperFactory* shaperFactory = NULL; |
|
518 |
|
519 RImplInfoPtrArray implementationArray; |
|
520 TCleanupItem cleanup(ResetAndDestroyRImplInfoPtrArray, &implementationArray); |
|
521 CleanupStack::PushL(cleanup); |
|
522 TInt error; |
|
523 TInt ecomerror; |
|
524 TInt ecomnotready; |
|
525 TUid uid = {KUidShaperFactoryPlunginInterface}; |
|
526 |
|
527 // Making sure that no race situation arises between FBserv and Ecom |
|
528 // If ECom is not ready, give it another chance and try again. if it still doesn't work |
|
529 // after the third try, then it just carries on quietly and fails... |
|
530 for (ecomnotready =0; ecomnotready <3; ecomnotready++) |
|
531 { |
|
532 |
|
533 TRAP(ecomerror,REComSession::ListImplementationsL(uid,implementationArray)); |
|
534 if (!ecomerror) |
|
535 { |
|
536 break; |
|
537 } |
|
538 else |
|
539 { |
|
540 ecomerror = 0; |
|
541 User::After(0); |
|
542 } |
|
543 } |
|
544 |
|
545 const TInt availCount = implementationArray.Count(); |
|
546 for (TInt count=0;count<availCount;++count) |
|
547 { |
|
548 const CImplementationInformation* info = implementationArray[count]; |
|
549 TUid shaperFactoryUid = info->ImplementationUid(); |
|
550 // Create a shaper factory |
|
551 TRAP(error,shaperFactory = CShaperFactory::NewL(shaperFactoryUid)); |
|
552 TEST2(error, KErrNone); |
|
553 |
|
554 // Create a shaper |
|
555 TRAPD(err, theShaper = shaperFactory->NewShaperL(font, aScript, aLang, &User::Heap())); |
|
556 TEST2(err, KErrNone); |
|
557 } |
|
558 CleanupStack::PopAndDestroy(&implementationArray); |
|
559 |
|
560 CleanupStack::PushL(shaperFactory); |
|
561 CleanupStack::PushL(theShaper); |
|
562 |
|
563 // create the data to be shaped |
|
564 // this uses CTestData, defined in testData.h |
|
565 CShaper::TInput input; |
|
566 input.iText = aTestData.iTextInput; |
|
567 |
|
568 //create shape header, and shape the text |
|
569 TShapeHeader* output = NULL; |
|
570 |
|
571 for(TInt i=aTestData.iStart; i<aTestData.iEnd -10; i++) |
|
572 { |
|
573 //indicate which 10 chars to be shaped |
|
574 input.iStart = i; |
|
575 input.iEnd = i + 10; |
|
576 |
|
577 //shape text |
|
578 err = theShaper->ShapeText(output, input, &User::Heap()); |
|
579 TEST2(err,KErrNone); |
|
580 |
|
581 //free output; to be done by the caller of ShapeText |
|
582 delete(output); |
|
583 output = NULL; |
|
584 |
|
585 //does not check the output for now |
|
586 } |
|
587 |
|
588 //cleanup the shaper |
|
589 CleanupStack::PopAndDestroy(theShaper); |
|
590 CleanupStack::PopAndDestroy(shaperFactory); |
|
591 REComSession::FinalClose(); |
|
592 } |
|
593 |
|
594 /* |
|
595 @file |
|
596 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-3401 |
|
597 @SYMTestCaseDesc Tests that the shaper can handle calls to shapeText with multiple font sizes |
|
598 @SYMTestPriority High |
|
599 @SYMTestActions Makes multiple calls to CShaper::ShapeText with small amounts of text to be shaped and incremental font sizes |
|
600 @SYMTestExpectedResults The test must not show a memory leak at any font size |
|
601 @SYMPREQ DEF103042: TC_SHAP_shapeText test failing with alloc failure |
|
602 **/ |
|
603 void doRepeatShapeUsingVariousFontSizesTest(CFontStore* aFontStore, const TDesC aTypefaceName, const TDesC &aText1, |
|
604 const TDesC &aText2, const TDesC &aText3, const TUint32 aScript, |
|
605 const TUint32 aLang) |
|
606 { |
|
607 TheTest.Next(_L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-3401 ")); |
|
608 TInt heapCellsUsed, heapSizeAtEnd, heapSizeAtStart; |
|
609 User::Heap().AllocSize(heapSizeAtStart); |
|
610 |
|
611 // Set up shaper factory |
|
612 // Set up the shaper |
|
613 CShaper* theShaper = NULL; |
|
614 CShaperFactory* shaperFactory = NULL; |
|
615 |
|
616 RImplInfoPtrArray implementationArray; |
|
617 TCleanupItem cleanup(ResetAndDestroyRImplInfoPtrArray, &implementationArray); |
|
618 CleanupStack::PushL(cleanup); |
|
619 TInt error; |
|
620 TInt ecomerror; |
|
621 TInt ecomnotready; |
|
622 TUid uid = {KUidShaperFactoryPlunginInterface}; |
|
623 |
|
624 // Making sure that no race situation arises between FBserv and Ecom |
|
625 // If ECom is not ready, give it another chance and try again. if it still doesn't work |
|
626 // after the third try, then it just carries on quietly and fails... |
|
627 for (ecomnotready =0; ecomnotready <3; ecomnotready++) |
|
628 { |
|
629 TRAP(ecomerror,REComSession::ListImplementationsL(uid,implementationArray)); |
|
630 if (!ecomerror) |
|
631 { |
|
632 break; |
|
633 } |
|
634 else |
|
635 { |
|
636 ecomerror = 0; |
|
637 User::After(0); |
|
638 } |
|
639 } |
|
640 |
|
641 const TInt availCount = implementationArray.Count(); |
|
642 for (TInt count=0;count<availCount;++count) |
|
643 { |
|
644 const CImplementationInformation* info = implementationArray[count]; |
|
645 TUid shaperFactoryUid = info->ImplementationUid(); |
|
646 // Create a shaper factory |
|
647 TRAP(error,shaperFactory = CShaperFactory::NewL(shaperFactoryUid)); |
|
648 TEST2(error, KErrNone); |
|
649 } |
|
650 |
|
651 CleanupStack::PopAndDestroy(&implementationArray); |
|
652 CleanupStack::PushL(shaperFactory); |
|
653 |
|
654 // create the data to be shaped |
|
655 // this explicitely uses hindiTestData, defined in testData.h |
|
656 CShaper::TInput input; |
|
657 input.iStart = 0; |
|
658 |
|
659 //create shape header, and shape the text |
|
660 TShapeHeader* output = NULL; |
|
661 |
|
662 CBitmapFont* font; |
|
663 |
|
664 // Test shaping for the Hindi texts for various font sizes |
|
665 TheTest.Printf(_L("Generating a random initial font size between 0 and 1 for this test\n")); |
|
666 TInt random = (Math::Random()>>11)%2; |
|
667 TheTest.Printf(_L("Random initial font size is %d. Testing upto size 300 with increments of 2\n"), random); |
|
668 for (TInt i = random; i <= 300; i+=2) |
|
669 { |
|
670 RDebug::Print(_L("Font Size: %d\n"), i); |
|
671 TFontSpec fontSpec(aTypefaceName,i*20); |
|
672 aFontStore->GetNearestFontInTwips((CFont*&)font, fontSpec); |
|
673 CleanupStack::PushL(font); |
|
674 |
|
675 TRAPD(err, theShaper = shaperFactory->NewShaperL(font, aScript, aLang, &User::Heap())); |
|
676 TEST2(err, KErrNone); |
|
677 CleanupStack::PushL(theShaper); |
|
678 |
|
679 // Call the shaper twice because the first time the rasterizer uses memory to cache the tables |
|
680 // We can then check the heap in the second call |
|
681 input.iText = &aText1; |
|
682 input.iEnd = aText1.Length(); |
|
683 err = theShaper->ShapeText(output, input, &User::Heap()); |
|
684 delete output; |
|
685 TEST2(err,KErrNone); |
|
686 __UHEAP_MARK; |
|
687 err = theShaper->ShapeText(output, input, &User::Heap()); |
|
688 delete output; |
|
689 __UHEAP_MARKEND; |
|
690 TEST2(err,KErrNone); |
|
691 |
|
692 input.iText = &aText2; |
|
693 input.iEnd = aText2.Length(); |
|
694 err = theShaper->ShapeText(output, input, &User::Heap()); |
|
695 delete output; |
|
696 TEST2(err,KErrNone); |
|
697 __UHEAP_MARK; |
|
698 err = theShaper->ShapeText(output, input, &User::Heap()); |
|
699 delete output; |
|
700 __UHEAP_MARKEND; |
|
701 TEST2(err,KErrNone); |
|
702 |
|
703 input.iText = &aText3; |
|
704 input.iEnd = aText3.Length(); |
|
705 err = theShaper->ShapeText(output, input, &User::Heap()); |
|
706 delete output; |
|
707 TEST2(err,KErrNone); |
|
708 __UHEAP_MARK; |
|
709 err = theShaper->ShapeText(output, input, &User::Heap()); |
|
710 delete output; |
|
711 __UHEAP_MARKEND; |
|
712 TEST2(err,KErrNone); |
|
713 |
|
714 CleanupStack::PopAndDestroy(theShaper); |
|
715 CleanupStack::Pop(font); |
|
716 aFontStore->ReleaseFont(font); |
|
717 } |
|
718 |
|
719 CleanupStack::PopAndDestroy(shaperFactory); |
|
720 |
|
721 //close the ecom session opened by LoadOpenFontLibraries() |
|
722 REComSession::FinalClose(); |
|
723 |
|
724 // check the heap used by the shaper |
|
725 RHeap* heap = &User::Heap(); |
|
726 heap->Check(); |
|
727 heapCellsUsed = heap->AllocSize(heapSizeAtEnd); |
|
728 if (heapCellsUsed) |
|
729 { |
|
730 TheTest.Printf(_L("This test utilised %d bytes\n"), heapSizeAtEnd - heapSizeAtStart); |
|
731 } |
|
732 } |
|
733 |
|
734 /** |
|
735 @file |
|
736 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-3403 |
|
737 @SYMTestCaseDesc Tests the shaper using Devanagari Unicode. Test include OOM tests (oomShapeText), repeated |
|
738 calls to the shaper (repeatShapeText), simple shaping tests (shapeText), and repeatedly |
|
739 calling the shaper with incremental font sizes. |
|
740 @SYMTestPriority High |
|
741 @SYMTestActions Performs various tests of the the shaper, calling CShaper::ShapeText in various use cases |
|
742 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
743 @SYMPREQ PREQ19 |
|
744 */ |
|
745 void HindiTestsL(RPointerArray<CTestData> aTestDataArr) |
|
746 { |
|
747 TheTest.Next(_L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-3403 ")); |
|
748 TInt i; |
|
749 CBitmapFont* font; |
|
750 TInt err=KErrNone; |
|
751 //the font store can use the normal user heap |
|
752 CFontStore* fontStore = CFontStore::NewL(&User::Heap()); |
|
753 fontStore->iKPixelWidthInTwips = 11860; |
|
754 fontStore->iKPixelHeightInTwips = 11860; |
|
755 CleanupStack::PushL(fontStore); |
|
756 |
|
757 //load all ecom implemented rasterizer dlls. installs the rasterizer. |
|
758 LoadOpenFontLibraries(fontStore); |
|
759 |
|
760 //add the required Hindi font file |
|
761 TRAP(err,fontStore->AddFileL(aTestDataArr[KHindiTestDataIndex]->iFilename)); |
|
762 TEST(err==KErrNone); |
|
763 |
|
764 |
|
765 //run all tests for TNR_Dev_OT test, which is at position 0 in the aTestDataArr |
|
766 TFontSpec fontSpec(aTestDataArr[KHindiTestDataIndex]->iTypeFaceName,12); |
|
767 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
768 CleanupStack::PushL(font); |
|
769 |
|
770 TheTest.Next(_L("Repeat Hindi text shaping test\n")); |
|
771 doRepeatShapeText(font, *aTestDataArr[KHindiTestDataIndex], KDevanagariScriptCode, KHindiLanguageCode); |
|
772 repeatShapeText(font, *aTestDataArr[KHindiTestDataIndex], KDevanagariScriptCode, KHindiLanguageCode); |
|
773 |
|
774 TheTest.Next(_L("OOM Hindi text shaping test\n")); |
|
775 #if defined(_DEBUG) |
|
776 doOomShapeText(font, *aTestDataArr[KHindiTestDataIndex], KDevanagariScriptCode, KHindiLanguageCode); |
|
777 oomShapeText(font, *aTestDataArr[KHindiTestDataIndex], KDevanagariScriptCode, KHindiLanguageCode); |
|
778 #else |
|
779 TheTest.Printf(_L("This test is ignored for release version\n")); |
|
780 #endif |
|
781 |
|
782 TheTest.Next(_L("Run simple Hindi shape test\n")); |
|
783 doShapeText(font, *aTestDataArr[KHindiTestDataIndex], KDevanagariScriptCode, KHindiLanguageCode, ETrue); |
|
784 shapeText(font, *aTestDataArr[KHindiTestDataIndex], KDevanagariScriptCode, KHindiLanguageCode, ETrue); |
|
785 |
|
786 CleanupStack::Pop(font); |
|
787 fontStore->ReleaseFont(font); |
|
788 |
|
789 //for any other test data we have, run the simple shape text test only |
|
790 for(i=KHindiTestDataIndex+1; i<KHindiTestDataIndex+KNumberOfHindiTestDataFiles; i++) |
|
791 { |
|
792 TFontSpec fontSpec(aTestDataArr[i]->iTypeFaceName,12); |
|
793 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
794 |
|
795 // First run does not check heap... this ensures that any memory |
|
796 // stashed by the rasterizer does not show up as a leak. |
|
797 doShapeText(font, *aTestDataArr[i], KDevanagariScriptCode, KHindiLanguageCode, ETrue); |
|
798 shapeText(font, *aTestDataArr[i], KDevanagariScriptCode, KHindiLanguageCode, ETrue); |
|
799 |
|
800 fontStore->ReleaseFont(font); |
|
801 } |
|
802 |
|
803 // Now do the last test, the shaping test using various font sizes |
|
804 _LIT16(KHindi1,"\x0915\x094D\x0937\x0924\x094D\x0930\x093F\x092F\x0020\x0909\x0926\x094D\x0926\x0947\x0936\x094D\x0020\x0915\x094D\x0937\x093F\x092A\x094D\x0930"); |
|
805 _LIT16(KHindi2,"\x092d\x0942\x0930\x094d\x092d\x0941\x0935\x0903\x0020\x0938\x094d\x0935\x0903\x0020\x0924\x0924\x094d\x0938\x0935\x093f\x0924\x0941\x0930\x094d\x0935\x0930\x0947\x0923\x094d\x092f\x0902"); |
|
806 _LIT16(KHindi3,"\x092d\x0930\x094d\x0917\x094b\x0020\x0926\x0947\x0935\x0938\x094d\x092f\x0020\x0927\x0940\x092e\x0939\x093f\x0020\x0927\x093f\x092f\x094b\x0020\x092f\x094b\x0928\x0903\x0020\x092a\x094d\x0930\x091a\x094b\x0926\x092f\x093e\x0924\x094d\x0020"); |
|
807 |
|
808 TheTest.Next(_L("Repeat Hindi shaping test using font sizes 20 to 6000\n")); |
|
809 doRepeatShapeUsingVariousFontSizesTest(fontStore, aTestDataArr[0]->iTypeFaceName, KHindi1, KHindi2, KHindi3, KDevanagariScriptCode, KHindiLanguageCode); |
|
810 |
|
811 CleanupStack::PopAndDestroy(fontStore); |
|
812 } |
|
813 |
|
814 /** |
|
815 @file |
|
816 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-3383-0001 |
|
817 @SYMTestCaseDesc Tests the shaper using Kannada Unicode. Test include OOM tests (oomShapeText), repeated |
|
818 calls to the shaper (repeatShapeText), simple shaping tests (shapeText), and repeatedly |
|
819 calling the shaper with incremental font sizes. |
|
820 @SYMTestPriority High |
|
821 @SYMTestActions Performs various tests of the the shaper, calling CShaper::ShapeText in various use cases |
|
822 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
823 @SYMPREQ PREQ19 |
|
824 */ |
|
825 void KannadaTestsL(RPointerArray<CTestData> aTestDataArr) |
|
826 { |
|
827 TheTest.Next(_L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-3383-0001 ")); |
|
828 TInt i; |
|
829 CBitmapFont* font; |
|
830 TInt err=KErrNone; |
|
831 //the font store can use the normal user heap |
|
832 CFontStore* fontStore = CFontStore::NewL(&User::Heap()); |
|
833 fontStore->iKPixelWidthInTwips = 11860; |
|
834 fontStore->iKPixelHeightInTwips = 11860; |
|
835 CleanupStack::PushL(fontStore); |
|
836 |
|
837 //load all ecom implemented rasterizer dlls. installs the rasterizer. |
|
838 LoadOpenFontLibraries(fontStore); |
|
839 |
|
840 //add the required Kannada font file |
|
841 TRAP(err,fontStore->AddFileL(aTestDataArr[KKannadaTestDataIndex]->iFilename)); |
|
842 TEST(err==KErrNone); |
|
843 |
|
844 |
|
845 //run all tests for TNR_Dev_OT test, which is at position 0 in the aTestDataArr |
|
846 TFontSpec fontSpec(aTestDataArr[KKannadaTestDataIndex]->iTypeFaceName,12); |
|
847 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
848 CleanupStack::PushL(font); |
|
849 |
|
850 TheTest.Next(_L("Repeat Kannada text shaping test\n")); |
|
851 doRepeatShapeText(font, *aTestDataArr[KKannadaTestDataIndex], KKannadaScriptCode, KKannadaLanguageCode); |
|
852 repeatShapeText(font, *aTestDataArr[KKannadaTestDataIndex], KKannadaScriptCode, KKannadaLanguageCode); |
|
853 |
|
854 TheTest.Next(_L("OOM Kannada text shaping test\n")); |
|
855 #if defined(_DEBUG) |
|
856 doOomShapeText(font, *aTestDataArr[KKannadaTestDataIndex], KKannadaScriptCode, KKannadaLanguageCode); |
|
857 oomShapeText(font, *aTestDataArr[KKannadaTestDataIndex], KKannadaScriptCode, KKannadaLanguageCode); |
|
858 #else |
|
859 TheTest.Printf(_L("This test is ignored for release version\n")); |
|
860 #endif |
|
861 |
|
862 TheTest.Next(_L("Run simple Kannada shape test\n")); |
|
863 doShapeText(font, *aTestDataArr[KKannadaTestDataIndex], KKannadaScriptCode, KKannadaLanguageCode, ETrue); |
|
864 shapeText(font, *aTestDataArr[KKannadaTestDataIndex], KKannadaScriptCode, KKannadaLanguageCode, ETrue); |
|
865 |
|
866 //for any other test data we have, run the simple shape text test only |
|
867 for(i=KKannadaTestDataIndex+1; i<KKannadaTestDataIndex+KNumberOfKannadaTestDataFiles; i++) |
|
868 { |
|
869 TFontSpec fontSpec(aTestDataArr[i]->iTypeFaceName,12); |
|
870 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
871 |
|
872 // First run does not check heap... this ensures that any memory |
|
873 // stashed by the rasterizer does not show up as a leak. |
|
874 doShapeText(font, *aTestDataArr[i], KKannadaScriptCode, KKannadaLanguageCode, ETrue); |
|
875 shapeText(font, *aTestDataArr[i], KKannadaScriptCode, KKannadaLanguageCode, ETrue); |
|
876 |
|
877 fontStore->ReleaseFont(font); |
|
878 } |
|
879 |
|
880 // Now do the last test, the shaping test using various font sizes |
|
881 _LIT16(KKannada1,"\x0CB6\x0CCD\x0CB0\x0CC0\x0020\x0CAD\x0C97\x0CB5\x0CBE\x0CA8\x0CC1\x0CB5\x0CBE\x0C9A\x0C95\x0CC1\x0CA4\x0CB8\x0CCD\x0CA4\x0CCD\x0CB5\x0CBE\x0020\x0C95\x0CB6\x0CCD\x0CAE\x0CB2\x0CAE\x0CBF\x0CA6\x0C82\x0020\x0CB5\x0CBF\x0CB7\x0CAE\x0020\x0CB8\x0CAE\x0CC1\x0CAA\x0CB8\x0CCD\x0CA5\x0CBF\x0CA4\x0CAE\x0CCD"); |
|
882 _LIT16(KKannada2,"\x0C85\x0CA8\x0CBE\x0CB0\x0CCD\x0CAF\x0C9C\x0CC1\x0CB7\x0CCD\x0CA0\x0CAE\x0CB8\x0CCD\x0CB5\x0CB0\x0CCD\x0C97\x0CCD\x0CAF\x0CAE\x0C95\x0CC0\x0CB0\x0CCD\x0CA4\x0CBF\x0C95\x0CB0\x0CAE\x0CB0\x0CCD\x0C9C\x0CC1\x0CA8"); |
|
883 _LIT16(KKannada3,"\x0C95\x0CCD\x0CB2\x0CC8\x0CAC\x0CCD\x0CAF\x0C82\x0020\x0CAE\x0CBE\x0020\x0CB8\x0CCD\x0CAE\x0020\x0C97\x0CAE\x0C83\x0020\x0CAA\x0CBE\x0CB0\x0CCD\x0CA5\x0020\x0CA8\x0CC8\x0CA4\x0CA4\x0CCD\x0CA4\x0CCD\x0CB5\x0CAF\x0CCD\x0CAF\x0CC1\x0CAA\x0CAA\x0CA7\x0CCD\x0CAF\x0CA4\x0CC7"); |
|
884 |
|
885 TheTest.Next(_L("Repeat Kannada shaping test using font sizes 20 to 6000\n")); |
|
886 doRepeatShapeUsingVariousFontSizesTest(fontStore, aTestDataArr[5]->iTypeFaceName, KKannada1, KKannada2, KKannada3, KKannadaScriptCode, KKannadaLanguageCode); |
|
887 |
|
888 CleanupStack::Pop(font); |
|
889 fontStore->ReleaseFont(font); |
|
890 |
|
891 |
|
892 CleanupStack::PopAndDestroy(fontStore); |
|
893 } |
|
894 |
|
895 /** |
|
896 @file |
|
897 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-3383-0002 |
|
898 @SYMTestCaseDesc Tests the shaper using Kannada Unicode. Test include OOM tests (oomShapeText), repeated |
|
899 calls to the shaper (repeatShapeText), simple shaping tests (shapeText), and repeatedly |
|
900 calling the shaper with incremental font sizes. |
|
901 @SYMTestPriority High |
|
902 @SYMTestActions Performs various tests of the the shaper, calling CShaper::ShapeText in various use cases |
|
903 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
904 @SYMPREQ PREQ19 |
|
905 */ |
|
906 void GujaratiTestsL(RPointerArray<CTestData> aTestDataArr) |
|
907 { |
|
908 TheTest.Next(_L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-3383-0002 ")); |
|
909 TInt i; |
|
910 CBitmapFont* font; |
|
911 TInt err=KErrNone; |
|
912 //the font store can use the normal user heap |
|
913 CFontStore* fontStore = CFontStore::NewL(&User::Heap()); |
|
914 fontStore->iKPixelWidthInTwips = 11860; |
|
915 fontStore->iKPixelHeightInTwips = 11860; |
|
916 CleanupStack::PushL(fontStore); |
|
917 |
|
918 //load all ecom implemented rasterizer dlls. installs the rasterizer. |
|
919 LoadOpenFontLibraries(fontStore); |
|
920 |
|
921 //add the required Gujarati font file |
|
922 TRAP(err,fontStore->AddFileL(aTestDataArr[KGujaratiTestDataIndex]->iFilename)); |
|
923 TEST(err==KErrNone); |
|
924 |
|
925 |
|
926 //run all tests for TNR_Dev_OT test, which is at position 0 in the aTestDataArr |
|
927 TFontSpec fontSpec(aTestDataArr[KGujaratiTestDataIndex]->iTypeFaceName,12); |
|
928 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
929 CleanupStack::PushL(font); |
|
930 |
|
931 TheTest.Next(_L("Repeat Gujarati text shaping test\n")); |
|
932 doRepeatShapeText(font, *aTestDataArr[KGujaratiTestDataIndex], KGujaratiScriptCode, KGujaratiLanguageCode); |
|
933 repeatShapeText(font, *aTestDataArr[KGujaratiTestDataIndex], KGujaratiScriptCode, KGujaratiLanguageCode); |
|
934 |
|
935 TheTest.Next(_L("OOM Gujarati text shaping test\n")); |
|
936 #if defined(_DEBUG) |
|
937 doOomShapeText(font, *aTestDataArr[KGujaratiTestDataIndex], KGujaratiScriptCode, KGujaratiLanguageCode); |
|
938 oomShapeText(font, *aTestDataArr[KGujaratiTestDataIndex], KGujaratiScriptCode, KGujaratiLanguageCode); |
|
939 #else |
|
940 TheTest.Printf(_L("This test is ignored for release version\n")); |
|
941 #endif |
|
942 |
|
943 TheTest.Next(_L("Run simple Gujarati shape test\n")); |
|
944 doShapeText(font, *aTestDataArr[KGujaratiTestDataIndex], KGujaratiScriptCode, KGujaratiLanguageCode, ETrue); |
|
945 shapeText(font, *aTestDataArr[KGujaratiTestDataIndex], KGujaratiScriptCode, KGujaratiLanguageCode, ETrue); |
|
946 |
|
947 //for any other test data we have, run the simple shape text test only |
|
948 for(i=KGujaratiTestDataIndex+1; i<KGujaratiTestDataIndex+KNumberOfGujaratiTestDataFiles; i++) |
|
949 { |
|
950 TFontSpec fontSpec(aTestDataArr[i]->iTypeFaceName,12); |
|
951 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
952 |
|
953 // First run does not check heap... this ensures that any memory |
|
954 // stashed by the rasterizer does not show up as a leak. |
|
955 doShapeText(font, *aTestDataArr[i], KGujaratiScriptCode, KGujaratiLanguageCode, ETrue); |
|
956 shapeText(font, *aTestDataArr[i], KGujaratiScriptCode, KGujaratiLanguageCode, ETrue); |
|
957 |
|
958 fontStore->ReleaseFont(font); |
|
959 } |
|
960 |
|
961 // Now do the last test, the shaping test using various font sizes |
|
962 _LIT16(KGujarati1,"\x0AAD\x0ABE\x0AB5\x0ABE\x0AA4\x0ACD\x0AAE\x0A95\x0020\x0AAA\x0AA6\x0ACD\x0AAF\x0ABE\x0AA8\x0AC1\x0AB5\x0ABE\x0AA6\x0020\x0020\x002D\x0020\x0AB6\x0ACD\x0AB0\x0AC0\x0020\x0AAF\x0ACB\x0A97\x0AC7\x0AB6\x0ACD\x0AB5\x0AB0\x0A9C\x0AC0"); |
|
963 _LIT16(KGujarati2,"\x0AB5\x0ABF\x0AA8\x0ACD\x0AA1\x0ACB\x0A9D\x0020\x0AB5\x0ABF\x0AB8\x0ACD\x0A9F\x0ABE\x0020\x002D\x0020\x0A86\x0A82\x0AA4\x0AB0\x0AB0\x0ABE\x0AB7\x0ACD\x0A9F\x0ACD\x0AB0\x0ABF\x0AAF\x0A95\x0AB0\x0AA3\x0020\x0AB5\x0ABF\x0AB6\x0AC7\x0AA8\x0AC0\x0020\x0A9C\x0ABE\x0AA3\x0A95\x0ABE\x0AB0\x0AC0"); |
|
964 _LIT16(KGujarati3,"\x0AAE\x0ABE\x0A88\x0A95\x0ACD\x0AB0\x0ACB\x0AB8\x0ACB\x0AAB\x0ACD\x0A9F\x0AA8\x0ABE\x0020\x0A86\x0020\x0A86\x0A82\x0AA4\x0AB0\x0AB0\x0ABE\x0AB7\x0ACD\x0A9F\x0ACD\x0AB0\x0ABF\x0AAF\x0020\x0AAA\x0ACB\x0AB0\x0ACD\x0A9F\x0AB2\x0020\x0AB5\x0ABF\x0AB6\x0AC7\x0020\x0AB5\x0AA7\x0AC1\x0020\x0A9C\x0ABE\x0AA3\x0ACB\x002E\x0020\x0AB5\x0ABF\x0AB8\x0ACD\x0A9F\x0ABE\x0A8F\x0020\x0AA6\x0AC1\x0AA8\x0ABF\x0AAF\x0ABE\x0AAD\x0AB0\x0AA8\x0AC0\x0020\x0AAD\x0ABE\x0AB7\x0ABE\x0A93\x0020\x0AAE\x0ABE\x0A9F\x0AC7\x0020\x0AA6\x0ACD\x0AB5\x0ABE\x0AB0\x0020\x0A96\x0ACB\x0AB2\x0AC0\x0020\x0AA8\x0ABE\x0A96\x0ACD\x0AAF\x0ABE\x0020\x0A9B\x0AC7"); |
|
965 |
|
966 TheTest.Next(_L("Repeat Gujarati shaping test using font sizes 20 to 6000\n")); |
|
967 doRepeatShapeUsingVariousFontSizesTest(fontStore, aTestDataArr[8]->iTypeFaceName, KGujarati1, KGujarati2, KGujarati3, KGujaratiScriptCode, KGujaratiLanguageCode); |
|
968 |
|
969 CleanupStack::Pop(font); |
|
970 fontStore->ReleaseFont(font); |
|
971 |
|
972 |
|
973 CleanupStack::PopAndDestroy(fontStore); |
|
974 } |
|
975 |
|
976 /** |
|
977 @SYMTestCaseID GRAPHICS-TI18N-ICULAYOUTENGINE-CT-4007 |
|
978 @SYMTestCaseDesc Case to do Gurmukhi component test |
|
979 It covers all Iculayout components cases |
|
980 @SYMTestPriority High |
|
981 @SYMTestActions Iterate Gurmukhi test data, each test data corresponds with a case |
|
982 @SYMTestExpectedResults No error returned |
|
983 @SYMPREQ 1922: Gurmukhi support |
|
984 */ |
|
985 void GurmukhiTestsL(RPointerArray<CTestData> aTestDataArr) |
|
986 { |
|
987 |
|
988 TInt i; |
|
989 CBitmapFont* font; |
|
990 TInt err=KErrNone; |
|
991 //the font store can use the normal user heap |
|
992 CFontStore* fontStore = CFontStore::NewL(&User::Heap()); |
|
993 fontStore->iKPixelWidthInTwips = 11860; |
|
994 fontStore->iKPixelHeightInTwips = 11860; |
|
995 CleanupStack::PushL(fontStore); |
|
996 |
|
997 //load all ecom implemented rasterizer dlls. installs the rasterizer. |
|
998 LoadOpenFontLibraries(fontStore); |
|
999 |
|
1000 //add the required Gurmukhi font file |
|
1001 TRAP(err,fontStore->AddFileL(aTestDataArr[KGurmukhiTestDataIndex]->iFilename)); |
|
1002 TEST(err==KErrNone); |
|
1003 |
|
1004 |
|
1005 TFontSpec fontSpec(aTestDataArr[KGurmukhiTestDataIndex]->iTypeFaceName,12); |
|
1006 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
1007 CleanupStack::PushL(font); |
|
1008 |
|
1009 TheTest.Next(_L("@SYMTestCaseID GRAPHICS-TI18N-ICULAYOUTENGINE-CT-4007 Repeat Gurmukhi text shaping test\n")); |
|
1010 doRepeatShapeText(font, *aTestDataArr[KGurmukhiTestDataIndex], KGurmukhiScriptCode, KGurmukhiLanguageCode); |
|
1011 repeatShapeText(font, *aTestDataArr[KGurmukhiTestDataIndex], KGurmukhiScriptCode, KGurmukhiLanguageCode); |
|
1012 |
|
1013 TheTest.Next(_L("OOM Gurmukhi text shaping test\n")); |
|
1014 #if defined(_DEBUG) |
|
1015 doOomShapeText(font, *aTestDataArr[KGurmukhiTestDataIndex], KGurmukhiScriptCode, KGurmukhiLanguageCode); |
|
1016 oomShapeText(font, *aTestDataArr[KGurmukhiTestDataIndex], KGurmukhiScriptCode, KGurmukhiLanguageCode); |
|
1017 #else |
|
1018 TheTest.Printf(_L("This test is ignored for release version\n")); |
|
1019 #endif |
|
1020 |
|
1021 TheTest.Next(_L("Run simple Gurmukhi shape test\n")); |
|
1022 doShapeText(font, *aTestDataArr[KGurmukhiTestDataIndex], KGurmukhiScriptCode, KGurmukhiLanguageCode, ETrue); |
|
1023 shapeText(font, *aTestDataArr[KGurmukhiTestDataIndex], KGurmukhiScriptCode, KGurmukhiLanguageCode, ETrue); |
|
1024 |
|
1025 //for any other test data we have, run the simple shape text test only |
|
1026 for(i=KGurmukhiTestDataIndex+1; i<KGurmukhiTestDataIndex+KNumberOfGurmukhiTestDataFiles; i++) |
|
1027 { |
|
1028 TFontSpec fontSpec(aTestDataArr[i]->iTypeFaceName,12); |
|
1029 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
1030 |
|
1031 // First run does not check heap... this ensures that any memory |
|
1032 // stashed by the rasterizer does not show up as a leak. |
|
1033 doShapeText(font, *aTestDataArr[i], KGurmukhiScriptCode, KGurmukhiLanguageCode, ETrue); |
|
1034 shapeText(font, *aTestDataArr[i], KGurmukhiScriptCode, KGurmukhiLanguageCode, ETrue); |
|
1035 |
|
1036 fontStore->ReleaseFont(font); |
|
1037 } |
|
1038 |
|
1039 // Now do the last test, the shaping test using various font sizes |
|
1040 _LIT16(KGurmukhi1,"\x0a28\x0a2e\x0a38\x0a15\x0a3e\x0a30\x0a26\x0a\x3e\x0a28\x0a3f\x0a1a\x0a3f\x0a70\x0a26\x0a41\x0020\x0a28\x0a3f\x0a17\x0a4d\x0a30\x0a39\x0a3f\x0a2a\x0a70\x0a16\x0a40\x0a05\x0a32\x0a4b\x0a2a\x0a70\x0a16\x0a40\x0a05\x0a32\x0a4b\x0a2a\x0a30\x0a09\x0a2a\x0a15\x0a3e\x0a30\x0a3f\x0a06\x0a2a\x0a4d\x0a30\x0a24\x0a3e\x0a2a\x0a3f"); |
|
1041 _LIT16(KGurmukhi2,"\x0a2a\x0a4d\x0a30\x0a24\x0a3f\x0a2a\x0a3e\x0a32\x0a47\x0020\x0a2a\x0a4d\x0a30\x0a2c\x0a32\x0a1a\x0a70\x0a21\x0a2b\x0a3f\x0a30\x0a70\x0a28\x0a4d\x0a39\x0a4d\x0a39\x0a3f\x0020\x0a2b\x0a41\x0a32\x0a35\x0a24\x0a2c\x0a4d\x0a30\x0a3f\x0a25\x0a3e\x0a2c\x0a4d\x0a30\x0a39\x0a2e\x0a3e\x0a26\x0a3f\x0020\x0a2c\x0a3e\x0a1b\x0a30\x0a2c\x0a3f\x0a38\x0a4d\x0a35\x0a70\x0a2d\x0a30\x0a2d\x0a4d\x0a30\x0a2e\x0a39\x0a41\x0a2d\x0a2f\x0a4b\x0a2d\x0a17\x0a35\x0a70\x0a24"); |
|
1042 _LIT16(KGurmukhi3,"\x0a2e\x0a3e\x0a23\x0a40\x0a06\x0a2e\x0a4b\x0a24\x0a38\x0a30\x0a40\x0a06\x0a2f\x0a3e\x0a28\x0a5c\x0a40\x0a0f\x0a2f\x0a15\x0a40\x0a28\x0a3e\x0a30\x0a35\x0a3f\x0a70\x0a26\x0a41\x0020\x0a30\x0a2a\x0a38\x0a40\x0a32\x0a17\x0a3e\x0a35\x0a23\x0a3f\x0a06\x0a32\x0a4b\x0a5c\x0a40\x0a05\x0a39\x0a3f\x0a35\x0a30\x0a28\x0a41\x0a35\x0a40\x0a06\x0a39\x0a3f\x0a06\x0a5c\x0a5c\x0a15\x0a3f\x0a28\x0a2e\x0a38\x0a15\x0a3e\x0a30\x0a26\x0a3e\x0a28\x0a3f\x0a1a\x0a3f\x0a70\x0a26\x0a41\x0020"); |
|
1043 |
|
1044 TheTest.Next(_L("Repeat Gurmukhi shaping test using font sizes 20 to 6000\n")); |
|
1045 doRepeatShapeUsingVariousFontSizesTest(fontStore, aTestDataArr[KGurmukhiTestDataIndex]->iTypeFaceName, KGurmukhi1, KGurmukhi2, KGurmukhi3, KGurmukhiScriptCode, KGurmukhiLanguageCode); |
|
1046 |
|
1047 CleanupStack::Pop(font); |
|
1048 fontStore->ReleaseFont(font); |
|
1049 |
|
1050 |
|
1051 CleanupStack::PopAndDestroy(fontStore); |
|
1052 } |
|
1053 |
|
1054 |
|
1055 /** |
|
1056 @SYMTestCaseID GRAPHICS-TI18N-ICULAYOUTENGINE-CT-4008 |
|
1057 @SYMTestCaseDesc Case to do Malayalam component test |
|
1058 It covers all Iculayout components cases |
|
1059 @SYMTestPriority High |
|
1060 @SYMTestActions Iterate Malayalam test data, each test data corresponds with a case |
|
1061 @SYMTestExpectedResults No error returned |
|
1062 @SYMPREQ 1922: Malayalam support |
|
1063 */ |
|
1064 void MalayalamTestsL(RPointerArray<CTestData> aTestDataArr) |
|
1065 { |
|
1066 |
|
1067 TInt i; |
|
1068 CBitmapFont* font; |
|
1069 TInt err=KErrNone; |
|
1070 //the font store can use the normal user heap |
|
1071 CFontStore* fontStore = CFontStore::NewL(&User::Heap()); |
|
1072 fontStore->iKPixelWidthInTwips = 11860; |
|
1073 fontStore->iKPixelHeightInTwips = 11860; |
|
1074 CleanupStack::PushL(fontStore); |
|
1075 |
|
1076 //load all ecom implemented rasterizer dlls. installs the rasterizer. |
|
1077 LoadOpenFontLibraries(fontStore); |
|
1078 |
|
1079 //add the required Malayalam font file |
|
1080 TRAP(err,fontStore->AddFileL(aTestDataArr[KMalayalamTestDataIndex]->iFilename)); |
|
1081 TEST(err==KErrNone); |
|
1082 |
|
1083 |
|
1084 TFontSpec fontSpec(aTestDataArr[KMalayalamTestDataIndex]->iTypeFaceName,12); |
|
1085 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
1086 CleanupStack::PushL(font); |
|
1087 |
|
1088 TheTest.Next(_L("@SYMTestCaseID GRAPHICS-TI18N-ICULAYOUTENGINE-CT-4008 Repeat Malayalam text shaping test\n")); |
|
1089 doRepeatShapeText(font, *aTestDataArr[KMalayalamTestDataIndex], KMalayalamScriptCode, KMalayalamLanguageCode); |
|
1090 repeatShapeText(font, *aTestDataArr[KMalayalamTestDataIndex], KMalayalamScriptCode, KMalayalamLanguageCode); |
|
1091 |
|
1092 TheTest.Next(_L("OOM Malayalam text shaping test\n")); |
|
1093 #if defined(_DEBUG) |
|
1094 doOomShapeText(font, *aTestDataArr[KMalayalamTestDataIndex], KMalayalamScriptCode, KMalayalamLanguageCode); |
|
1095 oomShapeText(font, *aTestDataArr[KMalayalamTestDataIndex], KMalayalamScriptCode, KMalayalamLanguageCode); |
|
1096 #else |
|
1097 TheTest.Printf(_L("This test is ignored for release version\n")); |
|
1098 #endif |
|
1099 |
|
1100 TheTest.Next(_L("Run simple Malayalam shape test\n")); |
|
1101 doShapeText(font, *aTestDataArr[KMalayalamTestDataIndex], KMalayalamScriptCode, KMalayalamLanguageCode, ETrue); |
|
1102 shapeText(font, *aTestDataArr[KMalayalamTestDataIndex], KMalayalamScriptCode, KMalayalamLanguageCode, ETrue); |
|
1103 |
|
1104 //for any other test data we have, run the simple shape text test only |
|
1105 for(i=KMalayalamTestDataIndex+1; i<KMalayalamTestDataIndex+KNumberOfMalayalamTestDataFiles; i++) |
|
1106 { |
|
1107 TFontSpec fontSpec(aTestDataArr[i]->iTypeFaceName,12); |
|
1108 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
1109 |
|
1110 // First run does not check heap... this ensures that any memory |
|
1111 // stashed by the rasterizer does not show up as a leak. |
|
1112 doShapeText(font, *aTestDataArr[i], KMalayalamScriptCode, KMalayalamLanguageCode, ETrue); |
|
1113 shapeText(font, *aTestDataArr[i], KMalayalamScriptCode, KMalayalamLanguageCode, ETrue); |
|
1114 |
|
1115 fontStore->ReleaseFont(font); |
|
1116 } |
|
1117 |
|
1118 // Now do the last test, the shaping test using various font sizes |
|
1119 _LIT16(KMalayalam1,"\xd09\xd28\xd4d\xd28\xd2f\xd3f\xd1a\xd4d\xd1a\xd4d\x200c\xd26\xd47\xd36\xd40\xd2f\xd07\xd1f\xd24\xd41\xd2a\xd15\xd4d\xd37\xd1f\xd4d\xd30\xd47\xd21\xd4d\x200c\xd2f\xd42\xd23\xd3f\xd2f\xd28\xd4d\x200d\xd05\xd2d\xd3f\xd28\xd28\xd4d"); |
|
1120 _LIT16(KMalayalam2,"\xd2a\xd23\xd3f\xd2e\xd41\xd1f\xd15\xd4d\xd15\xd4d\x200c\xd2a\xd42\xd30\xd4d\x200d"); |
|
1121 _LIT16(KMalayalam3,"\xd23\xd02\xd24\xd40\xd35\xd23\xd4d\xd1f\xd3f\xd15\xd33\xd4d\x200d\xd31\xd26\xd4d\xd26\xd3e\xd15\xd4d\xd15\xd3f\xd15\xd4b\xd34\xd3f\xd15\xd4d\xd15\xd4b\xd1f\xd4d\x200c\xd35\xd3f\xd35\xd3f\xd27\xd06\xd35\xd36\xd4d\xd2f\xd19\xd4d\xd19\xd33\xd4d\x200d"); |
|
1122 |
|
1123 TheTest.Next(_L("Repeat Malayalam shaping test using font sizes 20 to 6000\n")); |
|
1124 doRepeatShapeUsingVariousFontSizesTest(fontStore, aTestDataArr[KMalayalamTestDataIndex]->iTypeFaceName, KMalayalam1, KMalayalam2, KMalayalam3, KMalayalamScriptCode, KMalayalamLanguageCode); |
|
1125 |
|
1126 CleanupStack::Pop(font); |
|
1127 fontStore->ReleaseFont(font); |
|
1128 |
|
1129 |
|
1130 CleanupStack::PopAndDestroy(fontStore); |
|
1131 } |
|
1132 |
|
1133 /** |
|
1134 @file |
|
1135 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-4001 |
|
1136 @SYMTestCaseDesc Tests the shaper using Bengali Unicode. Test include OOM tests (oomShapeText), repeated |
|
1137 calls to the shaper (repeatShapeText), simple shaping tests (shapeText), and repeatedly |
|
1138 calling the shaper with incremental font sizes. |
|
1139 @SYMTestPriority High |
|
1140 @SYMTestActions Performs various tests of the the shaper, calling CShaper::ShapeText in various use cases |
|
1141 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
1142 @SYMPREQ PREQ1766 |
|
1143 @SYMREQ REQ8741 |
|
1144 */ |
|
1145 void BengaliTestsL(RPointerArray<CTestData> aTestDataArr) |
|
1146 { |
|
1147 TheTest.Next(_L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-4001 ")); |
|
1148 TInt i; |
|
1149 CBitmapFont* font; |
|
1150 TInt err=KErrNone; |
|
1151 //the font store can use the normal user heap |
|
1152 CFontStore* fontStore = CFontStore::NewL(&User::Heap()); |
|
1153 fontStore->iKPixelWidthInTwips = 11860; |
|
1154 fontStore->iKPixelHeightInTwips = 11860; |
|
1155 CleanupStack::PushL(fontStore); |
|
1156 |
|
1157 //load all ecom implemented rasterizer dlls. installs the rasterizer. |
|
1158 LoadOpenFontLibraries(fontStore); |
|
1159 |
|
1160 //add the required Bengali font file |
|
1161 TRAP(err,fontStore->AddFileL(aTestDataArr[KBengaliTestDataIndex]->iFilename)); |
|
1162 TEST(err==KErrNone); |
|
1163 |
|
1164 |
|
1165 //run all tests for TNR_Dev_OT test, which is at position 0 in the aTestDataArr |
|
1166 TFontSpec fontSpec(aTestDataArr[KBengaliTestDataIndex]->iTypeFaceName,12); |
|
1167 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
1168 CleanupStack::PushL(font); |
|
1169 |
|
1170 TheTest.Next(_L("Repeat Bengali text shaping test\n")); |
|
1171 doRepeatShapeText(font, *aTestDataArr[KBengaliTestDataIndex], KBengaliScriptCode, KBengaliLanguageCode); |
|
1172 repeatShapeText(font, *aTestDataArr[KBengaliTestDataIndex], KBengaliScriptCode, KBengaliLanguageCode); |
|
1173 |
|
1174 TheTest.Next(_L("OOM Bengali text shaping test\n")); |
|
1175 #if defined(_DEBUG) |
|
1176 doOomShapeText(font, *aTestDataArr[KBengaliTestDataIndex], KBengaliScriptCode, KBengaliLanguageCode); |
|
1177 oomShapeText(font, *aTestDataArr[KBengaliTestDataIndex], KBengaliScriptCode, KBengaliLanguageCode); |
|
1178 #else |
|
1179 TheTest.Printf(_L("This test is ignored for release version\n")); |
|
1180 #endif |
|
1181 |
|
1182 TheTest.Next(_L("Run simple Bengali shape test\n")); |
|
1183 doShapeText(font, *aTestDataArr[KBengaliTestDataIndex], KBengaliScriptCode, KBengaliLanguageCode, ETrue); |
|
1184 shapeText(font, *aTestDataArr[KBengaliTestDataIndex], KBengaliScriptCode, KBengaliLanguageCode, ETrue); |
|
1185 |
|
1186 //for any other test data we have, run the simple shape text test only |
|
1187 for(i=KBengaliTestDataIndex+1; i<KBengaliTestDataIndex+KNumberOfBengaliTestDataFiles; i++) |
|
1188 { |
|
1189 TFontSpec fontSpec(aTestDataArr[i]->iTypeFaceName,12); |
|
1190 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
1191 |
|
1192 // First run does not check heap... this ensures that any memory |
|
1193 // stashed by the rasterizer does not show up as a leak. |
|
1194 doShapeText(font, *aTestDataArr[i], KBengaliScriptCode, KBengaliLanguageCode, ETrue); |
|
1195 shapeText(font, *aTestDataArr[i], KBengaliScriptCode, KBengaliLanguageCode, ETrue); |
|
1196 |
|
1197 fontStore->ReleaseFont(font); |
|
1198 } |
|
1199 |
|
1200 // Now do the last test, the shaping test using various font sizes |
|
1201 _LIT16(KBengali1,"\x099C\x09A8\x0997\x09A3\x09AE\x09A8\x0020\x0985\x09A7\x09BF\x09A8\x09BE\x09AF\x09BC\x0995\x0020\x099C\x09AF\x09BC\x0020\x09B9\x09C7\x0020\x09AD\x09BE\x09B0\x09A4\x0020\x09AD\x09BE\x0997\x09CD\x09AF\x0020\x09AC\x09BF\x09A7\x09BE\x09A4\x09BE\x0020\x09AA\x099E\x09CD\x099C\x09BE\x09AC\x0020\x09B8\x09BF\x09A8\x09CD\x09A7\x09C1\x0020"); |
|
1202 _LIT16(KBengali2,"\x0997\x09C1\x099C\x09B0\x09BE\x099F\x0020\x09AE\x09B0\x09BE\x09A0\x09BE\x0020\x09A6\x09CD\x09B0\x09BE\x09AC\x09BF\x09A1\x09BC\x0020\x0989\x09A4\x09CD\x0995\x09B2\x0020\x09AC\x0999\x09CD\x0997\x0020\x09AC\x09BF\x09A8\x09CD\x09A7\x09CD\x09AF\x0020\x09B9\x09BF\x09AE\x09BE\x099A\x09B2\x0020\x09AF\x09AE\x09C1\x09A8\x09BE\x0020\x0997\x0999\x09CD\x0997\x09BE\x0020"); |
|
1203 _LIT16(KBengali3,"\x0989\x099A\x09CD\x099B\x09B2\x0020\x099C\x09B2\x09A7\x09BF\x0020\x09A4\x09B0\x0999\x09CD\x0997\x0020\x09A4\x09AC\x0020\x09B6\x09C1\x09AD\x0020\x09A8\x09BE\x09AE\x09C7\x0020\x099C\x09BE\x0997\x09C7\x0020\x09A4\x09AC\x0020\x09B6\x09C1\x09AD\x0020\x0986\x09B6\x09BF\x09B8\x0020\x09AE\x09BE\x0997\x09C7\x0020\x0997\x09BE\x09B9\x09C7\x0020\x09A4\x09AC\x0020\x099C\x09AF\x09BC\x0020"); |
|
1204 |
|
1205 TheTest.Next(_L("Repeat Bengali shaping test using font sizes 20 to 6000\n")); |
|
1206 doRepeatShapeUsingVariousFontSizesTest(fontStore, aTestDataArr[KBengaliTestDataIndex]->iTypeFaceName, KBengali1, KBengali2, KBengali3, KBengaliScriptCode, KBengaliLanguageCode); |
|
1207 |
|
1208 CleanupStack::Pop(font); |
|
1209 fontStore->ReleaseFont(font); |
|
1210 |
|
1211 |
|
1212 CleanupStack::PopAndDestroy(fontStore); |
|
1213 } |
|
1214 |
|
1215 /** |
|
1216 @file |
|
1217 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-4002 |
|
1218 @SYMTestCaseDesc Tests the shaper using Tamil Unicode. Test include OOM tests (oomShapeText), repeated |
|
1219 calls to the shaper (repeatShapeText), simple shaping tests (shapeText), and repeatedly |
|
1220 calling the shaper with incremental font sizes. |
|
1221 @SYMTestPriority High |
|
1222 @SYMTestActions Performs various tests of the the shaper, calling CShaper::ShapeText in various use cases |
|
1223 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
1224 @SYMPREQ PREQ1766 |
|
1225 @SYMREQ REQ8742 |
|
1226 */ |
|
1227 void TamilTestsL(RPointerArray<CTestData> aTestDataArr) |
|
1228 { |
|
1229 TheTest.Next(_L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-4002 ")); |
|
1230 TInt i; |
|
1231 CBitmapFont* font; |
|
1232 TInt err=KErrNone; |
|
1233 //the font store can use the normal user heap |
|
1234 CFontStore* fontStore = CFontStore::NewL(&User::Heap()); |
|
1235 fontStore->iKPixelWidthInTwips = 11860; |
|
1236 fontStore->iKPixelHeightInTwips = 11860; |
|
1237 CleanupStack::PushL(fontStore); |
|
1238 |
|
1239 //load all ecom implemented rasterizer dlls. installs the rasterizer. |
|
1240 LoadOpenFontLibraries(fontStore); |
|
1241 |
|
1242 //add the required Tamil font file |
|
1243 TRAP(err,fontStore->AddFileL(aTestDataArr[KTamilTestDataIndex]->iFilename)); |
|
1244 TEST(err==KErrNone); |
|
1245 |
|
1246 |
|
1247 //run all tests for TNR_Dev_OT test, which is at position 0 in the aTestDataArr |
|
1248 TFontSpec fontSpec(aTestDataArr[KTamilTestDataIndex]->iTypeFaceName,12); |
|
1249 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
1250 CleanupStack::PushL(font); |
|
1251 |
|
1252 TheTest.Next(_L("Repeat Tamil text shaping test\n")); |
|
1253 doRepeatShapeText(font, *aTestDataArr[KTamilTestDataIndex], KTamilScriptCode, KTamilLanguageCode); |
|
1254 repeatShapeText(font, *aTestDataArr[KTamilTestDataIndex], KTamilScriptCode, KTamilLanguageCode); |
|
1255 |
|
1256 TheTest.Next(_L("OOM Tamil text shaping test\n")); |
|
1257 #if defined(_DEBUG) |
|
1258 doOomShapeText(font, *aTestDataArr[KTamilTestDataIndex], KTamilScriptCode, KTamilLanguageCode); |
|
1259 oomShapeText(font, *aTestDataArr[KTamilTestDataIndex], KTamilScriptCode, KTamilLanguageCode); |
|
1260 #else |
|
1261 TheTest.Printf(_L("This test is ignored for release version\n")); |
|
1262 #endif |
|
1263 |
|
1264 TheTest.Next(_L("Run simple Tamil shape test\n")); |
|
1265 doShapeText(font, *aTestDataArr[KTamilTestDataIndex], KTamilScriptCode, KTamilLanguageCode, ETrue); |
|
1266 shapeText(font, *aTestDataArr[KTamilTestDataIndex], KTamilScriptCode, KTamilLanguageCode, ETrue); |
|
1267 |
|
1268 //for any other test data we have, run the simple shape text test only |
|
1269 for(i=KTamilTestDataIndex+1; i<KTamilTestDataIndex+KNumberOfTamilTestDataFiles; i++) |
|
1270 { |
|
1271 TFontSpec fontSpec(aTestDataArr[i]->iTypeFaceName,12); |
|
1272 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
1273 |
|
1274 // First run does not check heap... this ensures that any memory |
|
1275 // stashed by the rasterizer does not show up as a leak. |
|
1276 doShapeText(font, *aTestDataArr[i], KTamilScriptCode, KTamilLanguageCode, ETrue); |
|
1277 shapeText(font, *aTestDataArr[i], KTamilScriptCode, KTamilLanguageCode, ETrue); |
|
1278 |
|
1279 fontStore->ReleaseFont(font); |
|
1280 } |
|
1281 |
|
1282 // Now do the last test, the shaping test using various font sizes |
|
1283 _LIT16(KTamil1,"\x0B89\x0BA3\x0BCD\x0BA3\x0020\x0BAE\x0BC1\x0B9F\x0BBF\x0BAF\x0BBE\x0BA4\x0020\x0BB5\x0BCB\x0BA4\x0BA8\x0BC0\x0BB0\x0BCD\x0020\x0BB5\x0BBE\x0BA9\x0BCD\x0BB5\x0BBE\x0BAF\x0BCD\x0BAA\x0BCD\x0BAA\x0B9F\x0BCD\x0020"); |
|
1284 _LIT16(KTamil2,"\x0B86\x0BA9\x0BCD\x0BB1\x0BB5\x0BC1\x0BAF\x0BBF\x0BB0\x0BCD\x0020\x0B88\x0BB0\x0BBE\x0BB1\x0BC1\x0BAE\x0BCD\x0020\x0B90\x0B99\x0BCD\x0B95\x0BC1\x0BB1\x0BBF\x0BB2\x0BCD\x0020\x0B8F\x0BB4\x0BCD\x0BA8\x0BC6\x0B9F\x0BBF\x0BB2\x0BBE\x0BAE\x0BCD\x0020"); |
|
1285 _LIT16(KTamil3,"\x0BAE\x0BC1\x0BAE\x0BCD\x0BAE\x0BC8\x0BAF\x0BBF\x0B9F\x0BA4\x0BCD\x0020\x0BA4\x0BC8\x0BAF\x0BCC\x0BB5\x0BC1\x0B99\x0BCD\x0020\x0B95\x0BC1\x0BA9\x0BCD\x0BB1\x0BC1\x0BAE\x0BC1\x0BA9\x0BCD\x0020\x0BA9\x0BCA\x0BB1\x0BCD\x0BB1\x0BC1\x0BA3\x0BCD\x0B9F\x0BC7\x0BB1\x0BCD"); |
|
1286 |
|
1287 TheTest.Next(_L("Repeat Tamil shaping test using font sizes 20 to 6000\n")); |
|
1288 doRepeatShapeUsingVariousFontSizesTest(fontStore, aTestDataArr[KTamilTestDataIndex]->iTypeFaceName, KTamil1, KTamil2, KTamil3, KTamilScriptCode, KTamilLanguageCode); |
|
1289 |
|
1290 CleanupStack::Pop(font); |
|
1291 fontStore->ReleaseFont(font); |
|
1292 |
|
1293 |
|
1294 CleanupStack::PopAndDestroy(fontStore); |
|
1295 } |
|
1296 |
|
1297 /** |
|
1298 @file |
|
1299 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-4003 |
|
1300 @SYMTestCaseDesc Tests the shaper using Telugu Unicode. Test include OOM tests (oomShapeText), repeated |
|
1301 calls to the shaper (repeatShapeText), simple shaping tests (shapeText), and repeatedly |
|
1302 calling the shaper with incremental font sizes. |
|
1303 @SYMTestPriority High |
|
1304 @SYMTestActions Performs various tests of the the shaper, calling CShaper::ShapeText in various use cases |
|
1305 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
1306 @SYMPREQ PREQ1766 |
|
1307 @SYMREQ REQ8743 |
|
1308 */ |
|
1309 void TeluguTestsL(RPointerArray<CTestData> aTestDataArr) |
|
1310 { |
|
1311 TheTest.Next(_L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-4003 ")); |
|
1312 TInt i; |
|
1313 CBitmapFont* font; |
|
1314 TInt err=KErrNone; |
|
1315 //the font store can use the normal user heap |
|
1316 CFontStore* fontStore = CFontStore::NewL(&User::Heap()); |
|
1317 fontStore->iKPixelWidthInTwips = 11860; |
|
1318 fontStore->iKPixelHeightInTwips = 11860; |
|
1319 CleanupStack::PushL(fontStore); |
|
1320 |
|
1321 //load all ecom implemented rasterizer dlls. installs the rasterizer. |
|
1322 LoadOpenFontLibraries(fontStore); |
|
1323 |
|
1324 //add the required Telugu font file |
|
1325 TRAP(err,fontStore->AddFileL(aTestDataArr[KTeluguTestDataIndex]->iFilename)); |
|
1326 TEST(err==KErrNone); |
|
1327 |
|
1328 |
|
1329 //run all tests for TNR_Dev_OT test, which is at position 0 in the aTestDataArr |
|
1330 TFontSpec fontSpec(aTestDataArr[KTeluguTestDataIndex]->iTypeFaceName,12); |
|
1331 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
1332 CleanupStack::PushL(font); |
|
1333 |
|
1334 TheTest.Next(_L("Repeat Telugu text shaping test\n")); |
|
1335 doRepeatShapeText(font, *aTestDataArr[KTeluguTestDataIndex], KTeluguScriptCode, KTeluguLanguageCode); |
|
1336 repeatShapeText(font, *aTestDataArr[KTeluguTestDataIndex], KTeluguScriptCode, KTeluguLanguageCode); |
|
1337 |
|
1338 TheTest.Next(_L("OOM Telugu text shaping test\n")); |
|
1339 #if defined(_DEBUG) |
|
1340 doOomShapeText(font, *aTestDataArr[KTeluguTestDataIndex], KTeluguScriptCode, KTeluguLanguageCode); |
|
1341 oomShapeText(font, *aTestDataArr[KTeluguTestDataIndex], KTeluguScriptCode, KTeluguLanguageCode); |
|
1342 #else |
|
1343 TheTest.Printf(_L("This test is ignored for release version\n")); |
|
1344 #endif |
|
1345 |
|
1346 TheTest.Next(_L("Run simple Telugu shape test\n")); |
|
1347 doShapeText(font, *aTestDataArr[KTeluguTestDataIndex], KTeluguScriptCode, KTeluguLanguageCode, ETrue); |
|
1348 shapeText(font, *aTestDataArr[KTeluguTestDataIndex], KTeluguScriptCode, KTeluguLanguageCode, ETrue); |
|
1349 |
|
1350 //for any other test data we have, run the simple shape text test only |
|
1351 for(i=KTeluguTestDataIndex+1; i<KTeluguTestDataIndex+KNumberOfTeluguTestDataFiles; i++) |
|
1352 { |
|
1353 TFontSpec fontSpec(aTestDataArr[i]->iTypeFaceName,12); |
|
1354 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
1355 |
|
1356 // First run does not check heap... this ensures that any memory |
|
1357 // stashed by the rasterizer does not show up as a leak. |
|
1358 doShapeText(font, *aTestDataArr[i], KTeluguScriptCode, KTeluguLanguageCode, ETrue); |
|
1359 shapeText(font, *aTestDataArr[i], KTeluguScriptCode, KTeluguLanguageCode, ETrue); |
|
1360 |
|
1361 fontStore->ReleaseFont(font); |
|
1362 } |
|
1363 |
|
1364 // Now do the last test, the shaping test using various font sizes |
|
1365 _LIT16(KTelugu1,"\x0C05\x0C2A\x0C4D\x0C30\x0C15\x0C3E\x0C36\x0C4B\x093D\x0C2A\x0C4D\x0C30\x0C35\x0C43\x0C24\x0C4D\x0C24\x0C3F\x0C36\x0C4D\x0C1A\x0020\x0C2A\x0C4D\x0C30\x0C2E\x0C3E\x0C26\x0C4B\x0020\x0C0A\x0C30\x0C4D\x0C27\x0C4D\x0C35\x0C02"); |
|
1366 _LIT16(KTelugu2,"\x0C15\x0C48\x0C30\x0C4D\x0C32\x0C3F\x0C19\x0C4D\x0C17\x0C48\x0C38\x0C4D\x0C24\x0C4D\x0C30\x0C40\x0C28\x0C4D\x0C17\x0C41\x0C23\x0C3E\x0C28\x0C47\x0C24\x0C3E\x0C28\x0C24\x0C40\x0C24\x0C4B\x0020\x0C17\x0C41\x0C23\x0C48\x0C30\x0C4D\x0C2F"); |
|
1367 _LIT16(KTelugu3,"\x0020\x0C2C\x0C4D\x0C30\x0C39\x0C4D\x0C2E\x0C23\x0C4B\x0020\x0C39\x0C3F\x0020\x0C2A\x0C4D\x0C30\x0C24\x0C3F\x0C37\x0C4D\x0C20\x0C3E\x0C39\x0C2E\x0C2E\x0C43\x0C24\x0C38\x0C4D\x0C2F\x0C3E\x0C35\x0C4D\x0C2F\x0C2F\x0C38\x0C4D\x0C2F"); |
|
1368 |
|
1369 TheTest.Next(_L("Repeat Telugu shaping test using font sizes 20 to 6000\n")); |
|
1370 doRepeatShapeUsingVariousFontSizesTest(fontStore, aTestDataArr[KTeluguTestDataIndex]->iTypeFaceName, KTelugu1, KTelugu2, KTelugu3, KTeluguScriptCode, KTeluguLanguageCode); |
|
1371 |
|
1372 CleanupStack::Pop(font); |
|
1373 fontStore->ReleaseFont(font); |
|
1374 |
|
1375 |
|
1376 CleanupStack::PopAndDestroy(fontStore); |
|
1377 } |
|
1378 |
|
1379 static void MainL() |
|
1380 { |
|
1381 TInt i=0; |
|
1382 |
|
1383 TheTest.Start(_L("TC_SHAP_shapeText tests\n")); |
|
1384 |
|
1385 //set up the testData variables |
|
1386 CDesC16ArrayFlat* testDataFilenames = new CDesC16ArrayFlat(2); |
|
1387 CleanupStack::PushL(testDataFilenames); |
|
1388 for (i = 0; i != sizeof(KTestFilenames)/sizeof(KTestFilenames[0]); ++i) |
|
1389 { |
|
1390 TPtrC16 d(KTestFilenames[i]); |
|
1391 testDataFilenames->AppendL(d); |
|
1392 } |
|
1393 RPointerArray<CTestData> testDataArr = SetupTestData(testDataFilenames); |
|
1394 // Run Hindi Tests |
|
1395 TheTest.Next(_L("Hindi Shaping Tests\n")); |
|
1396 TRAPD(err, HindiTestsL(testDataArr)); |
|
1397 TEST2(err, KErrNone); |
|
1398 // Run Kannada Tests |
|
1399 TheTest.Next(_L("Kannada Shaping Tests\n")); |
|
1400 TRAP(err, KannadaTestsL(testDataArr)); |
|
1401 TEST2(err, KErrNone); |
|
1402 // Run Gujarati Tests |
|
1403 TheTest.Next(_L("Gujarati Shaping Tests\n")); |
|
1404 TRAP(err, GujaratiTestsL(testDataArr)); |
|
1405 TEST2(err, KErrNone); |
|
1406 // Run Bengali Tests |
|
1407 TheTest.Next(_L("Bengali Shaping Tests\n")); |
|
1408 TRAP(err, BengaliTestsL(testDataArr)); |
|
1409 TEST2(err, KErrNone); |
|
1410 // Run Tamil Tests |
|
1411 TheTest.Next(_L("Tamil Shaping Tests\n")); |
|
1412 TRAP(err, TamilTestsL(testDataArr)); |
|
1413 TEST2(err, KErrNone); |
|
1414 // Run Telugu Tests |
|
1415 TheTest.Next(_L("Telugu Shaping Tests\n")); |
|
1416 TRAP(err, TeluguTestsL(testDataArr)); |
|
1417 TEST2(err, KErrNone); |
|
1418 |
|
1419 // Run Gurmukhi Tests |
|
1420 TheTest.Next( _L("Gurmukhi Shaping Tests\n") ); |
|
1421 TRAP(err, GurmukhiTestsL(testDataArr) ); |
|
1422 TEST2(err, KErrNone); |
|
1423 |
|
1424 // Run Malayalam Tests |
|
1425 TheTest.Next( _L("Malayalam Shaping Tests\n") ); |
|
1426 TRAP(err, MalayalamTestsL(testDataArr) ); |
|
1427 TEST2(err, KErrNone); |
|
1428 |
|
1429 |
|
1430 testDataArr.ResetAndDestroy(); |
|
1431 |
|
1432 CleanupStack::PopAndDestroy(1); //testDataFilenames |
|
1433 |
|
1434 //close the ecom session opened by LoadOpenFontLibraries() |
|
1435 REComSession::FinalClose(); |
|
1436 |
|
1437 TheTest.End(); |
|
1438 TheTest.Close(); |
|
1439 |
|
1440 } |
|
1441 |
|
1442 TInt E32Main() |
|
1443 { |
|
1444 __UHEAP_MARK; |
|
1445 |
|
1446 CTrapCleanup* tc = CTrapCleanup::New(); |
|
1447 TEST(tc != NULL); |
|
1448 |
|
1449 TheTest.Title(); |
|
1450 TRAPD(err, ::MainL()); |
|
1451 TEST2(err, KErrNone); |
|
1452 |
|
1453 delete tc; |
|
1454 CloseSTDLIB(); |
|
1455 |
|
1456 __UHEAP_MARKEND; |
|
1457 |
|
1458 User::Heap().Check(); |
|
1459 return KErrNone; |
|
1460 } |