|
1 /* |
|
2 * Copyright (c) 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 #include <stdio.h> |
|
19 #include <string> |
|
20 |
|
21 #include "TestHarness.h" |
|
22 |
|
23 #include "s60commonutils.h" |
|
24 |
|
25 using namespace std; |
|
26 using namespace java::util; |
|
27 |
|
28 _LIT(KUnknownResource, "blahblah"); |
|
29 _LIT(KKnownResource, "pimevent.rsc"); |
|
30 _LIT(KKnownLanguageResource, "pimevent.r01"); |
|
31 _LIT(ZResourceDir, "z:\\resource\\"); |
|
32 |
|
33 TEST_GROUP(TestLanguageResource) |
|
34 { |
|
35 TEST_SETUP() |
|
36 { |
|
37 } |
|
38 |
|
39 TEST_TEARDOWN() |
|
40 { |
|
41 } |
|
42 }; |
|
43 |
|
44 /** |
|
45 * Test JavaCommonUtils::ResourceLanguageFileNameL(). |
|
46 * |
|
47 * 1. Null |
|
48 * 2. Unknown resource |
|
49 * 3. Known resource |
|
50 */ |
|
51 TEST(TestLanguageResource, ResourceLanguageFileNameL) |
|
52 { |
|
53 // 1. Null |
|
54 TFileName resource = S60CommonUtils::ResourceLanguageFileNameL(KNullDesC()); |
|
55 resource.LowerCase(); |
|
56 CHECK((resource.Length() == ZResourceDir().Length()) |
|
57 && (resource.Find(ZResourceDir) == 0)); |
|
58 // 2. Unknown resource |
|
59 resource = S60CommonUtils::ResourceLanguageFileNameL(KUnknownResource); |
|
60 resource.LowerCase(); |
|
61 CHECK((resource.Length() == ZResourceDir().Length() + KUnknownResource().Length()) |
|
62 && (resource.Find(ZResourceDir) == 0) |
|
63 && (resource.Find(KUnknownResource) == (resource.Length() - KUnknownResource().Length()))); |
|
64 // 3. Known resource |
|
65 resource = S60CommonUtils::ResourceLanguageFileNameL(KKnownResource); |
|
66 resource.LowerCase(); |
|
67 CHECK((resource.Length() == ZResourceDir().Length() + KKnownLanguageResource().Length()) |
|
68 && (resource.Find(ZResourceDir) == 0) |
|
69 && (resource.Find(KKnownLanguageResource) == (resource.Length() - KKnownLanguageResource().Length()))); |
|
70 } |
|
71 |