sl@0: /* sl@0: * Copyright (c) 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: #define __E32TEST_EXTENSION__ sl@0: sl@0: #include "T_Fatcharsetconv_aux.h" sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "..\server\t_server.h" sl@0: sl@0: //#include "fat_utils.h" sl@0: sl@0: extern RFile TheFile; sl@0: sl@0: #if defined(_DEBUG) || defined(_DEBUG_RELEASE) sl@0: void TestIllegalCharsWithDll() sl@0: { sl@0: test.Next(_L("Test Illegal Character handling with DLL")); sl@0: __UHEAP_MARK; sl@0: sl@0: // logging for failure sl@0: gTCType = ESymbianFATSpecific; sl@0: RBuf failedOnBuf; sl@0: failedOnBuf.CreateL(gLogFailureData.iFuncName); sl@0: gTCId = 0; sl@0: RBuf tcUniquePath; sl@0: tcUniquePath.CreateL(KNone()); sl@0: sl@0: QuickFormat(); sl@0: CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\")); sl@0: sl@0: TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: r = UserSvr::ChangeLocale(KTestLocale); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: _LIT(KTestNormalUnicodeFileName, "\x65B0\x6587\x4EF6.TXT"); sl@0: _LIT(KTestNormalUnicodeFileNameShortDefualt, "\x65B0\x6587\x4EF6.TXT"); sl@0: _LIT(KTestFileNameWithIllegalChars, "\x222F\x2F3A\x3C3E\x7C00.TXT"); sl@0: _LIT(KFileNameWithIllegalCharsShort, "___\x7C00.TXT"); sl@0: _LIT(KTestFileNameWithWildChars, "\x235B\x245C\x255D\x265E.TXT"); sl@0: _LIT(KTestFileNameWithWildCharsShort, "____.TXT"); sl@0: sl@0: TFileName shn; sl@0: sl@0: MakeFile(KTestNormalUnicodeFileName); sl@0: r = TheFs.GetShortName(KTestNormalUnicodeFileName, shn); sl@0: testAndLog(r==KErrNone); sl@0: r = shn.Compare(KTestNormalUnicodeFileNameShortDefualt); sl@0: testAndLog(r==0); sl@0: sl@0: TFileName lgn; sl@0: r = TheFs.GetLongName(KTestNormalUnicodeFileNameShortDefualt, lgn); sl@0: testAndLog(r==KErrNone); sl@0: r = lgn.Compare(KTestNormalUnicodeFileName); sl@0: testAndLog(r==0); sl@0: sl@0: // Test illegal 8-bit ASCII chars in 16-bit Unicode chars. sl@0: MakeFile(KTestFileNameWithIllegalChars); sl@0: r = TheFs.GetShortName(KTestFileNameWithIllegalChars, shn); sl@0: testAndLog(r==KErrNone); sl@0: r = shn.Compare(KFileNameWithIllegalCharsShort); sl@0: testAndLog(r==0); sl@0: sl@0: // Test wildcards, 8-bit ASCII chars in 16-bit Unicode chars. sl@0: MakeFile(KTestFileNameWithWildChars); sl@0: r = TheFs.GetShortName(KTestFileNameWithWildChars, shn); sl@0: test_KErrNone(r); sl@0: r = shn.Compare(KTestFileNameWithWildCharsShort); sl@0: testAndLog(r==0); sl@0: sl@0: r=TheFs.Delete(KTestFileNameWithIllegalChars); sl@0: testAndLog(r==0); sl@0: r=TheFs.Delete(KTestNormalUnicodeFileName); sl@0: testAndLog(r==0); sl@0: r=TheFs.Delete(KTestFileNameWithWildChars); sl@0: testAndLog(r==0); sl@0: sl@0: r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions); sl@0: testAndLog(r==KErrNone); sl@0: failedOnBuf.Close(); sl@0: tcUniquePath.Close(); sl@0: __UHEAP_MARKEND; sl@0: } sl@0: sl@0: void TestIllegalCharsWithoutDLL() sl@0: { sl@0: test.Next(_L("Test Illegal Character handling without DLL")); sl@0: __UHEAP_MARK; sl@0: sl@0: // logging for failure sl@0: gTCType = ESymbianFATSpecific; sl@0: RBuf failedOnBuf; sl@0: failedOnBuf.CreateL(gLogFailureData.iFuncName); sl@0: gTCId = 0; sl@0: RBuf tcUniquePath; sl@0: tcUniquePath.CreateL(KNone()); sl@0: sl@0: QuickFormat(); sl@0: CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\")); sl@0: sl@0: TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: _LIT(KTestNormalUnicodeFileName, "\x65B0\x6587\x4EF6.TXT"); sl@0: _LIT(KTestNormalUnicodeFileNameShortDefualt, "___.TXT"); sl@0: _LIT(KTestFileNameWithIllegalChars, "\x222F\x2F3A\x3C3E\x7C00.TXT"); sl@0: _LIT(KFileNameWithIllegalCharsShort, "____.TXT"); sl@0: _LIT(KTestFileNameWithWildChars, "\x235B\x245C\x255D\x265E.TXT"); sl@0: _LIT(KTestFileNameWithWildCharsShort, "____~1.TXT"); sl@0: sl@0: TFileName shn; sl@0: sl@0: MakeFile(KTestNormalUnicodeFileName); sl@0: r = TheFs.GetShortName(KTestNormalUnicodeFileName, shn); sl@0: testAndLog(r==KErrNone); sl@0: r = shn.Compare(KTestNormalUnicodeFileNameShortDefualt); sl@0: testAndLog(r==0); sl@0: sl@0: TFileName lgn; sl@0: r = TheFs.GetLongName(KTestNormalUnicodeFileNameShortDefualt, lgn); sl@0: testAndLog(r==KErrNone); sl@0: r = lgn.Compare(KTestNormalUnicodeFileName); sl@0: testAndLog(r==0); sl@0: sl@0: // Test illegal 8-bit ASCII chars in 16-bit Unicode chars. sl@0: MakeFile(KTestFileNameWithIllegalChars); sl@0: r = TheFs.GetShortName(KTestFileNameWithIllegalChars, shn); sl@0: testAndLog(r==KErrNone); sl@0: r = shn.Compare(KFileNameWithIllegalCharsShort); sl@0: testAndLog(r==0); sl@0: sl@0: // Test illegal 8-bit ASCII chars in 16-bit Unicode chars. sl@0: MakeFile(KTestFileNameWithWildChars); sl@0: r = TheFs.GetShortName(KTestFileNameWithWildChars, shn); sl@0: testAndLog(r==KErrNone); sl@0: r = shn.Compare(KTestFileNameWithWildCharsShort); sl@0: testAndLog(r==0); sl@0: sl@0: r=TheFs.Delete(KTestFileNameWithIllegalChars); sl@0: testAndLog(r==0); sl@0: r=TheFs.Delete(KTestNormalUnicodeFileName); sl@0: testAndLog(r==0); sl@0: r=TheFs.Delete(KTestFileNameWithWildChars); sl@0: testAndLog(r==0); sl@0: sl@0: failedOnBuf.Close(); sl@0: tcUniquePath.Close(); sl@0: __UHEAP_MARKEND; sl@0: } sl@0: sl@0: void TestFileLengthMax() sl@0: { sl@0: test.Next(_L("Test accesing a long file with filename length <250 characters")); sl@0: __UHEAP_MARK; sl@0: sl@0: // logging for failure sl@0: gTCType = ESymbianFATSpecific; sl@0: RBuf failedOnBuf; sl@0: failedOnBuf.CreateL(gLogFailureData.iFuncName); sl@0: gTCId = 0; sl@0: RBuf tcUniquePath; sl@0: tcUniquePath.CreateL(KNone()); sl@0: sl@0: QuickFormat(); sl@0: CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\")); sl@0: sl@0: sl@0: TBuf longName; sl@0: sl@0: _LIT(KTestDir1, "\\TEST\\TESTLONGFILENAMELENGTH\\TESTMORETHAN250CHARACTERS\\") ; sl@0: _LIT(KTestDir2, "\x65B0\x6587\x4EF6\x4EF6(ABCDEFGH)\\(\x65B0\x6587\x4EF6\x4EF6)PQRST\\"); sl@0: _LIT(KTestDir3, "MULTILEVEL-FOLDER1\\MULTILEVEL-FOLDER2\\MULTILEVEL-FOLDER3\\"); sl@0: _LIT(KTestDir4, "\x65B0\x65B0\x65B0\x65B0(x6587)\\(\x6587\x6587\x6587\x6587)PQRST\\"); sl@0: _LIT(KTestDir5, "\x4EF6\x4EF6\x4EF6\x4EF6(x4EF6)\\(\x6587\x6587\x6587\x6587)XYZ\\"); sl@0: _LIT(KTestDir6, "TESTINGINPROGRESS\\"); sl@0: _LIT(KTestLongFileLength, "\x4EF6\x4EF6\x4EF6\x4EF6(x4EF6).TXT"); sl@0: sl@0: longName += KTestDir1; sl@0: longName += KTestDir2; sl@0: longName += KTestDir3; sl@0: longName += KTestDir4; sl@0: longName += KTestDir5; sl@0: longName += KTestDir6; sl@0: sl@0: test.Printf(_L("longName count is %d "), longName.Length()); sl@0: TInt r=TheFs.MkDirAll(longName); sl@0: sl@0: longName += KTestLongFileLength; sl@0: test.Printf(_L("longName count is %d "), longName.Length()); sl@0: sl@0: testAndLog(longName.Length()<256); sl@0: sl@0: r=TheFile.Create(TheFs,longName ,EFileWrite); sl@0: testAndLog(r==KErrNone); sl@0: TheFile.Close(); sl@0: sl@0: r=TheFile.Open(TheFs,longName ,EFileWrite); sl@0: testAndLog(r==KErrNone); sl@0: TheFile.Close(); sl@0: sl@0: TheFs.Delete(longName); sl@0: sl@0: failedOnBuf.Close(); sl@0: tcUniquePath.Close(); sl@0: __UHEAP_MARKEND; sl@0: } sl@0: sl@0: void TestFileLengthExceedMax() sl@0: { sl@0: test.Next(_L("Test accesing a long file with filename length >250 characters")); sl@0: __UHEAP_MARK; sl@0: sl@0: // logging for failure sl@0: gTCType = ESymbianFATSpecific; sl@0: RBuf failedOnBuf; sl@0: failedOnBuf.CreateL(gLogFailureData.iFuncName); sl@0: gTCId = 0; sl@0: RBuf tcUniquePath; sl@0: tcUniquePath.CreateL(KNone()); sl@0: sl@0: QuickFormat(); sl@0: CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\")); sl@0: sl@0: TInt r = TheFs.SessionPath(gSessionPath); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: TBuf<350> longName; sl@0: sl@0: _LIT(KTestDir1, "\\TEST\\TESTLONGFILENAMELENGTH\\TESTMORETHAN260CHARACTERS\\") ; sl@0: _LIT(KTestDir2, "\x65B0\x6587\x4EF6\x4EF6(ABCDEFGH)\\(\x65B0\x6587\x4EF6\x4EF6)PQRST\\"); sl@0: _LIT(KTestDir3, "MULTILEVEL-FOLDER1\\MULTILEVEL-FOLDER2\\MULTILEVEL-FOLDER3\\"); sl@0: _LIT(KTestDir4, "\x65B0\x65B0\x65B0\x65B0(x6587)\\(\x6587\x6587\x6587\x6587)PQRST\\"); sl@0: _LIT(KTestDir5, "\x4EF6\x4EF6\x4EF6\x4EF6(x4EF6)\\(\x6587\x6587\x6587\x6587)XYZ\\"); sl@0: _LIT(KTestDir6, "TESTINGINPROGRESS(TESTLENGTH)>256\\"); sl@0: _LIT(KTestLongFileLength, "\x4EF6\x4EF6\x4EF6\x4EF6(x4EF6).TXT"); sl@0: sl@0: longName = gSessionPath; sl@0: longName += KTestDir1; sl@0: longName += KTestDir2; sl@0: longName += KTestDir3; sl@0: longName += KTestDir4; sl@0: longName += KTestDir5; sl@0: longName += KTestDir6; sl@0: sl@0: test.Printf(_L("longName length is %d "), longName.Length()); sl@0: r=TheFs.MkDirAll(longName); sl@0: sl@0: longName += KTestLongFileLength; sl@0: test.Printf(_L("longName count is %d "), longName.Length()); sl@0: sl@0: testAndLog(longName.Length()>256); sl@0: sl@0: r=TheFile.Create(TheFs,longName ,EFileWrite); sl@0: testAndLog(r==KErrBadName); sl@0: // TheFile.Close(); sl@0: sl@0: r=TheFile.Open(TheFs,longName ,EFileWrite); sl@0: testAndLog(r==KErrBadName); sl@0: // TheFile.Close(); sl@0: sl@0: TheFs.Delete(longName); sl@0: failedOnBuf.Close(); sl@0: tcUniquePath.Close(); sl@0: __UHEAP_MARKEND; sl@0: } sl@0: sl@0: void TestLeadingE5Handling() sl@0: { sl@0: test.Next(_L("Test Leading \'E5\' byte handling")); sl@0: __UHEAP_MARK; sl@0: sl@0: // logging for failure sl@0: gTCType = ESymbianFATSpecific; sl@0: RBuf failedOnBuf; sl@0: failedOnBuf.CreateL(gLogFailureData.iFuncName); sl@0: gTCId = 0; sl@0: RBuf tcUniquePath; sl@0: tcUniquePath.CreateL(KNone()); sl@0: sl@0: QuickFormat(); sl@0: CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\")); sl@0: sl@0: // Enables codepage dll implementation of LocaleUtils functions for this test only sl@0: TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: r = UserSvr::ChangeLocale(KTestLocale); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: r=TheFs.SessionPath(gSessionPath); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: _LIT(KTestFilePathAndName, "\\F32-TST\\T_FATCHARSETCONV\\\x88F9.TXT"); sl@0: _LIT(KTestFileShortName, "\x88F9.TXT"); sl@0: sl@0: MakeFile(KTestFilePathAndName); sl@0: TFileName sn; sl@0: r = TheFs.GetShortName(KTestFilePathAndName, sn); sl@0: testAndLog(r==KErrNone); sl@0: r = sn.Compare(KTestFileShortName); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: r=TheFs.Delete(KTestFilePathAndName); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: // Disables codepage dll implementation of LocaleUtils functions for other base tests sl@0: r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions); sl@0: testAndLog(r==KErrNone); sl@0: failedOnBuf.Close(); sl@0: tcUniquePath.Close(); sl@0: __UHEAP_MARKEND; sl@0: } sl@0: sl@0: void TestVFATCase3() sl@0: { sl@0: test.Next(_L("Test With VFAT entry, and DOS entry using Non-CP932 Japanese file's access")); sl@0: __UHEAP_MARK; sl@0: sl@0: // logging for failure sl@0: gTCType = ESymbianFATSpecific; sl@0: RBuf failedOnBuf; sl@0: failedOnBuf.CreateL(gLogFailureData.iFuncName); sl@0: gTCId = 0; sl@0: RBuf tcUniquePath; sl@0: tcUniquePath.CreateL(KNone()); sl@0: sl@0: QuickFormat(); sl@0: CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\")); sl@0: sl@0: _LIT(KTestNormalFileName, "\x65B0\x6587\x4EF6.TXT"); sl@0: _LIT(KTestNormalFileNameWithUnicode, "___.TXT"); sl@0: sl@0: sl@0: test.Printf(_L("Create a file without the DLL installed, and get the shortname")); sl@0: TInt r=TheFile.Create(TheFs,KTestNormalFileName,EFileRead|EFileWrite); sl@0: testAndLog(r==KErrNone); sl@0: TFileName sn; sl@0: r = TheFs.GetShortName(KTestNormalFileName, sn); sl@0: testAndLog(r==KErrNone); sl@0: r = sn.Compare(KTestNormalFileNameWithUnicode); sl@0: testAndLog(r==0); sl@0: TheFile.Close(); sl@0: sl@0: test.Printf(_L("Access the file without the DLL installed")); sl@0: r=TheFile.Open(TheFs,KTestNormalFileName,EFileWrite); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: TBuf<50> name; sl@0: r=TheFile.FullName(name); sl@0: testAndLog(r==KErrNone); sl@0: TheFile.Close(); sl@0: sl@0: r=TheFile.Open(TheFs,KTestNormalFileNameWithUnicode,EFileWrite); sl@0: testAndLog(r==KErrNone); sl@0: TheFile.Close(); sl@0: sl@0: //load the dll sl@0: sl@0: r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: r = UserSvr::ChangeLocale(KTestLocale); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: test.Printf(_L("Access the file with the DLL installed")); sl@0: r=TheFile.Open(TheFs,KTestNormalFileName,EFileWrite); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: r=TheFile.FullName(name); sl@0: testAndLog(r==KErrNone); sl@0: TheFile.Close(); sl@0: sl@0: r=TheFile.Open(TheFs,KTestNormalFileNameWithUnicode,EFileWrite); sl@0: testAndLog(r==KErrNone); sl@0: TheFile.Close(); sl@0: sl@0: r=TheFs.Delete(KTestNormalFileName); sl@0: sl@0: r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions); sl@0: testAndLog(r==KErrNone); sl@0: failedOnBuf.Close(); sl@0: tcUniquePath.Close(); sl@0: __UHEAP_MARKEND; sl@0: } sl@0: sl@0: void TestVFATCase2() sl@0: { sl@0: test.Next(_L("Test With VFAT entry, and DOS entry using CP932 Japanese file's access")); sl@0: __UHEAP_MARK; sl@0: sl@0: // logging for failure sl@0: gTCType = ESymbianFATSpecific; sl@0: RBuf failedOnBuf; sl@0: failedOnBuf.CreateL(gLogFailureData.iFuncName); sl@0: gTCId = 0; sl@0: RBuf tcUniquePath; sl@0: tcUniquePath.CreateL(KNone()); sl@0: sl@0: QuickFormat(); sl@0: CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\")); sl@0: sl@0: TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions); sl@0: test_KErrNone(r); sl@0: sl@0: r = UserSvr::ChangeLocale(KTestLocale); sl@0: test_KErrNone(r); sl@0: r=TheFs.SetSessionPath(gSessionPath); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: _LIT(KTestNormalFileName, "\x65B0\x6587\x4EF6.TXT"); sl@0: _LIT(KTestNormalFileShortName, "\x65B0\x6587\x4EF6.TXT"); sl@0: sl@0: test.Printf(_L("Create a file with the DLL installed, and get the shortname")); sl@0: r=TheFile.Create(TheFs,KTestNormalFileName,EFileRead|EFileWrite); sl@0: testAndLog(r==KErrNone); sl@0: TFileName sn; sl@0: r = TheFs.GetShortName(KTestNormalFileName, sn); sl@0: testAndLog(r==KErrNone); sl@0: r = sn.Compare(KTestNormalFileShortName); sl@0: testAndLog(r==0); sl@0: TheFile.Close(); sl@0: sl@0: test.Printf(_L("Access the file with the DLL installed")); sl@0: r=TheFile.Open(TheFs,KTestNormalFileName,EFileWrite); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: TBuf<50> name; sl@0: r=TheFile.FullName(name); sl@0: testAndLog(r==KErrNone); sl@0: TheFile.Close(); sl@0: sl@0: r=TheFile.Open(TheFs,KTestNormalFileShortName,EFileWrite); sl@0: testAndLog(r==KErrNone); sl@0: TheFile.Close(); sl@0: sl@0: r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: test.Printf(_L("Access the file without the DLL installed")); sl@0: sl@0: r=TheFile.Open(TheFs,KTestNormalFileName,EFileWrite); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: r=TheFile.FullName(name); sl@0: testAndLog(r==KErrNone); sl@0: TheFile.Close(); sl@0: sl@0: r=TheFile.Open(TheFs,KTestNormalFileShortName,EFileWrite); sl@0: testAndLog(r==KErrNone); sl@0: TheFile.Close(); sl@0: sl@0: r=TheFs.Delete(KTestNormalFileName); sl@0: failedOnBuf.Close(); sl@0: tcUniquePath.Close(); sl@0: __UHEAP_MARKEND; sl@0: } sl@0: sl@0: void TestVFATCase1() sl@0: { sl@0: test.Next(_L("Test Without VFAT entry, but DOS entry uses CP932 Japanese file's access")); sl@0: __UHEAP_MARK; sl@0: sl@0: // logging for failure sl@0: gTCType = ESymbianFATSpecific; sl@0: RBuf failedOnBuf; sl@0: failedOnBuf.CreateL(gLogFailureData.iFuncName); sl@0: gTCId = 0; sl@0: RBuf tcUniquePath; sl@0: tcUniquePath.CreateL(KNone()); sl@0: sl@0: QuickFormat(); sl@0: CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\")); sl@0: sl@0: GetBootInfo(); sl@0: sl@0: RFile file; sl@0: TFileName fn = _L("\\ABCD"); sl@0: sl@0: TInt r=file.Create(TheFs,fn,EFileRead); sl@0: testAndLog(r==KErrNone); sl@0: file.Close(); sl@0: sl@0: // Assume this file is the first entry in the root directory sl@0: r=TheDisk.Open(TheFs,CurrentDrive()); sl@0: testAndLog(r==KErrNone); sl@0: sl@0: //-- read the 1st dir entry, it should be a DOS entry sl@0: const TInt posEntry1=gBootSector.RootDirStartSector() << KDefaultSectorLog2; //-- dir entry1 position sl@0: sl@0: TFatDirEntry fatEntry1; sl@0: TPtr8 ptrEntry1((TUint8*)&fatEntry1,sizeof(TFatDirEntry)); sl@0: testAndLog(TheDisk.Read(posEntry1, ptrEntry1)==KErrNone); sl@0: testAndLog(!fatEntry1.IsVFatEntry()); sl@0: sl@0: // Manually modify the short name into unicode characters sl@0: // Unicode: 0x(798F 5C71 96C5 6CBB) sl@0: // Shift-JIS: 0x(959F 8E52 89EB 8EA1) sl@0: sl@0: TBuf8<8> unicodeSN = _L8("ABCD1234"); sl@0: unicodeSN[0] = 0x95; sl@0: unicodeSN[1] = 0x9F; sl@0: unicodeSN[2] = 0x8E; sl@0: unicodeSN[3] = 0x52; sl@0: unicodeSN[4] = 0x89; sl@0: unicodeSN[5] = 0xEB; sl@0: unicodeSN[6] = 0x8E; sl@0: unicodeSN[7] = 0xA1; sl@0: sl@0: fatEntry1.SetName(unicodeSN); sl@0: testAndLog(TheDisk.Write(posEntry1, ptrEntry1)==KErrNone); sl@0: TheDisk.Close(); sl@0: sl@0: // The Unicode file name of the file that is created sl@0: fn = _L("\\ABCD"); sl@0: fn[1] = 0x798F; sl@0: fn[2] = 0x5C71; sl@0: fn[3] = 0x96C5; sl@0: fn[4] = 0x6CBB; sl@0: sl@0: // Access the file using its unicode file name without the DLL loaded. sl@0: r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions); sl@0: test_KErrNone(r); sl@0: sl@0: TEntry entry; sl@0: TInt err = TheFs.Entry(fn, entry); sl@0: testAndLog(err==KErrNotFound); sl@0: sl@0: // Access the file using its unicode file name with the DLL loaded. sl@0: r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions); sl@0: test_KErrNone(r); sl@0: r = UserSvr::ChangeLocale(KTestLocale); sl@0: test_KErrNone(r); sl@0: sl@0: err = TheFs.Entry(fn, entry); sl@0: testAndLog(err==KErrNone); sl@0: sl@0: //file is no more required,delete it. sl@0: err = TheFs.Delete(fn); sl@0: testAndLog(err==KErrNone); sl@0: sl@0: r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions); sl@0: test_KErrNone(r); sl@0: sl@0: r=TheFs.SessionPath(gSessionPath); sl@0: test_KErrNone(r); sl@0: failedOnBuf.Close(); sl@0: tcUniquePath.Close(); sl@0: __UHEAP_MARKEND; sl@0: } sl@0: sl@0: void DoSymbianSpecificCases() sl@0: { sl@0: gLogFailureData.iTCTypeName = KSymbianFATSpecific; sl@0: gLogFailureData.iAPIName= KNone; sl@0: sl@0: // Store current file name sl@0: TFileName fileName; sl@0: TInt i=0; sl@0: while(__FILE__[i]!='\0') sl@0: { sl@0: fileName.SetLength(i+1); sl@0: fileName[i] = __FILE__[i++]; sl@0: } sl@0: gFileName = fileName; sl@0: sl@0: gLogFailureData.iFuncName = KTestLeadingE5Handling; sl@0: TestLeadingE5Handling(); sl@0: sl@0: gLogFailureData.iFuncName = KTestIllegalCharsWithDll; sl@0: TestIllegalCharsWithDll(); sl@0: sl@0: gLogFailureData.iFuncName = KTestIllegalCharsWithoutDLL; sl@0: TestIllegalCharsWithoutDLL(); sl@0: sl@0: gLogFailureData.iFuncName = KTestFileLengthMax; sl@0: TestFileLengthMax(); sl@0: sl@0: gLogFailureData.iFuncName = KTestFileLengthExceedMax; sl@0: TestFileLengthExceedMax(); sl@0: sl@0: gLogFailureData.iFuncName = KTestVFATCase2; sl@0: TestVFATCase2(); sl@0: sl@0: gLogFailureData.iFuncName = KTestVFATCase3; sl@0: TestVFATCase3(); sl@0: sl@0: gLogFailureData.iFuncName = KTestVFATCase1; sl@0: TestVFATCase1(); sl@0: sl@0: } sl@0: sl@0: #endif //defined(_DEBUG) || defined(_DEBUG_RELEASE)