sl@0
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <ecom/ecom.h>
|
sl@0
|
17 |
#include "../EcomTestUtils/EcomTestUtils.h"
|
sl@0
|
18 |
|
sl@0
|
19 |
#define UNUSED_VAR(a) a = a
|
sl@0
|
20 |
|
sl@0
|
21 |
LOCAL_D RTest TEST(_L("ECom Language Plugin Test"));
|
sl@0
|
22 |
|
sl@0
|
23 |
// Files to copy
|
sl@0
|
24 |
_LIT(KEComLangPluginDllOnC, "C:\\sys\\bin\\LanguagePlugin.dll");
|
sl@0
|
25 |
_LIT(KEComLangPluginDllOnZ, "Z:\\RAMOnly\\LanguagePlugin.dll");
|
sl@0
|
26 |
|
sl@0
|
27 |
_LIT(KEComLangPluginRscOnC, "C:\\resource\\plugins\\LanguagePlugin.rsc");
|
sl@0
|
28 |
_LIT(KEComLangPluginRscOnZ, "Z:\\RAMOnly\\LanguagePlugin.rsc");
|
sl@0
|
29 |
|
sl@0
|
30 |
_LIT(KEComLangPluginRsc1OnC, "C:\\resource\\plugins\\LanguagePlugin.r01");
|
sl@0
|
31 |
_LIT(KEComLangPluginRsc1OnZ, "Z:\\RAMOnly\\LanguagePlugin.r01");
|
sl@0
|
32 |
|
sl@0
|
33 |
_LIT(KEComLangPluginRsc2OnC, "C:\\resource\\plugins\\LanguagePlugin.r02");
|
sl@0
|
34 |
_LIT(KEComLangPluginRsc2OnZ, "Z:\\RAMOnly\\LanguagePlugin.r02");
|
sl@0
|
35 |
|
sl@0
|
36 |
_LIT(KEComLangPluginRsc3OnC, "C:\\resource\\plugins\\LanguagePlugin.r03");
|
sl@0
|
37 |
_LIT(KEComLangPluginRsc3OnZ, "Z:\\RAMOnly\\LanguagePlugin.r03");
|
sl@0
|
38 |
|
sl@0
|
39 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
40 |
// Language files used for locale settings
|
sl@0
|
41 |
_LIT(KEComEnglishLocale, "elocl.01");
|
sl@0
|
42 |
_LIT(KEComFrenchLocale, "elocl.02");
|
sl@0
|
43 |
_LIT(KEComGermanLocale, "elocl.03");
|
sl@0
|
44 |
_LIT(KEComSpanishLocale, "elocl.04");
|
sl@0
|
45 |
#else
|
sl@0
|
46 |
// refer base/os/kernelhwsrv/kernel/eka/euser/locmapping.cpp
|
sl@0
|
47 |
// Language
|
sl@0
|
48 |
_LIT(KEComEnglishLang,"elocl_lan.001");
|
sl@0
|
49 |
_LIT(KEComFrenchLang,"elocl_lan.002");
|
sl@0
|
50 |
_LIT(KEComGermanLang,"elocl_lan.003");
|
sl@0
|
51 |
_LIT(KEComSpanishLang,"elocl_lan.004");
|
sl@0
|
52 |
// Region
|
sl@0
|
53 |
_LIT(KEComEnglishReg,"elocl_reg.826");
|
sl@0
|
54 |
_LIT(KEComFrenchReg,"elocl_reg.250");
|
sl@0
|
55 |
_LIT(KEComGermanReg,"elocl_reg.276");
|
sl@0
|
56 |
_LIT(KEComSpanishReg,"elocl_reg.724");
|
sl@0
|
57 |
// Collation
|
sl@0
|
58 |
_LIT(KEComEnglishColl,"elocl_col.001");
|
sl@0
|
59 |
_LIT(KEComFrenchColl,"elocl_col.002");
|
sl@0
|
60 |
_LIT(KEComGermanColl,"elocl_col.003");
|
sl@0
|
61 |
_LIT(KEComSpanishColl,"elocl_col.001");
|
sl@0
|
62 |
#endif
|
sl@0
|
63 |
|
sl@0
|
64 |
// Result strings saved in opaque_data of each plugin
|
sl@0
|
65 |
_LIT8(KEComDefaultResult, "LANGUAGE_RSC");
|
sl@0
|
66 |
_LIT8(KEComEnglishResult, "LANGUAGE_01");
|
sl@0
|
67 |
_LIT8(KEComFrenchResult, "LANGUAGE_02");
|
sl@0
|
68 |
_LIT8(KEComGermanResult, "LANGUAGE_03");
|
sl@0
|
69 |
|
sl@0
|
70 |
// Test data for data driven tests.
|
sl@0
|
71 |
#define MAX_LANGUAGE_TEST_FILES 5
|
sl@0
|
72 |
struct TLangTestEntry
|
sl@0
|
73 |
{
|
sl@0
|
74 |
// Source and destination to copy necessary plugins
|
sl@0
|
75 |
struct FilesInfo
|
sl@0
|
76 |
{
|
sl@0
|
77 |
const TDesC* source;
|
sl@0
|
78 |
const TDesC* dest;
|
sl@0
|
79 |
};
|
sl@0
|
80 |
FilesInfo files[MAX_LANGUAGE_TEST_FILES];
|
sl@0
|
81 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
82 |
// Locale file to load
|
sl@0
|
83 |
const TDesC* localeFile;
|
sl@0
|
84 |
#else
|
sl@0
|
85 |
const TDesC* lang;
|
sl@0
|
86 |
const TDesC* region;
|
sl@0
|
87 |
const TDesC* collation;
|
sl@0
|
88 |
#endif
|
sl@0
|
89 |
// Language downgrade path to set up
|
sl@0
|
90 |
TLanguage downgradePathSetup[3];
|
sl@0
|
91 |
|
sl@0
|
92 |
// Expected result - opaque_data of retrieved plugin
|
sl@0
|
93 |
const TDesC8* result;
|
sl@0
|
94 |
};
|
sl@0
|
95 |
|
sl@0
|
96 |
// Test Data
|
sl@0
|
97 |
LOCAL_D const TLangTestEntry LangTestData[] =
|
sl@0
|
98 |
{
|
sl@0
|
99 |
// Data Set 0
|
sl@0
|
100 |
{
|
sl@0
|
101 |
{
|
sl@0
|
102 |
{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
|
sl@0
|
103 |
{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
|
sl@0
|
104 |
{&KEComLangPluginRsc1OnZ, &KEComLangPluginRsc1OnC},
|
sl@0
|
105 |
{&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC},
|
sl@0
|
106 |
{&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC}
|
sl@0
|
107 |
},
|
sl@0
|
108 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
109 |
&KEComEnglishLocale,
|
sl@0
|
110 |
#else
|
sl@0
|
111 |
&KEComEnglishLang,
|
sl@0
|
112 |
&KEComEnglishReg,
|
sl@0
|
113 |
&KEComEnglishColl,
|
sl@0
|
114 |
#endif
|
sl@0
|
115 |
{ELangEnglish, ELangFrench, ELangGerman},
|
sl@0
|
116 |
&KEComEnglishResult
|
sl@0
|
117 |
},
|
sl@0
|
118 |
// Data Set 1
|
sl@0
|
119 |
{
|
sl@0
|
120 |
{
|
sl@0
|
121 |
{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
|
sl@0
|
122 |
{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
|
sl@0
|
123 |
{&KEComLangPluginRsc1OnZ, &KEComLangPluginRsc1OnC},
|
sl@0
|
124 |
{&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC},
|
sl@0
|
125 |
{&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC}
|
sl@0
|
126 |
},
|
sl@0
|
127 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
128 |
&KEComFrenchLocale,
|
sl@0
|
129 |
#else
|
sl@0
|
130 |
&KEComFrenchLang,
|
sl@0
|
131 |
&KEComFrenchReg,
|
sl@0
|
132 |
&KEComFrenchColl,
|
sl@0
|
133 |
#endif
|
sl@0
|
134 |
{ELangFrench, ELangEnglish, ELangGerman},
|
sl@0
|
135 |
&KEComFrenchResult
|
sl@0
|
136 |
},
|
sl@0
|
137 |
// Data Set 2
|
sl@0
|
138 |
{
|
sl@0
|
139 |
{
|
sl@0
|
140 |
{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
|
sl@0
|
141 |
{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
|
sl@0
|
142 |
{&KEComLangPluginRsc1OnZ, &KEComLangPluginRsc1OnC},
|
sl@0
|
143 |
{&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC},
|
sl@0
|
144 |
{&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC}
|
sl@0
|
145 |
},
|
sl@0
|
146 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
147 |
&KEComGermanLocale,
|
sl@0
|
148 |
#else
|
sl@0
|
149 |
&KEComGermanLang,
|
sl@0
|
150 |
&KEComGermanReg,
|
sl@0
|
151 |
&KEComGermanColl,
|
sl@0
|
152 |
#endif
|
sl@0
|
153 |
{ELangGerman, ELangEnglish, ELangFrench},
|
sl@0
|
154 |
&KEComGermanResult
|
sl@0
|
155 |
},
|
sl@0
|
156 |
// Data Set 3
|
sl@0
|
157 |
{
|
sl@0
|
158 |
{
|
sl@0
|
159 |
{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
|
sl@0
|
160 |
{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
|
sl@0
|
161 |
{&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC},
|
sl@0
|
162 |
{&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC}
|
sl@0
|
163 |
},
|
sl@0
|
164 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
165 |
&KEComFrenchLocale,
|
sl@0
|
166 |
#else
|
sl@0
|
167 |
&KEComFrenchLang,
|
sl@0
|
168 |
&KEComFrenchReg,
|
sl@0
|
169 |
&KEComFrenchColl,
|
sl@0
|
170 |
#endif
|
sl@0
|
171 |
{ELangEnglish, ELangFrench, ELangGerman},
|
sl@0
|
172 |
&KEComFrenchResult
|
sl@0
|
173 |
},
|
sl@0
|
174 |
// Data Set 4
|
sl@0
|
175 |
{
|
sl@0
|
176 |
{
|
sl@0
|
177 |
{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
|
sl@0
|
178 |
{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
|
sl@0
|
179 |
{&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC}
|
sl@0
|
180 |
},
|
sl@0
|
181 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
182 |
&KEComGermanLocale,
|
sl@0
|
183 |
#else
|
sl@0
|
184 |
&KEComGermanLang,
|
sl@0
|
185 |
&KEComGermanReg,
|
sl@0
|
186 |
&KEComGermanColl,
|
sl@0
|
187 |
#endif
|
sl@0
|
188 |
{ELangEnglish, ELangFrench, ELangGerman},
|
sl@0
|
189 |
&KEComGermanResult
|
sl@0
|
190 |
},
|
sl@0
|
191 |
// Data Set 5
|
sl@0
|
192 |
{
|
sl@0
|
193 |
{
|
sl@0
|
194 |
{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
|
sl@0
|
195 |
{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
|
sl@0
|
196 |
{&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC},
|
sl@0
|
197 |
{&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC}
|
sl@0
|
198 |
},
|
sl@0
|
199 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
200 |
&KEComGermanLocale,
|
sl@0
|
201 |
#else
|
sl@0
|
202 |
&KEComGermanLang,
|
sl@0
|
203 |
&KEComGermanReg,
|
sl@0
|
204 |
&KEComGermanColl,
|
sl@0
|
205 |
#endif
|
sl@0
|
206 |
{ELangSpanish, ELangItalian, ELangGerman},
|
sl@0
|
207 |
&KEComGermanResult
|
sl@0
|
208 |
},
|
sl@0
|
209 |
// Data Set 6
|
sl@0
|
210 |
{
|
sl@0
|
211 |
{
|
sl@0
|
212 |
{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
|
sl@0
|
213 |
{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
|
sl@0
|
214 |
{&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC},
|
sl@0
|
215 |
{&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC}
|
sl@0
|
216 |
},
|
sl@0
|
217 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
218 |
&KEComEnglishLocale,
|
sl@0
|
219 |
#else
|
sl@0
|
220 |
&KEComEnglishLang,
|
sl@0
|
221 |
&KEComEnglishReg,
|
sl@0
|
222 |
&KEComEnglishColl,
|
sl@0
|
223 |
#endif
|
sl@0
|
224 |
{ELangSpanish, ELangItalian, ELangSwedish},
|
sl@0
|
225 |
&KEComDefaultResult
|
sl@0
|
226 |
},
|
sl@0
|
227 |
// Data Set 7
|
sl@0
|
228 |
{
|
sl@0
|
229 |
{
|
sl@0
|
230 |
{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
|
sl@0
|
231 |
{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
|
sl@0
|
232 |
{&KEComLangPluginRsc1OnZ, &KEComLangPluginRsc1OnC},
|
sl@0
|
233 |
},
|
sl@0
|
234 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
235 |
&KEComEnglishLocale,
|
sl@0
|
236 |
#else
|
sl@0
|
237 |
&KEComEnglishLang,
|
sl@0
|
238 |
&KEComEnglishReg,
|
sl@0
|
239 |
&KEComEnglishColl,
|
sl@0
|
240 |
#endif
|
sl@0
|
241 |
{ELangSpanish, ELangSwedish, ELangItalian},
|
sl@0
|
242 |
&KEComEnglishResult
|
sl@0
|
243 |
},
|
sl@0
|
244 |
// Data Set 8
|
sl@0
|
245 |
{
|
sl@0
|
246 |
{
|
sl@0
|
247 |
{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
|
sl@0
|
248 |
{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
|
sl@0
|
249 |
},
|
sl@0
|
250 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
251 |
&KEComEnglishLocale,
|
sl@0
|
252 |
#else
|
sl@0
|
253 |
&KEComEnglishLang,
|
sl@0
|
254 |
&KEComEnglishReg,
|
sl@0
|
255 |
&KEComEnglishColl,
|
sl@0
|
256 |
#endif
|
sl@0
|
257 |
{ELangItalian, ELangSwedish, ELangSpanish},
|
sl@0
|
258 |
&KEComDefaultResult
|
sl@0
|
259 |
},
|
sl@0
|
260 |
};
|
sl@0
|
261 |
|
sl@0
|
262 |
struct TLangTestEntry2
|
sl@0
|
263 |
{
|
sl@0
|
264 |
// Locale file to load
|
sl@0
|
265 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
266 |
// Locale file to load
|
sl@0
|
267 |
const TDesC* localeFile;
|
sl@0
|
268 |
#else
|
sl@0
|
269 |
const TDesC* lang;
|
sl@0
|
270 |
const TDesC* region;
|
sl@0
|
271 |
const TDesC* collation;
|
sl@0
|
272 |
#endif
|
sl@0
|
273 |
|
sl@0
|
274 |
// Language downgrade path to set up
|
sl@0
|
275 |
TLanguage downgradePathSetup[3];
|
sl@0
|
276 |
|
sl@0
|
277 |
// Expected result - opaque_data of retrieved plugin
|
sl@0
|
278 |
const TDesC8* result;
|
sl@0
|
279 |
};
|
sl@0
|
280 |
|
sl@0
|
281 |
LOCAL_D const TLangTestEntry2 LangTestData2[] =
|
sl@0
|
282 |
{
|
sl@0
|
283 |
//Data Set 0
|
sl@0
|
284 |
{
|
sl@0
|
285 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
286 |
&KEComEnglishLocale,
|
sl@0
|
287 |
#else
|
sl@0
|
288 |
&KEComEnglishLang,
|
sl@0
|
289 |
&KEComEnglishReg,
|
sl@0
|
290 |
&KEComEnglishColl,
|
sl@0
|
291 |
#endif
|
sl@0
|
292 |
{ELangEnglish, ELangFrench, ELangGerman},
|
sl@0
|
293 |
&KEComEnglishResult
|
sl@0
|
294 |
|
sl@0
|
295 |
},
|
sl@0
|
296 |
|
sl@0
|
297 |
//Data Set 1
|
sl@0
|
298 |
{
|
sl@0
|
299 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
300 |
&KEComFrenchLocale,
|
sl@0
|
301 |
#else
|
sl@0
|
302 |
&KEComFrenchLang,
|
sl@0
|
303 |
&KEComFrenchReg,
|
sl@0
|
304 |
&KEComFrenchColl,
|
sl@0
|
305 |
#endif
|
sl@0
|
306 |
{ELangFrench, ELangEnglish, ELangGerman},
|
sl@0
|
307 |
&KEComFrenchResult
|
sl@0
|
308 |
},
|
sl@0
|
309 |
//Data Set 2
|
sl@0
|
310 |
{
|
sl@0
|
311 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
312 |
&KEComGermanLocale,
|
sl@0
|
313 |
#else
|
sl@0
|
314 |
&KEComGermanLang,
|
sl@0
|
315 |
&KEComGermanReg,
|
sl@0
|
316 |
&KEComGermanColl,
|
sl@0
|
317 |
#endif
|
sl@0
|
318 |
{ELangGerman, ELangEnglish, ELangFrench},
|
sl@0
|
319 |
&KEComGermanResult
|
sl@0
|
320 |
},
|
sl@0
|
321 |
//Data Set 3
|
sl@0
|
322 |
{
|
sl@0
|
323 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
324 |
&KEComFrenchLocale,
|
sl@0
|
325 |
#else
|
sl@0
|
326 |
&KEComFrenchLang,
|
sl@0
|
327 |
&KEComFrenchReg,
|
sl@0
|
328 |
&KEComFrenchColl,
|
sl@0
|
329 |
#endif
|
sl@0
|
330 |
{ELangEnglish, ELangFrench, ELangGerman},
|
sl@0
|
331 |
&KEComFrenchResult
|
sl@0
|
332 |
},
|
sl@0
|
333 |
//Data Set 4
|
sl@0
|
334 |
{
|
sl@0
|
335 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
336 |
&KEComGermanLocale,
|
sl@0
|
337 |
#else
|
sl@0
|
338 |
&KEComGermanLang,
|
sl@0
|
339 |
&KEComGermanReg,
|
sl@0
|
340 |
&KEComGermanColl,
|
sl@0
|
341 |
#endif
|
sl@0
|
342 |
{ELangEnglish, ELangFrench, ELangGerman},
|
sl@0
|
343 |
&KEComGermanResult
|
sl@0
|
344 |
},
|
sl@0
|
345 |
//Data Set 5
|
sl@0
|
346 |
{
|
sl@0
|
347 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
348 |
&KEComGermanLocale,
|
sl@0
|
349 |
#else
|
sl@0
|
350 |
&KEComGermanLang,
|
sl@0
|
351 |
&KEComGermanReg,
|
sl@0
|
352 |
&KEComGermanColl,
|
sl@0
|
353 |
#endif
|
sl@0
|
354 |
{ELangSpanish, ELangItalian, ELangGerman},
|
sl@0
|
355 |
&KEComGermanResult
|
sl@0
|
356 |
},
|
sl@0
|
357 |
//Data Set 6
|
sl@0
|
358 |
{
|
sl@0
|
359 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
360 |
&KEComEnglishLocale,
|
sl@0
|
361 |
#else
|
sl@0
|
362 |
&KEComEnglishLang,
|
sl@0
|
363 |
&KEComEnglishReg,
|
sl@0
|
364 |
&KEComEnglishColl,
|
sl@0
|
365 |
#endif
|
sl@0
|
366 |
{ELangSpanish, ELangItalian, ELangSwedish},
|
sl@0
|
367 |
&KEComEnglishResult
|
sl@0
|
368 |
|
sl@0
|
369 |
},
|
sl@0
|
370 |
//Data Set 7
|
sl@0
|
371 |
{
|
sl@0
|
372 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
373 |
&KEComSpanishLocale,
|
sl@0
|
374 |
#else
|
sl@0
|
375 |
&KEComSpanishLang,
|
sl@0
|
376 |
&KEComSpanishReg,
|
sl@0
|
377 |
&KEComSpanishColl,
|
sl@0
|
378 |
#endif
|
sl@0
|
379 |
{ELangSpanish, ELangFrench, ELangEnglish},
|
sl@0
|
380 |
&KEComFrenchResult
|
sl@0
|
381 |
|
sl@0
|
382 |
},
|
sl@0
|
383 |
//Data Set 8
|
sl@0
|
384 |
{
|
sl@0
|
385 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
386 |
&KEComSpanishLocale,
|
sl@0
|
387 |
#else
|
sl@0
|
388 |
&KEComSpanishLang,
|
sl@0
|
389 |
&KEComSpanishReg,
|
sl@0
|
390 |
&KEComSpanishColl,
|
sl@0
|
391 |
#endif
|
sl@0
|
392 |
{ELangSpanish,ELangItalian, ELangSwedish},
|
sl@0
|
393 |
&KEComDefaultResult
|
sl@0
|
394 |
},
|
sl@0
|
395 |
|
sl@0
|
396 |
//Data Set 9
|
sl@0
|
397 |
{
|
sl@0
|
398 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
399 |
&KEComSpanishLocale,
|
sl@0
|
400 |
#else
|
sl@0
|
401 |
&KEComSpanishLang,
|
sl@0
|
402 |
&KEComSpanishReg,
|
sl@0
|
403 |
&KEComSpanishColl,
|
sl@0
|
404 |
#endif
|
sl@0
|
405 |
{ELangSpanish, ELangGerman, ELangItalian},
|
sl@0
|
406 |
&KEComGermanResult
|
sl@0
|
407 |
},
|
sl@0
|
408 |
|
sl@0
|
409 |
//Data Set 10
|
sl@0
|
410 |
{
|
sl@0
|
411 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
412 |
&KEComSpanishLocale,
|
sl@0
|
413 |
#else
|
sl@0
|
414 |
&KEComSpanishLang,
|
sl@0
|
415 |
&KEComSpanishReg,
|
sl@0
|
416 |
&KEComSpanishColl,
|
sl@0
|
417 |
#endif
|
sl@0
|
418 |
{ELangSpanish, ELangItalian, ELangNone},
|
sl@0
|
419 |
&KEComDefaultResult
|
sl@0
|
420 |
}
|
sl@0
|
421 |
};
|
sl@0
|
422 |
|
sl@0
|
423 |
class REComLanguagePluginTest
|
sl@0
|
424 |
{
|
sl@0
|
425 |
public:
|
sl@0
|
426 |
void StaticRunTestsL();
|
sl@0
|
427 |
void DynamicRunTestsOnCL();
|
sl@0
|
428 |
void DynamicRunTestsOnZL();
|
sl@0
|
429 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
430 |
void SetLanguage(const TDesC& aLangFile, const TLanguage aLang[3]);
|
sl@0
|
431 |
#else
|
sl@0
|
432 |
void SetLanguage(const TDesC& aLanguage,const TDesC& aReg,const TDesC& aColl,const TLanguage aLang[3]);
|
sl@0
|
433 |
#endif
|
sl@0
|
434 |
void CopyFiles(TInt aIndex);
|
sl@0
|
435 |
static void DeleteFiles(TInt aIndex);
|
sl@0
|
436 |
void DoCheckL(TInt testDataId, TUid &aInterfaceId, TDriveUnit aDriveUnit);
|
sl@0
|
437 |
};
|
sl@0
|
438 |
|
sl@0
|
439 |
/**
|
sl@0
|
440 |
Copies plugins.
|
sl@0
|
441 |
*/
|
sl@0
|
442 |
void REComLanguagePluginTest::CopyFiles(TInt aIndex)
|
sl@0
|
443 |
{
|
sl@0
|
444 |
for (TInt i = 0; i < MAX_LANGUAGE_TEST_FILES && LangTestData[aIndex].files[i].source; i++)
|
sl@0
|
445 |
{
|
sl@0
|
446 |
TRAPD(err, EComTestUtils::FileManCopyFileL( *(LangTestData[aIndex].files[i].source),
|
sl@0
|
447 |
*(LangTestData[aIndex].files[i].dest)) );
|
sl@0
|
448 |
TEST(err==KErrNone, __LINE__);
|
sl@0
|
449 |
}
|
sl@0
|
450 |
}
|
sl@0
|
451 |
|
sl@0
|
452 |
/**
|
sl@0
|
453 |
Deletes plugins.
|
sl@0
|
454 |
*/
|
sl@0
|
455 |
void REComLanguagePluginTest::DeleteFiles(TInt aIndex)
|
sl@0
|
456 |
{
|
sl@0
|
457 |
for (TInt i = 0; i < MAX_LANGUAGE_TEST_FILES && LangTestData[aIndex].files[i].source != NULL; i++)
|
sl@0
|
458 |
{
|
sl@0
|
459 |
TRAPD(err, EComTestUtils::FileManDeleteFileL(*(LangTestData[aIndex].files[i].dest)) );
|
sl@0
|
460 |
UNUSED_VAR(err);
|
sl@0
|
461 |
}
|
sl@0
|
462 |
}
|
sl@0
|
463 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
464 |
/**
|
sl@0
|
465 |
Sets up the system-wide locale and language downgrade path.
|
sl@0
|
466 |
*/
|
sl@0
|
467 |
void REComLanguagePluginTest::SetLanguage(const TDesC& aLangFile, const TLanguage aLang[3])
|
sl@0
|
468 |
{
|
sl@0
|
469 |
TLocale locale;
|
sl@0
|
470 |
TInt loadval = 0;
|
sl@0
|
471 |
TExtendedLocale extendedLocale;
|
sl@0
|
472 |
|
sl@0
|
473 |
extendedLocale.LoadSystemSettings();
|
sl@0
|
474 |
loadval = extendedLocale.LoadLocale(aLangFile);
|
sl@0
|
475 |
TEST(loadval==KErrNone, __LINE__);
|
sl@0
|
476 |
extendedLocale.SaveSystemSettings();
|
sl@0
|
477 |
|
sl@0
|
478 |
locale.SetLanguageDowngrade(0, aLang[0]);
|
sl@0
|
479 |
locale.SetLanguageDowngrade(1, aLang[1]);
|
sl@0
|
480 |
locale.SetLanguageDowngrade(2, aLang[2]);
|
sl@0
|
481 |
locale.Set();
|
sl@0
|
482 |
}
|
sl@0
|
483 |
#else
|
sl@0
|
484 |
/**
|
sl@0
|
485 |
Sets up the system-wide locale and language downgrade path for the new locale model.
|
sl@0
|
486 |
*/
|
sl@0
|
487 |
void REComLanguagePluginTest::SetLanguage(const TDesC& aLanguage,const TDesC& aReg,const TDesC& aColl,const TLanguage aLang[3])
|
sl@0
|
488 |
{
|
sl@0
|
489 |
TLocale locale;
|
sl@0
|
490 |
TExtendedLocale extendedLocale;
|
sl@0
|
491 |
TInt loadval = 0;
|
sl@0
|
492 |
|
sl@0
|
493 |
extendedLocale.LoadSystemSettings();
|
sl@0
|
494 |
loadval = extendedLocale.LoadLocale(aLanguage,aReg,aColl);
|
sl@0
|
495 |
TEST(loadval==KErrNone, __LINE__);
|
sl@0
|
496 |
extendedLocale.SaveSystemSettings();
|
sl@0
|
497 |
|
sl@0
|
498 |
locale.SetLanguageDowngrade(0, aLang[0]);
|
sl@0
|
499 |
locale.SetLanguageDowngrade(1, aLang[1]);
|
sl@0
|
500 |
locale.SetLanguageDowngrade(2, aLang[2]);
|
sl@0
|
501 |
locale.Set();
|
sl@0
|
502 |
}
|
sl@0
|
503 |
#endif
|
sl@0
|
504 |
|
sl@0
|
505 |
void REComLanguagePluginTest::DoCheckL(TInt testDataId, TUid &aInterfaceId, TDriveUnit aDriveUnit)
|
sl@0
|
506 |
{
|
sl@0
|
507 |
RImplInfoPtrArray implArray;
|
sl@0
|
508 |
|
sl@0
|
509 |
REComSession::ListImplementationsL(aInterfaceId, implArray);
|
sl@0
|
510 |
|
sl@0
|
511 |
// Verify results
|
sl@0
|
512 |
TBuf<100> buf;
|
sl@0
|
513 |
RDebug::Print(_L("\tArray Count = %d\n"), implArray.Count());
|
sl@0
|
514 |
buf.Copy(implArray[0]->OpaqueData());
|
sl@0
|
515 |
RDebug::Print(_L("\tOpaque Data = %S\n"), &buf);
|
sl@0
|
516 |
TInt drive = implArray[0]->Drive();
|
sl@0
|
517 |
RDebug::Print(_L("\tDrive = %d\n"), drive);
|
sl@0
|
518 |
|
sl@0
|
519 |
TEST(implArray.Count() == 1);
|
sl@0
|
520 |
|
sl@0
|
521 |
if(aDriveUnit == EDriveZ)
|
sl@0
|
522 |
{
|
sl@0
|
523 |
TEST(implArray[0]->OpaqueData() == *(LangTestData2[testDataId].result));
|
sl@0
|
524 |
}
|
sl@0
|
525 |
else
|
sl@0
|
526 |
{
|
sl@0
|
527 |
TEST(implArray[0]->OpaqueData() == *(LangTestData[testDataId].result));
|
sl@0
|
528 |
}
|
sl@0
|
529 |
|
sl@0
|
530 |
TEST(implArray[0]->Drive() == aDriveUnit);
|
sl@0
|
531 |
|
sl@0
|
532 |
// Post test clean up
|
sl@0
|
533 |
REComSession::FinalClose();
|
sl@0
|
534 |
implArray.ResetAndDestroy();
|
sl@0
|
535 |
}
|
sl@0
|
536 |
|
sl@0
|
537 |
/**
|
sl@0
|
538 |
Test case for DEF087773: ECOM ValidateRegistry checks for existence of RSC file only
|
sl@0
|
539 |
|
sl@0
|
540 |
@SYMTestCaseID SYSLIB-ECOM-CT-0655
|
sl@0
|
541 |
@SYMTestCaseDesc Checks for existence of resource files for different downgrade paths
|
sl@0
|
542 |
@SYMTestPriority high
|
sl@0
|
543 |
@SYMTestActions Data driven tests.
|
sl@0
|
544 |
Create different sets of language dependant resource file on "C"
|
sl@0
|
545 |
Drive and verify the ECom discovery process
|
sl@0
|
546 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
547 |
@SYMDEF DEF087773
|
sl@0
|
548 |
*/
|
sl@0
|
549 |
void REComLanguagePluginTest::StaticRunTestsL()
|
sl@0
|
550 |
{
|
sl@0
|
551 |
TEST.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0655 "));
|
sl@0
|
552 |
TInt numberOfElements = sizeof(LangTestData)/sizeof(TLangTestEntry);
|
sl@0
|
553 |
|
sl@0
|
554 |
TUid ifUid={0x10009DB9};
|
sl@0
|
555 |
for(TInt i = 0; i < numberOfElements; i++)
|
sl@0
|
556 |
{
|
sl@0
|
557 |
// kill ecom server so that language downgrade changes are picked up
|
sl@0
|
558 |
ECOMTU_KILL_SERVER_L(TEST);
|
sl@0
|
559 |
|
sl@0
|
560 |
// Prepare test
|
sl@0
|
561 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
562 |
SetLanguage(*(LangTestData[i].localeFile), LangTestData[i].downgradePathSetup);
|
sl@0
|
563 |
#else
|
sl@0
|
564 |
SetLanguage(*(LangTestData[i].lang),*(LangTestData[i].region),*(LangTestData[i].collation),LangTestData[i].downgradePathSetup);
|
sl@0
|
565 |
#endif
|
sl@0
|
566 |
|
sl@0
|
567 |
CopyFiles(i);
|
sl@0
|
568 |
|
sl@0
|
569 |
// 1st boot
|
sl@0
|
570 |
TEST.Printf(_L("\tLanguage Plugin Test %d - 1st boot \n"), i);
|
sl@0
|
571 |
DoCheckL(i,ifUid, EDriveC );
|
sl@0
|
572 |
|
sl@0
|
573 |
// kill ecom server for second boot
|
sl@0
|
574 |
ECOMTU_KILL_SERVER_L(TEST);
|
sl@0
|
575 |
|
sl@0
|
576 |
// 2nd boot
|
sl@0
|
577 |
TEST.Printf(_L("\tLanguage Plugin Test %d - 2nd boot \n"), i);
|
sl@0
|
578 |
DoCheckL(i, ifUid, EDriveC);
|
sl@0
|
579 |
|
sl@0
|
580 |
DeleteFiles(i);
|
sl@0
|
581 |
WAIT_FOR3s;
|
sl@0
|
582 |
}
|
sl@0
|
583 |
}
|
sl@0
|
584 |
|
sl@0
|
585 |
/**
|
sl@0
|
586 |
Test case for CR0209: Enable Dynamic Language Switching in ECOM
|
sl@0
|
587 |
|
sl@0
|
588 |
@SYMTestCaseID SYSLIB-ECOM-CT-3169
|
sl@0
|
589 |
@SYMTestCaseDesc Checks for picking up correct resource files for different downgrade paths in running time
|
sl@0
|
590 |
@SYMTestPriority high
|
sl@0
|
591 |
@SYMTestActions Data driven tests.
|
sl@0
|
592 |
Start up Ecom server
|
sl@0
|
593 |
Create different sets of language dependant resource file on "C" on running time.
|
sl@0
|
594 |
Drive and verify the ECom discovery process
|
sl@0
|
595 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
596 |
@SYMDEF CR0209
|
sl@0
|
597 |
*/
|
sl@0
|
598 |
void REComLanguagePluginTest::DynamicRunTestsOnCL()
|
sl@0
|
599 |
{
|
sl@0
|
600 |
TEST.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-3169 "));
|
sl@0
|
601 |
TInt numberOfElements = sizeof(LangTestData)/sizeof(TLangTestEntry);
|
sl@0
|
602 |
|
sl@0
|
603 |
RImplInfoPtrArray implArray;
|
sl@0
|
604 |
TUid ifUid={0x10009DB9};
|
sl@0
|
605 |
|
sl@0
|
606 |
//start up ecom server
|
sl@0
|
607 |
REComSession::ListImplementationsL(ifUid, implArray);
|
sl@0
|
608 |
|
sl@0
|
609 |
for(TInt i = 0; i < numberOfElements; i++)
|
sl@0
|
610 |
{
|
sl@0
|
611 |
|
sl@0
|
612 |
// Prepare test
|
sl@0
|
613 |
CopyFiles(i);
|
sl@0
|
614 |
|
sl@0
|
615 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
616 |
SetLanguage(*(LangTestData[i].localeFile), LangTestData[i].downgradePathSetup);
|
sl@0
|
617 |
#else
|
sl@0
|
618 |
SetLanguage(*(LangTestData[i].lang),*(LangTestData[i].region),*(LangTestData[i].collation),LangTestData[i].downgradePathSetup);
|
sl@0
|
619 |
#endif
|
sl@0
|
620 |
WAIT_FOR3s;
|
sl@0
|
621 |
|
sl@0
|
622 |
TEST.Printf(_L("\tLanguage Plugin Test %d - Dynamic switch on C \n"), i);
|
sl@0
|
623 |
DoCheckL(i,ifUid, EDriveC);
|
sl@0
|
624 |
|
sl@0
|
625 |
DeleteFiles(i);
|
sl@0
|
626 |
WAIT_FOR3s;
|
sl@0
|
627 |
implArray.ResetAndDestroy();
|
sl@0
|
628 |
|
sl@0
|
629 |
}
|
sl@0
|
630 |
|
sl@0
|
631 |
// Post test clean up
|
sl@0
|
632 |
REComSession::FinalClose();
|
sl@0
|
633 |
implArray.ResetAndDestroy();
|
sl@0
|
634 |
|
sl@0
|
635 |
//kill ecomserver after finishing test
|
sl@0
|
636 |
ECOMTU_KILL_SERVER_L(TEST);
|
sl@0
|
637 |
|
sl@0
|
638 |
}
|
sl@0
|
639 |
|
sl@0
|
640 |
/**
|
sl@0
|
641 |
Test case for CR0209: Enable Dynamic Language Switching in ECOM on Z: drive
|
sl@0
|
642 |
|
sl@0
|
643 |
@SYMTestCaseID SYSLIB-ECOM-CT-3170
|
sl@0
|
644 |
@SYMTestCaseDesc Checks for picking up correct resource files for different downgrade paths in running time.
|
sl@0
|
645 |
@SYMTestPriority high
|
sl@0
|
646 |
@SYMTestActions Data driven tests.
|
sl@0
|
647 |
Start up Ecom server
|
sl@0
|
648 |
Change languae downgrade path on running time.
|
sl@0
|
649 |
Drive and verify the ECom discovery process.
|
sl@0
|
650 |
@SYMTestExpectedResults The test must not fail.
|
sl@0
|
651 |
@SYMDEF CR0209
|
sl@0
|
652 |
*/
|
sl@0
|
653 |
void REComLanguagePluginTest::DynamicRunTestsOnZL()
|
sl@0
|
654 |
{
|
sl@0
|
655 |
TEST.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-3170 "));
|
sl@0
|
656 |
TInt numberOfElements = sizeof(LangTestData2)/sizeof(TLangTestEntry2);
|
sl@0
|
657 |
|
sl@0
|
658 |
//Interface ID in a DLL existing on Z: Drive
|
sl@0
|
659 |
TUid ifUid={0x10009DE1};
|
sl@0
|
660 |
|
sl@0
|
661 |
//start up ecom server
|
sl@0
|
662 |
RImplInfoPtrArray implArray;
|
sl@0
|
663 |
REComSession::ListImplementationsL(ifUid, implArray);
|
sl@0
|
664 |
WAIT_FOR3s;
|
sl@0
|
665 |
|
sl@0
|
666 |
for(TInt i = 0; i < numberOfElements; i++)
|
sl@0
|
667 |
{
|
sl@0
|
668 |
|
sl@0
|
669 |
// Prepare test
|
sl@0
|
670 |
#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
671 |
SetLanguage(*(LangTestData2[i].localeFile), LangTestData2[i].downgradePathSetup);
|
sl@0
|
672 |
#else
|
sl@0
|
673 |
SetLanguage(*(LangTestData2[i].lang),*(LangTestData2[i].region),*(LangTestData2[i].collation),LangTestData2[i].downgradePathSetup);
|
sl@0
|
674 |
#endif
|
sl@0
|
675 |
WAIT_FOR3s;
|
sl@0
|
676 |
|
sl@0
|
677 |
// Dynamic language downgrade path changing
|
sl@0
|
678 |
TEST.Printf(_L("\tLanguage Plugin Test %d - Dynamic switch on Z \n"), i);
|
sl@0
|
679 |
DoCheckL(i,ifUid, EDriveZ);
|
sl@0
|
680 |
implArray.ResetAndDestroy();
|
sl@0
|
681 |
|
sl@0
|
682 |
}
|
sl@0
|
683 |
|
sl@0
|
684 |
// Post test clean up
|
sl@0
|
685 |
REComSession::FinalClose();
|
sl@0
|
686 |
implArray.ResetAndDestroy();
|
sl@0
|
687 |
|
sl@0
|
688 |
}
|
sl@0
|
689 |
|
sl@0
|
690 |
LOCAL_C void RunTestL()
|
sl@0
|
691 |
{
|
sl@0
|
692 |
__UHEAP_MARK;
|
sl@0
|
693 |
REComLanguagePluginTest testSuite;
|
sl@0
|
694 |
testSuite.StaticRunTestsL();
|
sl@0
|
695 |
testSuite.DynamicRunTestsOnCL();
|
sl@0
|
696 |
testSuite.DynamicRunTestsOnZL();
|
sl@0
|
697 |
|
sl@0
|
698 |
__UHEAP_MARKEND;
|
sl@0
|
699 |
}
|
sl@0
|
700 |
|
sl@0
|
701 |
GLDEF_C TInt E32Main()
|
sl@0
|
702 |
{
|
sl@0
|
703 |
__UHEAP_MARK;
|
sl@0
|
704 |
|
sl@0
|
705 |
TEST.Title();
|
sl@0
|
706 |
TEST.Start(_L("ECom Language Plugins tests."));
|
sl@0
|
707 |
|
sl@0
|
708 |
CTrapCleanup* cleanup = CTrapCleanup::New();
|
sl@0
|
709 |
CActiveScheduler* scheduler = new(ELeave)CActiveScheduler;
|
sl@0
|
710 |
CActiveScheduler::Install(scheduler);
|
sl@0
|
711 |
|
sl@0
|
712 |
TRAPD(err,RunTestL());
|
sl@0
|
713 |
|
sl@0
|
714 |
// tidy up in case of leave
|
sl@0
|
715 |
if(err != KErrNone)
|
sl@0
|
716 |
{
|
sl@0
|
717 |
TInt numberOfElements = sizeof(LangTestData)/sizeof(TLangTestEntry);
|
sl@0
|
718 |
for(TInt i = 0; i < numberOfElements; i++)
|
sl@0
|
719 |
{
|
sl@0
|
720 |
REComLanguagePluginTest::DeleteFiles(i);
|
sl@0
|
721 |
}
|
sl@0
|
722 |
}
|
sl@0
|
723 |
|
sl@0
|
724 |
TEST(err==KErrNone, __LINE__);
|
sl@0
|
725 |
|
sl@0
|
726 |
delete scheduler;
|
sl@0
|
727 |
delete cleanup;
|
sl@0
|
728 |
|
sl@0
|
729 |
TEST.End();
|
sl@0
|
730 |
TEST.Close();
|
sl@0
|
731 |
|
sl@0
|
732 |
__UHEAP_MARKEND;
|
sl@0
|
733 |
return(0);
|
sl@0
|
734 |
}
|