Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
21 #include <e32ldr_private.h>
28 GLDEF_D RTest test(_L("T_CP_PLUGIN"));
30 // function decalarations
31 void DoCodePagePluginTest();
32 void TestUnicodeVolumeLabel();
33 void TestShortNameBoundary();
34 void TestConsistentShortNameGeneration();
35 void TestConsistentShortNameExtGeneration();
36 void TestDuplicateLongFileNames();
37 void TestDuplicateLongDirNames();
38 void TestLeadingE5Handling();
41 void DeleteTestDirectory();
42 void TestCompatibility();
46 _LIT(KCP932Name,"T_CP932");
48 TInt LoadCodePageDll(const TDesC& aCodePageDllName)
50 RDebug::Printf("++ T_CP_PLUGIN.CPP LoadCodePageDll");
53 if(aCodePageDllName.Length())
55 RDebug::Print(_L("IS: codepageDllName = %S"), &aCodePageDllName);
57 err = loader.Connect();
60 err = loader.SendReceive(ELoadCodePage, TIpcArgs(0, &aCodePageDllName, 0));
61 RDebug::Printf("\n T_CP_PLUGIN.CPP : LoadCodePageDll : loader.SendReceive == %d", err);
65 RDebug::Printf("-- T_CP_PLUGIN.CPP LoadCodePageDll");
69 void DoCodePagePluginTest()
71 RDebug::Printf("++ T_CP_PLUGIN.CPP DoCodePagePluginTestL");
73 CreateTestDirectory(_L("\\F32-TST\\T_CP_PLUGIN\\"));
74 TestUnicodeVolumeLabel();
75 TestShortNameBoundary();
76 TestConsistentShortNameGeneration();
77 TestConsistentShortNameExtGeneration();
78 TestDuplicateLongFileNames();
79 TestDuplicateLongDirNames();
80 TestLeadingE5Handling();
83 DeleteTestDirectory();
87 RDebug::Printf("-- T_CP_PLUGIN.CPP DoCodePagePluginTestL");
95 test.Start(_L("Starting T_CP_PLUGIN tests"));
97 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
99 // Test only runs on Fat file systems
100 TheFs.SessionPath(gSessionPath);
101 TInt driveNum = CurrentDrive();
103 TInt r = TheFs.FileSystemName(name, driveNum);
106 if (name.Compare(_L("Fat")) != 0)
108 test.Printf(_L("Test only runs on 'FAT' drives"));
112 TBuf<16> CodepageDllName(KCP932Name);
113 r = LoadCodePageDll(CodepageDllName);
114 test(r == KErrNone || r == KErrAlreadyExists);
118 // should not allow loading again codepage dll.
119 r = LoadCodePageDll(CodepageDllName);
120 test(r == KErrAlreadyExists);
124 // Enables codepage dll implementation of LocaleUtils functions
125 TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);
128 DoCodePagePluginTest();
130 // Disables codepage dll implementation of LocaleUtils functions for other base tests
131 r = TheFs.ControlIo(driveNum, KControlIoDisableFatUtilityFunctions);
137 test.Printf(_L("Drive %C: is not ready!"), 'A'+driveNum);
141 test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
142 #endif // _DEBUG) || _DEBUG_RELEASE