sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: // sl@0: // sl@0: sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "t_server.h" sl@0: #include "f32dbg.h" sl@0: sl@0: sl@0: GLDEF_D RTest test(_L("T_CP_PLUGIN")); sl@0: sl@0: // function decalarations sl@0: void DoCodePagePluginTest(); sl@0: void TestUnicodeVolumeLabel(); sl@0: void TestShortNameBoundary(); sl@0: void TestConsistentShortNameGeneration(); sl@0: void TestConsistentShortNameExtGeneration(); sl@0: void TestDuplicateLongFileNames(); sl@0: void TestDuplicateLongDirNames(); sl@0: void TestLeadingE5Handling(); sl@0: void TestDEF130334(); sl@0: void TestINC127905(); sl@0: void DeleteTestDirectory(); sl@0: void TestCompatibility(); sl@0: void TestINC126563(); sl@0: sl@0: // Codepage dll name sl@0: _LIT(KCP932Name,"T_CP932"); sl@0: sl@0: TInt LoadCodePageDll(const TDesC& aCodePageDllName) sl@0: { sl@0: RDebug::Printf("++ T_CP_PLUGIN.CPP LoadCodePageDll"); sl@0: sl@0: TInt err = KErrNone; sl@0: if(aCodePageDllName.Length()) sl@0: { sl@0: RDebug::Print(_L("IS: codepageDllName = %S"), &aCodePageDllName); sl@0: RLoader loader; sl@0: err = loader.Connect(); sl@0: if (err==KErrNone) sl@0: { sl@0: err = loader.SendReceive(ELoadCodePage, TIpcArgs(0, &aCodePageDllName, 0)); sl@0: RDebug::Printf("\n T_CP_PLUGIN.CPP : LoadCodePageDll : loader.SendReceive == %d", err); sl@0: loader.Close(); sl@0: } sl@0: } sl@0: RDebug::Printf("-- T_CP_PLUGIN.CPP LoadCodePageDll"); sl@0: return err; sl@0: } sl@0: sl@0: void DoCodePagePluginTest() sl@0: { sl@0: RDebug::Printf("++ T_CP_PLUGIN.CPP DoCodePagePluginTestL"); sl@0: sl@0: CreateTestDirectory(_L("\\F32-TST\\T_CP_PLUGIN\\")); sl@0: TestUnicodeVolumeLabel(); sl@0: TestShortNameBoundary(); sl@0: TestConsistentShortNameGeneration(); sl@0: TestConsistentShortNameExtGeneration(); sl@0: TestDuplicateLongFileNames(); sl@0: TestDuplicateLongDirNames(); sl@0: TestLeadingE5Handling(); sl@0: TestDEF130334(); sl@0: TestINC127905(); sl@0: DeleteTestDirectory(); sl@0: TestCompatibility(); sl@0: TestINC126563(); sl@0: sl@0: RDebug::Printf("-- T_CP_PLUGIN.CPP DoCodePagePluginTestL"); sl@0: } sl@0: sl@0: sl@0: void CallTestsL(void) sl@0: { sl@0: sl@0: test.Title(); sl@0: test.Start(_L("Starting T_CP_PLUGIN tests")); sl@0: sl@0: #if defined(_DEBUG) || defined(_DEBUG_RELEASE) sl@0: sl@0: // Test only runs on Fat file systems sl@0: TheFs.SessionPath(gSessionPath); sl@0: TInt driveNum = CurrentDrive(); sl@0: TFSName name; sl@0: TInt r = TheFs.FileSystemName(name, driveNum); sl@0: if (KErrNone == r) sl@0: { sl@0: if (name.Compare(_L("Fat")) != 0) sl@0: { sl@0: test.Printf(_L("Test only runs on 'FAT' drives")); sl@0: } sl@0: else sl@0: { sl@0: TBuf<16> CodepageDllName(KCP932Name); sl@0: r = LoadCodePageDll(CodepageDllName); sl@0: test(r == KErrNone || r == KErrAlreadyExists); sl@0: sl@0: if(r == KErrNone) sl@0: { sl@0: // should not allow loading again codepage dll. sl@0: r = LoadCodePageDll(CodepageDllName); sl@0: test(r == KErrAlreadyExists); sl@0: sl@0: } sl@0: sl@0: // Enables codepage dll implementation of LocaleUtils functions sl@0: TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions); sl@0: test(KErrNone == r); sl@0: sl@0: DoCodePagePluginTest(); sl@0: sl@0: // Disables codepage dll implementation of LocaleUtils functions for other base tests sl@0: r = TheFs.ControlIo(driveNum, KControlIoDisableFatUtilityFunctions); sl@0: test(r == KErrNone); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: test.Printf(_L("Drive %C: is not ready!"), 'A'+driveNum); sl@0: test(EFalse); sl@0: } sl@0: #else sl@0: test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details.")); sl@0: #endif // _DEBUG) || _DEBUG_RELEASE sl@0: test.End(); sl@0: } sl@0: