|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 // |
|
16 // |
|
17 |
|
18 |
|
19 #include <f32file.h> |
|
20 #include <e32test.h> |
|
21 #include <hal.h> |
|
22 #include "t_server.h" |
|
23 #include "f32dbg.h" |
|
24 |
|
25 |
|
26 GLDEF_D RTest test(_L("T_CP_PLUGIN")); |
|
27 |
|
28 // function decalarations |
|
29 void DoCodePagePluginTest(); |
|
30 void TestUnicodeVolumeLabel(); |
|
31 void TestShortNameBoundary(); |
|
32 void TestConsistentShortNameGeneration(); |
|
33 void TestConsistentShortNameExtGeneration(); |
|
34 void TestDuplicateLongFileNames(); |
|
35 void TestDuplicateLongDirNames(); |
|
36 void TestLeadingE5Handling(); |
|
37 void TestDEF130334(); |
|
38 void TestINC127905(); |
|
39 void DeleteTestDirectory(); |
|
40 void TestCompatibility(); |
|
41 void TestINC126563(); |
|
42 |
|
43 // Codepage dll name |
|
44 _LIT(KCP932Name,"T_CP932"); |
|
45 |
|
46 TInt LoadCodePageDll(const TDesC& aCodePageDllName) |
|
47 { |
|
48 RDebug::Printf("++ T_CP_PLUGIN.CPP LoadCodePageDll"); |
|
49 |
|
50 TInt err = KErrNone; |
|
51 if(aCodePageDllName.Length()) |
|
52 { |
|
53 RDebug::Print(_L("IS: codepageDllName = %S"), &aCodePageDllName); |
|
54 RLoader loader; |
|
55 err = loader.Connect(); |
|
56 if (err==KErrNone) |
|
57 { |
|
58 err = loader.SendReceive(ELoadCodePage, TIpcArgs(0, &aCodePageDllName, 0)); |
|
59 RDebug::Printf("\n T_CP_PLUGIN.CPP : LoadCodePageDll : loader.SendReceive == %d", err); |
|
60 loader.Close(); |
|
61 } |
|
62 } |
|
63 RDebug::Printf("-- T_CP_PLUGIN.CPP LoadCodePageDll"); |
|
64 return err; |
|
65 } |
|
66 |
|
67 void DoCodePagePluginTest() |
|
68 { |
|
69 RDebug::Printf("++ T_CP_PLUGIN.CPP DoCodePagePluginTestL"); |
|
70 |
|
71 CreateTestDirectory(_L("\\F32-TST\\T_CP_PLUGIN\\")); |
|
72 TestUnicodeVolumeLabel(); |
|
73 TestShortNameBoundary(); |
|
74 TestConsistentShortNameGeneration(); |
|
75 TestConsistentShortNameExtGeneration(); |
|
76 TestDuplicateLongFileNames(); |
|
77 TestDuplicateLongDirNames(); |
|
78 TestLeadingE5Handling(); |
|
79 TestDEF130334(); |
|
80 TestINC127905(); |
|
81 DeleteTestDirectory(); |
|
82 TestCompatibility(); |
|
83 TestINC126563(); |
|
84 |
|
85 RDebug::Printf("-- T_CP_PLUGIN.CPP DoCodePagePluginTestL"); |
|
86 } |
|
87 |
|
88 |
|
89 void CallTestsL(void) |
|
90 { |
|
91 |
|
92 test.Title(); |
|
93 test.Start(_L("Starting T_CP_PLUGIN tests")); |
|
94 |
|
95 #if defined(_DEBUG) || defined(_DEBUG_RELEASE) |
|
96 |
|
97 // Test only runs on Fat file systems |
|
98 TheFs.SessionPath(gSessionPath); |
|
99 TInt driveNum = CurrentDrive(); |
|
100 TFSName name; |
|
101 TInt r = TheFs.FileSystemName(name, driveNum); |
|
102 if (KErrNone == r) |
|
103 { |
|
104 if (name.Compare(_L("Fat")) != 0) |
|
105 { |
|
106 test.Printf(_L("Test only runs on 'FAT' drives")); |
|
107 } |
|
108 else |
|
109 { |
|
110 TBuf<16> CodepageDllName(KCP932Name); |
|
111 r = LoadCodePageDll(CodepageDllName); |
|
112 test(r == KErrNone || r == KErrAlreadyExists); |
|
113 |
|
114 if(r == KErrNone) |
|
115 { |
|
116 // should not allow loading again codepage dll. |
|
117 r = LoadCodePageDll(CodepageDllName); |
|
118 test(r == KErrAlreadyExists); |
|
119 |
|
120 } |
|
121 |
|
122 // Enables codepage dll implementation of LocaleUtils functions |
|
123 TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions); |
|
124 test(KErrNone == r); |
|
125 |
|
126 DoCodePagePluginTest(); |
|
127 |
|
128 // Disables codepage dll implementation of LocaleUtils functions for other base tests |
|
129 r = TheFs.ControlIo(driveNum, KControlIoDisableFatUtilityFunctions); |
|
130 test(r == KErrNone); |
|
131 } |
|
132 } |
|
133 else |
|
134 { |
|
135 test.Printf(_L("Drive %C: is not ready!"), 'A'+driveNum); |
|
136 test(EFalse); |
|
137 } |
|
138 #else |
|
139 test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details.")); |
|
140 #endif // _DEBUG) || _DEBUG_RELEASE |
|
141 test.End(); |
|
142 } |
|
143 |