|
1 /* |
|
2 * Copyright (c) 2010 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 #include <e32math.h> |
|
19 #include <fbs.h> |
|
20 #include <badesca.h> |
|
21 #include <ecom/ecom.h> |
|
22 #include <ecom/implementationproxy.h> |
|
23 #include <graphics/shapeimpl.h> |
|
24 #include <graphics/openfontrasterizer.h> |
|
25 #include <graphics/openfontconstants.h> |
|
26 |
|
27 #include "testData.h" |
|
28 #include "t_shapeteststep.h" |
|
29 |
|
30 #define test(cond) \ |
|
31 { \ |
|
32 TBool __bb = (cond); \ |
|
33 TEST(__bb); \ |
|
34 if (!__bb) \ |
|
35 { \ |
|
36 ERR_PRINTF1(_L("ERROR: Test Failed")); \ |
|
37 User::Leave(1); \ |
|
38 } \ |
|
39 } |
|
40 |
|
41 //add filenames for any test data here |
|
42 const TText16* KTestFilenames[] = |
|
43 { |
|
44 //created from original iculayoutengine test data |
|
45 (const TText16*) L"z:\\test\\data\\tnr_dev_otshaperdata1.dat", |
|
46 //created from input data provided by licensee |
|
47 (const TText16*) L"z:\\test\\data\\tnr_dev_otshaperdata2.dat", |
|
48 //created from input data provided by licensee |
|
49 (const TText16*) L"z:\\test\\data\\tnr_dev_otshaperdata3.dat", |
|
50 //created from input data provided by licensee |
|
51 (const TText16*) L"z:\\test\\data\\tnr_dev_otshaperdata4.dat", |
|
52 // Data to test defect fix DEF078032 |
|
53 (const TText16*) L"z:\\test\\data\\tnr_dev_otshaperdata5.dat", |
|
54 //created from input data provided by licensee |
|
55 (const TText16*) L"z:\\test\\data\\shaperkannadadata1.dat", |
|
56 // created from Kannada sample text |
|
57 (const TText16*) L"z:\\test\\data\\shaperkannadadata2.dat", |
|
58 // created from Kannada sample text |
|
59 (const TText16*) L"z:\\test\\data\\shaperkannadadata3.dat", |
|
60 // created from Gujarati sample text taken from the web |
|
61 (const TText16*) L"z:\\test\\data\\shapergujaratidata1.dat", |
|
62 // created from Gujarati sample text taken from the web |
|
63 (const TText16*) L"z:\\test\\data\\shapergujaratidata2.dat", |
|
64 // created from Gujarati sample text given by the licensee |
|
65 (const TText16*) L"z:\\test\\data\\shapergujaratidata3.dat", |
|
66 // created from Bengali sample text given by the licensee |
|
67 (const TText16*) L"z:\\test\\data\\shaperbengalidata1.dat", |
|
68 // created from Bengali sample text given by the licensee |
|
69 (const TText16*) L"z:\\test\\data\\shaperbengalidata2.dat", |
|
70 // created from Bengali sample text given by the licensee |
|
71 (const TText16*) L"z:\\test\\data\\shaperbengalidata3.dat", |
|
72 // created from Tamil sample text given by the licensee |
|
73 (const TText16*) L"z:\\test\\data\\shapertamildata1.dat", |
|
74 // created from Tamil sample text given by the licensee |
|
75 (const TText16*) L"z:\\test\\data\\shapertamildata2.dat", |
|
76 // created from Tamil sample text given by the licensee |
|
77 (const TText16*) L"z:\\test\\data\\shapertamildata3.dat", |
|
78 // created from Telugu sample text given by the licensee |
|
79 (const TText16*) L"z:\\test\\data\\shapertelugudata1.dat", |
|
80 // created from Telugu sample text given by the licensee |
|
81 (const TText16*) L"z:\\test\\data\\shapertelugudata2.dat", |
|
82 // created from Telugu sample text given by the licensee |
|
83 (const TText16*) L"z:\\test\\data\\shapertelugudata3.dat", |
|
84 // Test for Gurmukhi digit |
|
85 (const TText16*) L"z:\\test\\data\\shapergurmukhi1.dat", |
|
86 (const TText16*) L"z:\\test\\data\\shapergurmukhi2.dat", |
|
87 (const TText16*) L"z:\\test\\data\\shapergurmukhi3.dat", |
|
88 (const TText16*) L"z:\\test\\data\\shapergurmukhi4.dat", |
|
89 (const TText16*) L"z:\\test\\data\\shapergurmukhi5.dat", |
|
90 // Test for Malayalam digit |
|
91 (const TText16*) L"z:\\test\\data\\shapermalayalam1.dat", |
|
92 (const TText16*) L"z:\\test\\data\\shapermalayalam2.dat", |
|
93 (const TText16*) L"z:\\test\\data\\shapermalayalam3.dat", |
|
94 (const TText16*) L"z:\\test\\data\\shapermalayalam4.dat", |
|
95 (const TText16*) L"z:\\test\\data\\shapermalayalam5.dat" |
|
96 }; |
|
97 |
|
98 /** |
|
99 Number of test data files of each of the scripts/languages bein tests. |
|
100 Must change these if KTestFilnames[] above is changed |
|
101 */ |
|
102 const TInt KHindiTestDataIndex = 0; |
|
103 const TInt KNumberOfHindiTestDataFiles = 5; |
|
104 const TInt KKannadaTestDataIndex = 5; |
|
105 const TInt KNumberOfKannadaTestDataFiles = 3; |
|
106 const TInt KGujaratiTestDataIndex = 8; |
|
107 const TInt KNumberOfGujaratiTestDataFiles = 3; |
|
108 const TInt KBengaliTestDataIndex = 11; |
|
109 const TInt KNumberOfBengaliTestDataFiles = 3; |
|
110 const TInt KTamilTestDataIndex = 14; |
|
111 const TInt KNumberOfTamilTestDataFiles = 3; |
|
112 const TInt KTeluguTestDataIndex = 17; |
|
113 const TInt KNumberOfTeluguTestDataFiles = 3; |
|
114 const TInt KGurmukhiTestDataIndex = 20; |
|
115 const TInt KNumberOfGurmukhiTestDataFiles = 5; |
|
116 const TInt KMalayalamTestDataIndex = 25; |
|
117 const TInt KNumberOfMalayalamTestDataFiles = 5; |
|
118 |
|
119 const TUint32 KDevanagariScriptCode = 0x64657661; |
|
120 const TUint32 KKannadaScriptCode = 0x6B6E6461; |
|
121 const TUint32 KHindiLanguageCode = 0x48494E20; |
|
122 const TUint32 KKannadaLanguageCode = 0x4B414E20; |
|
123 const TUint32 KGujaratiScriptCode = 0x67756A72; |
|
124 const TUint32 KGujaratiLanguageCode = 0x47554A20; |
|
125 const TUint32 KBengaliScriptCode = 0x62656E67; |
|
126 const TUint32 KBengaliLanguageCode = 0x42454E20; |
|
127 const TUint32 KTamilScriptCode = 0x74616D6C; |
|
128 const TUint32 KTamilLanguageCode = 0x54414D20; |
|
129 const TUint32 KTeluguScriptCode = 0x74656C75; |
|
130 const TUint32 KTeluguLanguageCode = 0x54454C20; |
|
131 const TUint32 KGurmukhiScriptCode = 0x67757275; |
|
132 const TUint32 KGurmukhiLanguageCode = 0; |
|
133 const TUint32 KMalayalamScriptCode = 0x6d6c796d; |
|
134 const TUint32 KMalayalamLanguageCode = 0x4d4c5220; |
|
135 |
|
136 _LIT(KTestStep_Hindi, "Hindi"); |
|
137 _LIT(KTestStep_Kannada, "Kannada"); |
|
138 _LIT(KTestStep_Gujarati, "Gujarati"); |
|
139 _LIT(KTestStep_Bengali, "Bengali"); |
|
140 _LIT(KTestStep_Tamil, "Tamil"); |
|
141 _LIT(KTestStep_Telugu, "Telugu"); |
|
142 _LIT(KTestStep_Gurmukhi, "Gurmukhi"); |
|
143 _LIT(KTestStep_Malayalam, "Malayalam"); |
|
144 |
|
145 _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"); |
|
146 _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"); |
|
147 _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"); |
|
148 |
|
149 _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"); |
|
150 _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"); |
|
151 _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"); |
|
152 |
|
153 _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"); |
|
154 _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"); |
|
155 _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"); |
|
156 |
|
157 _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"); |
|
158 _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"); |
|
159 _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"); |
|
160 |
|
161 _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"); |
|
162 _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"); |
|
163 _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"); |
|
164 |
|
165 _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"); |
|
166 _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"); |
|
167 _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"); |
|
168 |
|
169 _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"); |
|
170 _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"); |
|
171 _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"); |
|
172 |
|
173 _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"); |
|
174 _LIT16(KMalayalam2,"\xd2a\xd23\xd3f\xd2e\xd41\xd1f\xd15\xd4d\xd15\xd4d\x200c\xd2a\xd42\xd30\xd4d\x200d"); |
|
175 _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"); |
|
176 |
|
177 CShapeTestStep::CShapeTestStep(TInt aTestDataIndex, TInt aNumberOfTestDataFiles, |
|
178 TUint32 aScript, TUint32 aLang, const TDesC& aScriptName, const TDesC& aTestID) |
|
179 : iTestDataIndex(aTestDataIndex), iNumberOfTestDataFiles(aNumberOfTestDataFiles), |
|
180 iScript(aScript), iLang(aLang), iScriptName(aScriptName), iTestID(aTestID) |
|
181 { |
|
182 SetTestStepName(aScriptName); |
|
183 } |
|
184 |
|
185 // Convenience methods |
|
186 //************************************************************************************** |
|
187 |
|
188 /* |
|
189 Used for cleanup of RImplInfoArray implementationArray below |
|
190 This method is stolen from FbsTop.cpp |
|
191 */ |
|
192 LOCAL_C void ResetAndDestroyRImplInfoPtrArray(TAny* aPtr) |
|
193 { |
|
194 RImplInfoPtrArray* array = reinterpret_cast <RImplInfoPtrArray*> (aPtr); |
|
195 array->ResetAndDestroy(); |
|
196 } |
|
197 |
|
198 /* |
|
199 Load all ECOM implemented rasterizer DLLs. |
|
200 This method is stolen from CFbTop::LoadOpenFontLibraries() |
|
201 */ |
|
202 LOCAL_C void LoadOpenFontLibraries(CFontStore* aFontStore) |
|
203 { |
|
204 RImplInfoPtrArray implementationArray; |
|
205 TCleanupItem cleanup(ResetAndDestroyRImplInfoPtrArray, &implementationArray); |
|
206 CleanupStack::PushL(cleanup); |
|
207 TInt error; |
|
208 TInt ecomerror; |
|
209 TInt ecomnotready; |
|
210 TUid uid = {KUidOpenFontRasterizerPlunginInterface}; |
|
211 |
|
212 // Making sure that no race situation arises |
|
213 // If ECom is not ready, give it another chance and try again. if it still doesn't work |
|
214 // after the third try, then it just carries on quietly and fails... |
|
215 for (ecomnotready =0; ecomnotready <3; ecomnotready++) |
|
216 { |
|
217 TRAP(ecomerror,REComSession::ListImplementationsL(uid,implementationArray)); |
|
218 if (!ecomerror) |
|
219 { |
|
220 break; |
|
221 } |
|
222 else |
|
223 { |
|
224 ecomerror = 0; |
|
225 User::After(0); |
|
226 } |
|
227 } |
|
228 |
|
229 const TInt availCount = implementationArray.Count(); |
|
230 for (TInt count=0;count<availCount;++count) |
|
231 { |
|
232 const CImplementationInformation* info = implementationArray[count]; |
|
233 TUid rasterizerUid = info->ImplementationUid(); |
|
234 // Create a rasterizer |
|
235 COpenFontRasterizer* rasterizer=0; |
|
236 TRAP(error,rasterizer = COpenFontRasterizer::NewL(rasterizerUid)); |
|
237 if (!error) |
|
238 { |
|
239 // Install it in the font store. |
|
240 TRAP(error,aFontStore->InstallRasterizerL(rasterizer)); |
|
241 if (error) |
|
242 delete rasterizer; |
|
243 } |
|
244 } |
|
245 CleanupStack::PopAndDestroy(&implementationArray); |
|
246 } |
|
247 |
|
248 void CShapeTestStep::SetupTestDataL() |
|
249 { |
|
250 //set up the testData variables |
|
251 CDesC16ArrayFlat* testDataFilenames = new CDesC16ArrayFlat(2); |
|
252 CleanupStack::PushL(testDataFilenames); |
|
253 |
|
254 for (TInt i = 0; i != sizeof(KTestFilenames)/sizeof(KTestFilenames[0]); ++i) |
|
255 { |
|
256 TPtrC16 d(KTestFilenames[i]); |
|
257 testDataFilenames->AppendL(d); |
|
258 } |
|
259 |
|
260 for (TInt i = 0; i<testDataFilenames->Count(); i++) |
|
261 { |
|
262 CTestData* temp = new(ELeave) CTestData; |
|
263 temp->Internalize((*testDataFilenames)[i]); |
|
264 iTestDataArr.AppendL(temp); |
|
265 } |
|
266 |
|
267 CleanupStack::PopAndDestroy(1); //testDataFilenames |
|
268 } |
|
269 |
|
270 |
|
271 // test methods |
|
272 //************************************************************************************** |
|
273 |
|
274 /** |
|
275 @file |
|
276 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-1479 |
|
277 @SYMTestCaseDesc Simple test of the shaper |
|
278 @SYMTestPriority High |
|
279 @SYMTestActions Simple test to shape some text using the shaper, and test that the output is as expected. Does not perform any OOM testing. |
|
280 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
281 @SYMPREQ PREQ18 |
|
282 */ |
|
283 void CShapeTestStep::doShapeText(CBitmapFont* font, CTestData& aTestData, TBool aCheckOutput) |
|
284 { |
|
285 INFO_PRINTF1(_L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-1479 ")); |
|
286 |
|
287 //set up the shaper |
|
288 CShaper* theShaper = NULL; |
|
289 CShaperFactory* shaperFactory = NULL; |
|
290 |
|
291 RImplInfoPtrArray implementationArray; |
|
292 TCleanupItem cleanup(ResetAndDestroyRImplInfoPtrArray, &implementationArray); |
|
293 CleanupStack::PushL(cleanup); |
|
294 TInt ecomerror; |
|
295 TInt ecomnotready; |
|
296 TUid uid = {KUidShaperFactoryPlunginInterface}; |
|
297 |
|
298 // Making sure that no race situation arises between FBserv and Ecom |
|
299 // If ECom is not ready, give it another chance and try again. if it still doesn't work |
|
300 // after the third try, then it just carries on quietly and fails... |
|
301 for (ecomnotready =0; ecomnotready <3; ecomnotready++) |
|
302 { |
|
303 |
|
304 TRAP(ecomerror,REComSession::ListImplementationsL(uid,implementationArray)); |
|
305 if (!ecomerror) |
|
306 { |
|
307 break; |
|
308 } |
|
309 else |
|
310 { |
|
311 ecomerror = 0; |
|
312 User::After(0); |
|
313 } |
|
314 } |
|
315 |
|
316 const TInt availCount = implementationArray.Count(); |
|
317 for (TInt count=0;count<availCount;++count) |
|
318 { |
|
319 const CImplementationInformation* info = implementationArray[count]; |
|
320 TUid shaperFactoryUid = info->ImplementationUid(); |
|
321 // Create a shaper factory |
|
322 TInt error; |
|
323 TRAP(error,shaperFactory = CShaperFactory::NewL(shaperFactoryUid)); |
|
324 test(error == KErrNone); |
|
325 // Create a shaper |
|
326 TRAP(error, theShaper = shaperFactory->NewShaperL(font, iScript, iLang, &User::Heap())); |
|
327 if (error != KErrNone) |
|
328 { |
|
329 delete shaperFactory; |
|
330 shaperFactory = NULL; |
|
331 } |
|
332 test(error == KErrNone); |
|
333 break; // have got valid shaper here |
|
334 } |
|
335 CleanupStack::PopAndDestroy(&implementationArray); |
|
336 |
|
337 CleanupStack::PushL(shaperFactory); |
|
338 CleanupStack::PushL(theShaper); |
|
339 |
|
340 // create the data to be shaped |
|
341 // this uses hindiTestData, defined in testData.h |
|
342 CShaper::TInput input; |
|
343 input.iText = aTestData.iTextInput; |
|
344 input.iStart = aTestData.iStart; |
|
345 input.iEnd = aTestData.iEnd; |
|
346 |
|
347 TInt textLength = input.iText->Length(); |
|
348 |
|
349 //create shape header, and shape the text |
|
350 TShapeHeader* output = NULL; |
|
351 TInt err = theShaper->ShapeText(output, input, &User::Heap()); |
|
352 test(err == KErrNone); |
|
353 CleanupStack::PopAndDestroy(theShaper); |
|
354 CleanupStack::PopAndDestroy(shaperFactory); |
|
355 REComSession::FinalClose(); |
|
356 |
|
357 CleanupStack::PushL(output); |
|
358 |
|
359 if (aCheckOutput) |
|
360 { |
|
361 // check the contents of output |
|
362 TEST(output->iGlyphCount == aTestData.iGlyphCount); |
|
363 TEST(output->iCharacterCount == aTestData.iCharacterCount); |
|
364 |
|
365 // First iGlyphCount * 4 bytes of the output buffer contain the glyph codes as 2byte values |
|
366 // Compare against expected. |
|
367 TInt i=0; |
|
368 TUint32* shapePtr32 = (reinterpret_cast<TUint32*>(&output->iBuffer[0])); |
|
369 for (i=0; i < output->iGlyphCount; i++) |
|
370 { |
|
371 TEST(*shapePtr32 == (*aTestData.iGlyphs)[i]); |
|
372 shapePtr32++; |
|
373 } |
|
374 |
|
375 // next iGlyphCount * 4 bytes contain the postions in which the glyphs should be drawn, x and y axes. |
|
376 // Compare against expected |
|
377 TUint16* shapePtr16 = (reinterpret_cast<TUint16*>(shapePtr32)); |
|
378 for (i=0; i < output->iGlyphCount*2; i++) |
|
379 { |
|
380 //check X or Y position |
|
381 TEST(*shapePtr16 == (*aTestData.iPositions)[i]); |
|
382 shapePtr16++; |
|
383 } |
|
384 |
|
385 // check advance |
|
386 TEST(*shapePtr16 == aTestData.iAdvance.iX); |
|
387 shapePtr16++; |
|
388 TEST(*shapePtr16 == aTestData.iAdvance.iY); |
|
389 shapePtr16++; |
|
390 |
|
391 // next iGlyphCount * 2 bytes contain the coresponding indices of this character in the original string. |
|
392 // Compare against expected |
|
393 for (i=0; i < output->iGlyphCount; i++) |
|
394 { |
|
395 TEST(*shapePtr16 == (*aTestData.iIndices)[i]); |
|
396 shapePtr16++; |
|
397 } |
|
398 } |
|
399 |
|
400 CleanupStack::PopAndDestroy(output); |
|
401 } |
|
402 |
|
403 void CShapeTestStep::shapeText(CBitmapFont* font, CTestData& aTestData, TBool aCheckOutput) |
|
404 { |
|
405 __UHEAP_MARK; |
|
406 TInt heapSizeAtStart = 0; |
|
407 User::Heap().AllocSize(heapSizeAtStart); |
|
408 |
|
409 INFO_PRINTF2(_L("Heap memory utilized is now %d\n"), heapSizeAtStart); |
|
410 |
|
411 doShapeText(font, aTestData, aCheckOutput); |
|
412 // check the heap used by the shaper |
|
413 RHeap* heap = &User::Heap(); |
|
414 heap->Check(); |
|
415 TInt heapSizeAtEnd = 0; |
|
416 TInt heapCellsUsed = heap->AllocSize(heapSizeAtEnd); |
|
417 if (heapCellsUsed) |
|
418 { |
|
419 INFO_PRINTF2(_L("This test leaked %d\n"), heapSizeAtEnd - heapSizeAtStart); |
|
420 } |
|
421 __UHEAP_MARKEND; |
|
422 } |
|
423 |
|
424 /** |
|
425 @file |
|
426 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-1480 |
|
427 @SYMTestCaseDesc Simple OOM test of shaper |
|
428 @SYMTestPriority High |
|
429 @SYMTestActions OOM testing for the shaper. Also ensures no leaks. |
|
430 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
431 @SYMPREQ PREQ18 |
|
432 */ |
|
433 void CShapeTestStep::oomShapeText(CBitmapFont* font, CTestData& aTestData) |
|
434 { |
|
435 __UHEAP_MARK; |
|
436 INFO_PRINTF1(_L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-1480 ")); |
|
437 doOomShapeText(font,aTestData); |
|
438 __UHEAP_MARKEND; |
|
439 } |
|
440 |
|
441 void CShapeTestStep::doOomShapeText(CBitmapFont* font, CTestData& aTestData) |
|
442 { |
|
443 TInt count = 0; |
|
444 TInt err = KErrNone; |
|
445 TInt heapCellsUsed, heapSizeAtEnd, heapSizeAtStart; |
|
446 CShaper* theShaper = NULL; |
|
447 CShaperFactory* shaperFactory = NULL; |
|
448 TShapeHeader* output = NULL; |
|
449 |
|
450 User::Heap().AllocSize(heapSizeAtStart); |
|
451 |
|
452 // create the data to be shaped |
|
453 CShaper::TInput input; |
|
454 input.iText = aTestData.iTextInput; |
|
455 input.iStart = aTestData.iStart; |
|
456 input.iEnd = aTestData.iEnd; |
|
457 |
|
458 //set up shaper, shape, delete shaper in oom loop |
|
459 RImplInfoPtrArray implementationArray; |
|
460 TCleanupItem cleanup(ResetAndDestroyRImplInfoPtrArray, &implementationArray); |
|
461 CleanupStack::PushL(cleanup); |
|
462 TInt error; |
|
463 TInt ecomerror; |
|
464 TInt ecomnotready; |
|
465 TUid uid = {KUidShaperFactoryPlunginInterface}; |
|
466 |
|
467 // Making sure that no race situation arises between FBserv and Ecom |
|
468 // If ECom is not ready, give it another chance and try again. if it still doesn't work |
|
469 // after the third try, then it just carries on quietly and fails... |
|
470 for (ecomnotready =0; ecomnotready <3; ecomnotready++) |
|
471 { |
|
472 |
|
473 TRAP(ecomerror,REComSession::ListImplementationsL(uid,implementationArray)); |
|
474 if (!ecomerror) |
|
475 { |
|
476 break; |
|
477 } |
|
478 else |
|
479 { |
|
480 ecomerror = 0; |
|
481 User::After(0); |
|
482 } |
|
483 } |
|
484 |
|
485 const TInt availCount = implementationArray.Count(); |
|
486 for (TInt count=0;count<availCount;++count) |
|
487 { |
|
488 const CImplementationInformation* info = implementationArray[count]; |
|
489 TUid shaperFactoryUid = info->ImplementationUid(); |
|
490 // Create a shaper factory |
|
491 //CShaperFactory* shaperFactory = 0; |
|
492 TRAP(error,shaperFactory = CShaperFactory::NewL(shaperFactoryUid)); |
|
493 test(error == KErrNone); |
|
494 //CleanupStack::PushL(shaperFactory); |
|
495 } |
|
496 CleanupStack::PopAndDestroy(&implementationArray); |
|
497 |
|
498 do |
|
499 { |
|
500 count += 1; |
|
501 __UHEAP_FAILNEXT(count); |
|
502 |
|
503 // Create a shaper |
|
504 TRAPD(err, theShaper = shaperFactory->NewShaperL(font, iScript, iLang, &User::Heap())); |
|
505 |
|
506 //shape text |
|
507 if (theShaper) |
|
508 { |
|
509 err = theShaper->ShapeText(output, input, &User::Heap()); |
|
510 TEST(err == KErrNone); |
|
511 } |
|
512 |
|
513 //free output; to be done by the caller of ShapeText |
|
514 delete output; |
|
515 output = NULL; |
|
516 |
|
517 //does not check the output for now |
|
518 delete theShaper; |
|
519 delete shaperFactory; |
|
520 REComSession::FinalClose(); |
|
521 |
|
522 }while ((err==KErrNoMemory)||(err==KErrGeneral)); |
|
523 __UHEAP_RESET; |
|
524 |
|
525 // check the heap used by the shaper |
|
526 RHeap* heap = &User::Heap(); |
|
527 heap->Check(); |
|
528 heapCellsUsed = heap->AllocSize(heapSizeAtEnd); |
|
529 if (heapCellsUsed) |
|
530 { |
|
531 INFO_PRINTF2(_L("This test leaked %d.\n"), heapSizeAtEnd - heapSizeAtStart); |
|
532 } |
|
533 } |
|
534 |
|
535 /** |
|
536 @file |
|
537 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-1481 |
|
538 @SYMTestCaseDesc Tests that the shaper can handle multiple calls to ShapeText |
|
539 @SYMTestPriority High |
|
540 @SYMTestActions Makes multiple calls to CShaper::ShapeText with small amounts of text to be shaped |
|
541 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
542 @SYMPREQ PREQ18 |
|
543 */ |
|
544 void CShapeTestStep::repeatShapeText(CBitmapFont* aFont, CTestData& aTestData) |
|
545 { |
|
546 __UHEAP_MARK; |
|
547 INFO_PRINTF1(_L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-1481 ")); |
|
548 doRepeatShapeText(aFont, aTestData); |
|
549 __UHEAP_MARKEND; |
|
550 } |
|
551 |
|
552 void CShapeTestStep::doRepeatShapeText(CBitmapFont* font, CTestData& aTestData) |
|
553 { |
|
554 //set up the shaper |
|
555 CShaper* theShaper = NULL; |
|
556 CShaperFactory* shaperFactory = NULL; |
|
557 |
|
558 RImplInfoPtrArray implementationArray; |
|
559 TCleanupItem cleanup(ResetAndDestroyRImplInfoPtrArray, &implementationArray); |
|
560 CleanupStack::PushL(cleanup); |
|
561 |
|
562 TInt ecomerror; |
|
563 TInt ecomnotready; |
|
564 TUid uid = {KUidShaperFactoryPlunginInterface}; |
|
565 |
|
566 // Making sure that no race situation arises between FBserv and Ecom |
|
567 // If ECom is not ready, give it another chance and try again. if it still doesn't work |
|
568 // after the third try, then it just carries on quietly and fails... |
|
569 for (ecomnotready =0; ecomnotready <3; ecomnotready++) |
|
570 { |
|
571 |
|
572 TRAP(ecomerror,REComSession::ListImplementationsL(uid,implementationArray)); |
|
573 if (!ecomerror) |
|
574 { |
|
575 break; |
|
576 } |
|
577 else |
|
578 { |
|
579 ecomerror = 0; |
|
580 User::After(0); |
|
581 } |
|
582 } |
|
583 |
|
584 const TInt availCount = implementationArray.Count(); |
|
585 for (TInt count=0;count<availCount;++count) |
|
586 { |
|
587 const CImplementationInformation* info = implementationArray[count]; |
|
588 TUid shaperFactoryUid = info->ImplementationUid(); |
|
589 // Create a shaper factory |
|
590 TInt error; |
|
591 TRAP(error,shaperFactory = CShaperFactory::NewL(shaperFactoryUid)); |
|
592 test(error == KErrNone); |
|
593 |
|
594 // Create a shaper |
|
595 TRAP(error, theShaper = shaperFactory->NewShaperL(font, iScript, iLang, &User::Heap())); |
|
596 if (error != KErrNone) |
|
597 { |
|
598 delete shaperFactory; |
|
599 shaperFactory = NULL; |
|
600 } |
|
601 test(error == KErrNone); |
|
602 break; // have got valid shaper here |
|
603 } |
|
604 CleanupStack::PopAndDestroy(&implementationArray); |
|
605 |
|
606 CleanupStack::PushL(shaperFactory); |
|
607 CleanupStack::PushL(theShaper); |
|
608 |
|
609 // create the data to be shaped |
|
610 // this uses CTestData, defined in testData.h |
|
611 CShaper::TInput input; |
|
612 input.iText = aTestData.iTextInput; |
|
613 |
|
614 //create shape header, and shape the text |
|
615 TShapeHeader* output = NULL; |
|
616 |
|
617 for(TInt i=aTestData.iStart; i<aTestData.iEnd -10; i++) |
|
618 { |
|
619 //indicate which 10 chars to be shaped |
|
620 input.iStart = i; |
|
621 input.iEnd = i + 10; |
|
622 |
|
623 //shape text |
|
624 TInt err = theShaper->ShapeText(output, input, &User::Heap()); |
|
625 test(err == KErrNone); |
|
626 |
|
627 //free output; to be done by the caller of ShapeText |
|
628 delete(output); |
|
629 output = NULL; |
|
630 |
|
631 //does not check the output for now |
|
632 } |
|
633 |
|
634 //cleanup the shaper |
|
635 CleanupStack::PopAndDestroy(theShaper); |
|
636 CleanupStack::PopAndDestroy(shaperFactory); |
|
637 REComSession::FinalClose(); |
|
638 } |
|
639 |
|
640 /* |
|
641 @file |
|
642 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-3401 |
|
643 @SYMTestCaseDesc Tests that the shaper can handle calls to shapeText with multiple font sizes |
|
644 @SYMTestPriority High |
|
645 @SYMTestActions Makes multiple calls to CShaper::ShapeText with small amounts of text to be shaped and incremental font sizes |
|
646 @SYMTestExpectedResults The test must not show a memory leak at any font size |
|
647 @SYMPREQ DEF103042: TC_SHAP_shapeText test failing with alloc failure |
|
648 **/ |
|
649 void CShapeTestStep::doRepeatShapeUsingVariousFontSizesTest(CFontStore* aFontStore, const TDesC aTypefaceName, const TDesC &aText1, |
|
650 const TDesC &aText2, const TDesC &aText3) |
|
651 { |
|
652 INFO_PRINTF1(_L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-3401 ")); |
|
653 TInt heapCellsUsed, heapSizeAtEnd, heapSizeAtStart; |
|
654 User::Heap().AllocSize(heapSizeAtStart); |
|
655 |
|
656 // Set up shaper factory |
|
657 // Set up the shaper |
|
658 CShaper* theShaper = NULL; |
|
659 CShaperFactory* shaperFactory = NULL; |
|
660 |
|
661 RImplInfoPtrArray implementationArray; |
|
662 TCleanupItem cleanup(ResetAndDestroyRImplInfoPtrArray, &implementationArray); |
|
663 CleanupStack::PushL(cleanup); |
|
664 TInt err; |
|
665 TInt ecomerror; |
|
666 TInt ecomnotready; |
|
667 TUid uid = {KUidShaperFactoryPlunginInterface}; |
|
668 |
|
669 // Making sure that no race situation arises between FBserv and Ecom |
|
670 // If ECom is not ready, give it another chance and try again. if it still doesn't work |
|
671 // after the third try, then it just carries on quietly and fails... |
|
672 for (ecomnotready =0; ecomnotready <3; ecomnotready++) |
|
673 { |
|
674 TRAP(ecomerror,REComSession::ListImplementationsL(uid,implementationArray)); |
|
675 if (!ecomerror) |
|
676 { |
|
677 break; |
|
678 } |
|
679 else |
|
680 { |
|
681 ecomerror = 0; |
|
682 User::After(0); |
|
683 } |
|
684 } |
|
685 |
|
686 const TInt availCount = implementationArray.Count(); |
|
687 for (TInt count=0;count<availCount;++count) |
|
688 { |
|
689 const CImplementationInformation* info = implementationArray[count]; |
|
690 TUid shaperFactoryUid = info->ImplementationUid(); |
|
691 // Create a shaper factory |
|
692 TRAPD(error,shaperFactory = CShaperFactory::NewL(shaperFactoryUid)); |
|
693 test(error == KErrNone); |
|
694 } |
|
695 |
|
696 CleanupStack::PopAndDestroy(&implementationArray); |
|
697 |
|
698 CleanupStack::PushL(shaperFactory); |
|
699 |
|
700 // create the data to be shaped |
|
701 // this explicitely uses hindiTestData, defined in testData.h |
|
702 CShaper::TInput input; |
|
703 input.iStart = 0; |
|
704 |
|
705 //create shape header, and shape the text |
|
706 TShapeHeader* output = NULL; |
|
707 |
|
708 CBitmapFont* font; |
|
709 |
|
710 // Test shaping for the Hindi texts for various font sizes |
|
711 INFO_PRINTF1(_L("Generating a random initial font size between 0 and 1 for this test\n")); |
|
712 TInt random = (Math::Random()>>11)%2; |
|
713 INFO_PRINTF2(_L("Random initial font size is %d. Testing upto size 300 with increments of 2\n"), random); |
|
714 for (TInt i = random; i <= 300; i+=2) |
|
715 { |
|
716 INFO_PRINTF2(_L("Font Size: %d\n"), i); |
|
717 if (i == 294 || i == 295) |
|
718 { |
|
719 INFO_PRINTF2(_L("Font Size: %d\n"), i); |
|
720 } |
|
721 TFontSpec fontSpec(aTypefaceName,i*20); |
|
722 aFontStore->GetNearestFontInTwips((CFont*&)font, fontSpec); |
|
723 CleanupStack::PushL(font); |
|
724 |
|
725 TRAP(err, theShaper = shaperFactory->NewShaperL(font, iScript, iLang, &User::Heap())); |
|
726 test(err == KErrNone); |
|
727 CleanupStack::PushL(theShaper); |
|
728 |
|
729 // Call the shaper twice because the first time the rasterizer uses memory to cache the tables |
|
730 // We can then check the heap in the second call |
|
731 input.iText = &aText1; |
|
732 input.iEnd = aText1.Length(); |
|
733 err = theShaper->ShapeText(output, input, &User::Heap()); |
|
734 delete output; |
|
735 TEST(err == KErrNone); |
|
736 __UHEAP_MARK; |
|
737 err = theShaper->ShapeText(output, input, &User::Heap()); |
|
738 delete output; |
|
739 __UHEAP_MARKEND; |
|
740 TEST(err == KErrNone); |
|
741 |
|
742 input.iText = &aText2; |
|
743 input.iEnd = aText2.Length(); |
|
744 err = theShaper->ShapeText(output, input, &User::Heap()); |
|
745 delete output; |
|
746 TEST(err == KErrNone); |
|
747 __UHEAP_MARK; |
|
748 err = theShaper->ShapeText(output, input, &User::Heap()); |
|
749 delete output; |
|
750 __UHEAP_MARKEND; |
|
751 TEST(err == KErrNone); |
|
752 |
|
753 input.iText = &aText3; |
|
754 input.iEnd = aText3.Length(); |
|
755 err = theShaper->ShapeText(output, input, &User::Heap()); |
|
756 delete output; |
|
757 TEST(err == KErrNone); |
|
758 // __UHEAP_MARK; |
|
759 err = theShaper->ShapeText(output, input, &User::Heap()); |
|
760 delete output; |
|
761 // __UHEAP_MARKEND; |
|
762 TEST(err == KErrNone); |
|
763 |
|
764 CleanupStack::PopAndDestroy(theShaper); |
|
765 CleanupStack::Pop(font); |
|
766 aFontStore->ReleaseFont(font); |
|
767 } |
|
768 |
|
769 CleanupStack::PopAndDestroy(shaperFactory); |
|
770 |
|
771 //close the ecom session opened by LoadOpenFontLibraries() |
|
772 REComSession::FinalClose(); |
|
773 |
|
774 // check the heap used by the shaper |
|
775 RHeap* heap = &User::Heap(); |
|
776 heap->Check(); |
|
777 heapCellsUsed = heap->AllocSize(heapSizeAtEnd); |
|
778 if (heapCellsUsed) |
|
779 { |
|
780 INFO_PRINTF2(_L("This test utilised %d bytes\n"), heapSizeAtEnd - heapSizeAtStart); |
|
781 } |
|
782 } |
|
783 |
|
784 /** |
|
785 @file |
|
786 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-3403 |
|
787 @SYMTestCaseDesc Tests the shaper using Devanagari Unicode. Test include OOM tests (oomShapeText), repeated |
|
788 calls to the shaper (repeatShapeText), simple shaping tests (shapeText), and repeatedly |
|
789 calling the shaper with incremental font sizes. |
|
790 @SYMTestPriority High |
|
791 @SYMTestActions Performs various tests of the the shaper, calling CShaper::ShapeText in various use cases |
|
792 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
793 @SYMPREQ PREQ19 |
|
794 */ |
|
795 /** |
|
796 @file |
|
797 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-3383-0001 |
|
798 @SYMTestCaseDesc Tests the shaper using Kannada Unicode. Test include OOM tests (oomShapeText), repeated |
|
799 calls to the shaper (repeatShapeText), simple shaping tests (shapeText), and repeatedly |
|
800 calling the shaper with incremental font sizes. |
|
801 @SYMTestPriority High |
|
802 @SYMTestActions Performs various tests of the the shaper, calling CShaper::ShapeText in various use cases |
|
803 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
804 @SYMPREQ PREQ19 |
|
805 */ |
|
806 /** |
|
807 @file |
|
808 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-3383-0002 |
|
809 @SYMTestCaseDesc Tests the shaper using Gujarati Unicode. Test include OOM tests (oomShapeText), repeated |
|
810 calls to the shaper (repeatShapeText), simple shaping tests (shapeText), and repeatedly |
|
811 calling the shaper with incremental font sizes. |
|
812 @SYMTestPriority High |
|
813 @SYMTestActions Performs various tests of the the shaper, calling CShaper::ShapeText in various use cases |
|
814 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
815 @SYMPREQ PREQ19 |
|
816 */ |
|
817 /** |
|
818 @file |
|
819 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-4001 |
|
820 @SYMTestCaseDesc Tests the shaper using Bengali Unicode. Test include OOM tests (oomShapeText), repeated |
|
821 calls to the shaper (repeatShapeText), simple shaping tests (shapeText), and repeatedly |
|
822 calling the shaper with incremental font sizes. |
|
823 @SYMTestPriority High |
|
824 @SYMTestActions Performs various tests of the the shaper, calling CShaper::ShapeText in various use cases |
|
825 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
826 @SYMPREQ PREQ1766 |
|
827 @SYMREQ REQ8741 |
|
828 */ |
|
829 /** |
|
830 @file |
|
831 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-4002 |
|
832 @SYMTestCaseDesc Tests the shaper using Tamil Unicode. Test include OOM tests (oomShapeText), repeated |
|
833 calls to the shaper (repeatShapeText), simple shaping tests (shapeText), and repeatedly |
|
834 calling the shaper with incremental font sizes. |
|
835 @SYMTestPriority High |
|
836 @SYMTestActions Performs various tests of the the shaper, calling CShaper::ShapeText in various use cases |
|
837 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
838 @SYMPREQ PREQ1766 |
|
839 @SYMREQ REQ8742 |
|
840 */ |
|
841 /** |
|
842 @file |
|
843 @SYMTestCaseID GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-4003 |
|
844 @SYMTestCaseDesc Tests the shaper using Telugu Unicode. Test include OOM tests (oomShapeText), repeated |
|
845 calls to the shaper (repeatShapeText), simple shaping tests (shapeText), and repeatedly |
|
846 calling the shaper with incremental font sizes. |
|
847 @SYMTestPriority High |
|
848 @SYMTestActions Performs various tests of the the shaper, calling CShaper::ShapeText in various use cases |
|
849 @SYMTestExpectedResults The test must exit cleanly and there should not be any User:84 errors, KERN-EXEC's or any memory leaks. |
|
850 @SYMPREQ PREQ1766 |
|
851 @SYMREQ REQ8743 |
|
852 */ |
|
853 /** |
|
854 @SYMTestCaseID GRAPHICS-TI18N-ICULAYOUTENGINE-CT-4007 |
|
855 @SYMTestCaseDesc Case to do Gurmukhi component test |
|
856 It covers all Iculayout components cases |
|
857 @SYMTestPriority High |
|
858 @SYMTestActions Iterate Gurmukhi test data, each test data corresponds with a case |
|
859 @SYMTestExpectedResults No error returned |
|
860 @SYMPREQ 1922: Gurmukhi support |
|
861 */ |
|
862 /** |
|
863 @SYMTestCaseID GRAPHICS-TI18N-ICULAYOUTENGINE-CT-4008 |
|
864 @SYMTestCaseDesc Case to do Malayalam component test |
|
865 It covers all Iculayout components cases |
|
866 @SYMTestPriority High |
|
867 @SYMTestActions Iterate Malayalam test data, each test data corresponds with a case |
|
868 @SYMTestExpectedResults No error returned |
|
869 @SYMPREQ 1922: Malayalam support |
|
870 */ |
|
871 void CShapeTestStep::ShapeTestL() |
|
872 { |
|
873 INFO_PRINTF1(iTestID); |
|
874 |
|
875 CBitmapFont* font; |
|
876 TInt err=KErrNone; |
|
877 //the font store can use the normal user heap |
|
878 CFontStore* fontStore = CFontStore::NewL(&User::Heap()); |
|
879 fontStore->iKPixelWidthInTwips = 11860; |
|
880 fontStore->iKPixelHeightInTwips = 11860; |
|
881 CleanupStack::PushL(fontStore); |
|
882 |
|
883 //load all ecom implemented rasterizer dlls. installs the rasterizer. |
|
884 LoadOpenFontLibraries(fontStore); |
|
885 |
|
886 //add the required font file |
|
887 TRAP(err,fontStore->AddFileL(iTestDataArr[iTestDataIndex]->iFilename)); |
|
888 test(err == KErrNone); |
|
889 |
|
890 |
|
891 //run all tests for TNR_Dev_OT test, which is at position 0 in the aTestDataArr |
|
892 TFontSpec fontSpec(iTestDataArr[iTestDataIndex]->iTypeFaceName,12); |
|
893 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
894 CleanupStack::PushL(font); |
|
895 |
|
896 INFO_PRINTF2(_L("Repeat %S text shaping test\n"), &iScriptName); |
|
897 doRepeatShapeText(font, *iTestDataArr[iTestDataIndex]); |
|
898 repeatShapeText(font, *iTestDataArr[iTestDataIndex]); |
|
899 |
|
900 INFO_PRINTF2(_L("OOM %S text shaping test\n"), &iScriptName); |
|
901 #if defined(_DEBUG) |
|
902 doOomShapeText(font, *iTestDataArr[iTestDataIndex]); |
|
903 oomShapeText(font, *iTestDataArr[iTestDataIndex]); |
|
904 #else |
|
905 INFO_PRINTF1(_L("This test is ignored for release version\n")); |
|
906 #endif |
|
907 |
|
908 INFO_PRINTF2(_L("Run simple %S shape test\n"), &iScriptName); |
|
909 doShapeText(font, *iTestDataArr[iTestDataIndex], ETrue); |
|
910 shapeText(font, *iTestDataArr[iTestDataIndex], ETrue); |
|
911 |
|
912 CleanupStack::Pop(font); |
|
913 fontStore->ReleaseFont(font); |
|
914 |
|
915 //for any other test data we have, run the simple shape text test only |
|
916 for(TInt i=iTestDataIndex+1; i<iTestDataIndex+iNumberOfTestDataFiles; i++) |
|
917 { |
|
918 TFontSpec fontSpec(iTestDataArr[i]->iTypeFaceName,12); |
|
919 fontStore->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec); |
|
920 CleanupStack::PushL(font); |
|
921 |
|
922 // First run does not check heap... this ensures that any memory |
|
923 // stashed by the rasterizer does not show up as a leak. |
|
924 doShapeText(font, *iTestDataArr[i], ETrue); |
|
925 shapeText(font, *iTestDataArr[i], ETrue); |
|
926 |
|
927 CleanupStack::Pop(font); |
|
928 fontStore->ReleaseFont(font); |
|
929 } |
|
930 |
|
931 // Now do the last test, the shaping test using various font sizes |
|
932 INFO_PRINTF2(_L("Repeat %S shaping test using font sizes 20 to 6000\n"), &iScriptName); |
|
933 if(iScriptName == KTestStep_Hindi) |
|
934 { |
|
935 doRepeatShapeUsingVariousFontSizesTest(fontStore, iTestDataArr[0]->iTypeFaceName, KHindi1, KHindi2, KHindi3); |
|
936 } |
|
937 else if(iScriptName == KTestStep_Kannada) |
|
938 { |
|
939 doRepeatShapeUsingVariousFontSizesTest(fontStore, iTestDataArr[0]->iTypeFaceName, KKannada1, KKannada2, KKannada3); |
|
940 } |
|
941 else if(iScriptName == KTestStep_Gujarati) |
|
942 { |
|
943 doRepeatShapeUsingVariousFontSizesTest(fontStore, iTestDataArr[0]->iTypeFaceName, KGujarati1, KGujarati2, KGujarati3); |
|
944 } |
|
945 else if(iScriptName == KTestStep_Bengali) |
|
946 { |
|
947 doRepeatShapeUsingVariousFontSizesTest(fontStore, iTestDataArr[0]->iTypeFaceName, KBengali1, KBengali2, KBengali3); |
|
948 } |
|
949 else if(iScriptName == KTestStep_Tamil) |
|
950 { |
|
951 doRepeatShapeUsingVariousFontSizesTest(fontStore, iTestDataArr[0]->iTypeFaceName, KTamil1, KTamil2, KTamil3); |
|
952 } |
|
953 else if(iScriptName == KTestStep_Telugu) |
|
954 { |
|
955 doRepeatShapeUsingVariousFontSizesTest(fontStore, iTestDataArr[0]->iTypeFaceName, KTelugu1, KTelugu2, KTelugu3); |
|
956 } |
|
957 else if(iScriptName == KTestStep_Gurmukhi) |
|
958 { |
|
959 doRepeatShapeUsingVariousFontSizesTest(fontStore, iTestDataArr[0]->iTypeFaceName, KGurmukhi1, KGurmukhi2, KGurmukhi3); |
|
960 } |
|
961 else if(iScriptName == KTestStep_Malayalam) |
|
962 { |
|
963 doRepeatShapeUsingVariousFontSizesTest(fontStore, iTestDataArr[0]->iTypeFaceName, KMalayalam1, KMalayalam2, KMalayalam3); |
|
964 } |
|
965 |
|
966 CleanupStack::PopAndDestroy(fontStore); |
|
967 REComSession::FinalClose(); //close the ecom session opened by LoadOpenFontLibraries() |
|
968 } |
|
969 |
|
970 TVerdict CShapeTestStep::doTestStepL() |
|
971 { |
|
972 SetTestStepResult(EFail); |
|
973 |
|
974 __UHEAP_MARK; |
|
975 |
|
976 TRAPD(error0, SetupTestDataL()); |
|
977 |
|
978 if(error0 == KErrNone) |
|
979 { |
|
980 TRAPD(error1, ShapeTestL()); |
|
981 |
|
982 if(error1 == KErrNone) |
|
983 { |
|
984 SetTestStepResult(EPass); |
|
985 } |
|
986 } |
|
987 else |
|
988 { |
|
989 ERR_PRINTF1(_L("Failed to setup test data.")); |
|
990 } |
|
991 |
|
992 iTestDataArr.ResetAndDestroy(); // close the iTestDataArr opened by SetupTestData() |
|
993 |
|
994 __UHEAP_MARKEND; |
|
995 |
|
996 return TestStepResult(); |
|
997 } |
|
998 |
|
999 CTestStep * CShapeTestStep::CreateShapeTestStep(const TDesC& aStepName) |
|
1000 { |
|
1001 if(aStepName == KTestStep_Hindi) |
|
1002 { |
|
1003 return new CShapeTestStep(KHindiTestDataIndex, KNumberOfHindiTestDataFiles, KDevanagariScriptCode, KHindiLanguageCode, |
|
1004 aStepName, _L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-3403 ")); |
|
1005 } |
|
1006 else if(aStepName == KTestStep_Kannada) |
|
1007 { |
|
1008 return new CShapeTestStep(KKannadaTestDataIndex, KNumberOfKannadaTestDataFiles, KKannadaScriptCode, KKannadaLanguageCode, |
|
1009 aStepName, _L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-3383-0001")); |
|
1010 } |
|
1011 else if(aStepName == KTestStep_Gujarati) |
|
1012 { |
|
1013 return new CShapeTestStep(KGujaratiTestDataIndex, KNumberOfGujaratiTestDataFiles, KGujaratiScriptCode, KGujaratiLanguageCode, |
|
1014 aStepName, _L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-3383-0002")); |
|
1015 } |
|
1016 else if(aStepName == KTestStep_Bengali) |
|
1017 { |
|
1018 return new CShapeTestStep(KBengaliTestDataIndex, KNumberOfBengaliTestDataFiles, KBengaliScriptCode, KBengaliLanguageCode, |
|
1019 aStepName, _L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-4001")); |
|
1020 } |
|
1021 else if(aStepName == KTestStep_Tamil) |
|
1022 { |
|
1023 return new CShapeTestStep(KTamilTestDataIndex, KNumberOfTamilTestDataFiles, KTamilScriptCode, KTamilLanguageCode, |
|
1024 aStepName, _L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-4002")); |
|
1025 } |
|
1026 else if(aStepName == KTestStep_Telugu) |
|
1027 { |
|
1028 return new CShapeTestStep(KTeluguTestDataIndex, KNumberOfTeluguTestDataFiles, KTeluguScriptCode, KTeluguLanguageCode, |
|
1029 aStepName, _L("GRAPHICS-SYSLIB-ICULAYOUTENGINE-CT-4003")); |
|
1030 } |
|
1031 else if(aStepName == KTestStep_Gurmukhi) |
|
1032 { |
|
1033 return new CShapeTestStep(KGurmukhiTestDataIndex, KNumberOfGurmukhiTestDataFiles, KGurmukhiScriptCode, KGurmukhiLanguageCode, |
|
1034 aStepName, _L("GRAPHICS-TI18N-ICULAYOUTENGINE-CT-4007")); |
|
1035 } |
|
1036 else if(aStepName == KTestStep_Malayalam) |
|
1037 { |
|
1038 return new CShapeTestStep(KMalayalamTestDataIndex, KNumberOfMalayalamTestDataFiles, KMalayalamScriptCode, KMalayalamLanguageCode, |
|
1039 aStepName, _L("GRAPHICS-TI18N-ICULAYOUTENGINE-CT-4007")); |
|
1040 } |
|
1041 return NULL; |
|
1042 } |