1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/server/t_localeutils_cp932.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,941 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// f32test\locl\localeutils\t_localeutils_cp932.cpp
1.18 +//
1.19 +//
1.20 +
1.21 +#define __E32TEST_EXTENSION__
1.22 +
1.23 +
1.24 +#include <e32test.h>
1.25 +#include <HAL.H>
1.26 +#include <f32fsys.h>
1.27 +#include <f32dbg.h>
1.28 +#include <e32svr.h>
1.29 +#include "..\server\t_server.h"
1.30 +#include "fat_utils.h"
1.31 +
1.32 +RTest test(_L("T_LOCALEUTILS_CP932"));
1.33 +
1.34 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.35 +using namespace Fat_Test_Utils;
1.36 +static RRawDisk TheDisk;
1.37 +static TFatBootSector gBootSector;
1.38 +_LIT(KTestLocale, "t_tlocl_cp932.dll");
1.39 +
1.40 +void QuickFormat()
1.41 + {
1.42 + FormatFatDrive(TheFs, CurrentDrive(), ETrue);
1.43 + }
1.44 +
1.45 +void ReadBootSector(TFatBootSector& aBootSector)
1.46 + {
1.47 +
1.48 + TInt nRes = ReadBootSector(TheFs, CurrentDrive(), KBootSectorNum<<KDefaultSectorLog2, aBootSector);
1.49 + test(nRes == KErrNone);
1.50 +
1.51 + if(!aBootSector.IsValid())
1.52 + {
1.53 + test.Printf(_L("Wrong bootsector! Dump:\n"));
1.54 + aBootSector.PrintDebugInfo();
1.55 + test(0);
1.56 + }
1.57 + }
1.58 +
1.59 +void GetBootInfo()
1.60 + {
1.61 + QuickFormat();
1.62 + ReadBootSector(gBootSector);
1.63 + }
1.64 +
1.65 +void doDirNameTest(const TDesC& aLongName, const TDesC& aShortName)
1.66 + {
1.67 + TBuf<KMaxFileName> longDirNamePath;
1.68 + TBuf<KMaxFileName> shortDirNamePath;
1.69 + TBuf<KMaxFileName> longName;
1.70 + TBuf<KMaxFileName> shortName;
1.71 + longDirNamePath = gSessionPath;
1.72 + longDirNamePath += aLongName;
1.73 + longDirNamePath.Append('\\');
1.74 +
1.75 + // Create new directory and check creation
1.76 + TInt r = TheFs.MkDir(longDirNamePath);
1.77 + test_KErrNone(r);
1.78 + TUint dumUint=0;
1.79 + CDir* dumDir;
1.80 + r= TheFs.GetDir(longDirNamePath, dumUint, dumUint, dumDir);
1.81 + test_KErrNone(r);
1.82 + test_NotNull(dumDir);
1.83 + delete dumDir;
1.84 +
1.85 + // Check short name
1.86 + r = TheFs.GetShortName(longDirNamePath, shortName);
1.87 + test_KErrNone(r);
1.88 + r = shortName.Compare(aShortName);
1.89 + test_Equal(r, 0);
1.90 +
1.91 + // Check long name
1.92 + shortDirNamePath = gSessionPath;
1.93 + shortDirNamePath += shortName;
1.94 + shortDirNamePath.Append('\\');
1.95 + r = TheFs.GetLongName(shortDirNamePath, longName);
1.96 + test_KErrNone(r);
1.97 + r = longName.Compare(aLongName);
1.98 + test_Equal(r, 0);
1.99 +
1.100 + r = TheFs.RmDir(longDirNamePath);
1.101 + test_KErrNone(r);
1.102 + }
1.103 +
1.104 +void doFileNameTest(const TDesC& aLongName, const TDesC& aShortName)
1.105 + {
1.106 + TFileName lgnFullPath;
1.107 + TFileName shnFullPath;
1.108 + TFileName lgn;
1.109 + TFileName shn;
1.110 +
1.111 + TInt r = TheFs.SessionPath(gSessionPath);
1.112 + test_KErrNone(r);
1.113 + lgnFullPath = gSessionPath;
1.114 + lgnFullPath += aLongName;
1.115 +
1.116 + MakeFile(lgnFullPath);
1.117 +
1.118 + // Check short name
1.119 + r = TheFs.GetShortName(lgnFullPath, shn);
1.120 + test_KErrNone(r);
1.121 + r = shn.Compare(aShortName);
1.122 + test_Equal(r, 0);
1.123 +
1.124 + // Check long name
1.125 + shnFullPath = gSessionPath;
1.126 + shnFullPath += aShortName;
1.127 +
1.128 + r = TheFs.GetLongName(shnFullPath, lgn);
1.129 + test_KErrNone(r);
1.130 + r = lgn.Compare(aLongName);
1.131 + test_Equal(r, 0);
1.132 +
1.133 + test_KErrNone(TheFs.Delete(lgnFullPath));
1.134 + }
1.135 +#endif //_DEBUG || _DEBUG_RELEASE
1.136 +
1.137 +//----------------------------------------------------------------------------------------------
1.138 +//! @SYMTestCaseID PBASE-t_fatcharsetconv-0406
1.139 +//! @SYMTestType CIT
1.140 +//! @SYMDEF DEF101875
1.141 +//! @SYMTestCaseDesc This test case is to test the default behaviours of LocaleUtils functions
1.142 +//! in FAT.fsy before FATCharsetConv is integrated (i.e. there is no codepage
1.143 +//! dll loaded).
1.144 +//! @SYMTestActions 1. Creates a file with a name containing 3 valid Unicode characters,
1.145 +//! gets its short name and compares it with "___", gets its long name and
1.146 +//! compares it with the original Unicode string;
1.147 +//! 2. Creates a file with a name containing 4 Unicode characters, each 16-bit
1.148 +//! Unicode character contains two illegal 8-bit characters, test if the
1.149 +//! file can be created successfully, gets its short name and compares it
1.150 +//! with "____", gets its long name and compares it with the original
1.151 +//! Unicode string.
1.152 +//! @SYMTestExpectedResults
1.153 +//! 1. The file should be created successfully, the comparisons should return 0;
1.154 +//! 2. The file should be created successfully, the comparisons should return 0;
1.155 +//! @SYMTestPriority High
1.156 +//! @SYMTestCaseDependencies
1.157 +//! This test should be run before any codepage DLL is loaded,
1.158 +//! i.e., prior to all other test cases defined in this file.
1.159 +//! @SYMTestStatus Implemented
1.160 +//----------------------------------------------------------------------------------------------
1.161 +void TestBeforeFATCharsetConvInteg()
1.162 + {
1.163 + test.Next(_L("Test default unicode handling in FAT implementation"));
1.164 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.165 + _LIT(KTestNormalUnicodeFileName, "\x65B0\x6587\x4EF6.TXT");
1.166 + _LIT(KTestNormalUnicodeFileNameShortDefualt, "___.TXT");
1.167 + _LIT(KTestFileNameWithIllegalChars, "\x222F\x2F3A\x3C3E\x7C00.TXT");
1.168 + _LIT(KFileNameWithIllegalCharsShort, "____.TXT");
1.169 +
1.170 + TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
1.171 + test_KErrNone(r);
1.172 +
1.173 + // Create file and check creation
1.174 + MakeFile(KTestNormalUnicodeFileName);
1.175 + TFileName shn;
1.176 + // Check short name to test if there is any codepage DLL loaded already.
1.177 + r = TheFs.GetShortName(KTestNormalUnicodeFileName, shn);
1.178 + test_KErrNone(r);
1.179 +
1.180 + r = shn.Compare(KTestNormalUnicodeFileNameShortDefualt);
1.181 + test_Equal(r, 0);
1.182 +
1.183 + TFileName lgn;
1.184 + r = TheFs.GetLongName(KTestNormalUnicodeFileNameShortDefualt, lgn);
1.185 + test_KErrNone(r);
1.186 + r = lgn.Compare(KTestNormalUnicodeFileName);
1.187 + test_Equal(r, 0);
1.188 +
1.189 + // Test illegal 8-bit ASCII chars in 16-bit Unicode chars.
1.190 + MakeFile(KTestFileNameWithIllegalChars);
1.191 + r = TheFs.GetShortName(KTestFileNameWithIllegalChars, shn);
1.192 + test_KErrNone(r);
1.193 + r = shn.Compare(KFileNameWithIllegalCharsShort);
1.194 + test_Equal(r, 0);
1.195 +
1.196 + test_KErrNone(TheFs.Delete(KTestFileNameWithIllegalChars));
1.197 + test_KErrNone(TheFs.Delete(KTestNormalUnicodeFileName));
1.198 +
1.199 + r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);
1.200 + test_KErrNone(r);
1.201 +#else
1.202 + test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
1.203 +#endif // _DEBUG) || _DEBUG_RELEASE
1.204 +
1.205 + }
1.206 +
1.207 +
1.208 +//----------------------------------------------------------------------------------------------
1.209 +//! @SYMTestCaseID PBASE-t_fatcharsetconv-0407
1.210 +//! @SYMTestType CIT
1.211 +//! @SYMDEF DEF101875
1.212 +//! @SYMTestCaseDesc This test case is to test volume label setting with Unicode characters
1.213 +//! @SYMTestActions 1. Changes locale to load testing codepage dll, check returning error code
1.214 +//! 2. Sets volume label with Unicode (less than 11 bytes long), test setting
1.215 +//! success, gets volume label and compares it with the original Unicode string;
1.216 +//! 3. Sets volume label with a Unicode string contains less than 11 characters
1.217 +//! but occupies bigger than 11 bytes, checks the returning error code;
1.218 +//! 4. Compares the volume label with the Unicode string used in action 2
1.219 +//! @SYMTestExpectedResults
1.220 +//! 1. KErrNone should be returned;
1.221 +//! 2. The comparison should return 0;
1.222 +//! 3. KErrBadName should be returned;
1.223 +//! 4. The comparison should return 0;
1.224 +//! @SYMTestPriority High
1.225 +//! @SYMTestStatus Implemented
1.226 +//----------------------------------------------------------------------------------------------
1.227 +void TestUnicodeVolumeLabel()
1.228 + {
1.229 + test.Next(_L("Test unicode volume labels"));
1.230 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.231 + TInt r = UserSvr::ChangeLocale(KTestLocale);
1.232 + test_KErrNone(r);
1.233 +
1.234 + r = TheFs.SessionPath(gSessionPath);
1.235 + test_KErrNone(r);
1.236 + TInt driveNum;
1.237 + r = TheFs.CharToDrive(gSessionPath[0], driveNum);
1.238 + test_KErrNone(r);
1.239 +
1.240 + // Retrieves the original volume label
1.241 + TVolumeInfo vInfo;
1.242 + r = TheFs.Volume(vInfo, driveNum);
1.243 + const TInt KVolumeLabelSize = 11;
1.244 + TBuf<KVolumeLabelSize> originalVolumeLabel(vInfo.iName);
1.245 +
1.246 + // Tests setting volume label with unicode characters
1.247 + _LIT(KUnicodeVolumeLabel, "\x65B0\x65B0\x65B0");
1.248 +
1.249 + r = TheFs.SetVolumeLabel(KUnicodeVolumeLabel, driveNum);
1.250 + test_KErrNone(r);
1.251 + r = TheFs.Volume(vInfo, driveNum);
1.252 + test_KErrNone(r);
1.253 + r = vInfo.iName.Compare(KUnicodeVolumeLabel);
1.254 + test_Equal(r, 0);
1.255 +
1.256 + // Tests setting volume label with unicode characters that bigger than 11 bytes
1.257 + _LIT(KVolumeLabelOverflow, "\x65B0\x65B0\x65B0\x65B0\x65B0\x65B0");
1.258 + r = TheFs.SetVolumeLabel(KVolumeLabelOverflow, driveNum);
1.259 + // locale dll and codepage dll both return diff retrun values so check against both cases.
1.260 + test((r == KErrBadName) || (r == KErrOverflow));
1.261 +
1.262 + r = TheFs.Volume(vInfo, driveNum);
1.263 + test_KErrNone(r);
1.264 + r = vInfo.iName.Compare(KUnicodeVolumeLabel);
1.265 + test_Equal(r, 0);
1.266 +
1.267 + // Sets back the original volume label
1.268 + r = TheFs.SetVolumeLabel(originalVolumeLabel, driveNum);
1.269 + test_KErrNone(r);
1.270 +#else
1.271 + test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
1.272 +#endif // _DEBUG) || _DEBUG_RELEASE
1.273 + }
1.274 +
1.275 +
1.276 +//----------------------------------------------------------------------------------------------
1.277 +//! @SYMTestCaseID PBASE-t_fatcharsetconv-0408
1.278 +//! @SYMTestType CIT
1.279 +//! @SYMDEF DEF101875
1.280 +//! @SYMTestCaseDesc This test case is to test the "8 bytes" boundary of short name length,
1.281 +//! which is defined in FAT Specification.
1.282 +//! @SYMTestActions 1. Creates files and directories with different Unicode strings that
1.283 +//! have different combinations of length (of characters) and size (of
1.284 +//! bytes occupied), check for error of creation.
1.285 +//! 2. Gets their short name, compares with expected values, gets their long
1.286 +//! name, compares with original Unicode strings.
1.287 +//! The strings and short name tested are as below:
1.288 +//! 2.1. original string: "Abc"
1.289 +//! expected short name: "ABC";
1.290 +//! 2.2. original string: "\x65B0\x6587\x4EF6\x4EF6"
1.291 +//! expected short name: "\x65B0\x6587\x4EF6\x4EF6";
1.292 +//! 2.3. original string: "\x65B0\x6587\x4EF6(01)"
1.293 +//! expected short name: "\x65B0\x6587\x4EF6~1";
1.294 +//! 2.4. original string: "Abcdefghi"
1.295 +//! expected short name: "ABCDEF~1";
1.296 +//! 2.5. original string: "\x65B0(Abcdefgh)"
1.297 +//! expected short name: "\x65B0(ABC~1";
1.298 +//! @SYMTestExpectedResults
1.299 +//! 1. File should be created with no error;
1.300 +//! 2. Comparisons should return 0;
1.301 +//! @SYMTestPriority High
1.302 +//! @SYMTestStatus Implemented
1.303 +//----------------------------------------------------------------------------------------------
1.304 +void TestShortNameBoundary()
1.305 + {
1.306 + test.Next(_L("8 bytes' name boundary tests"));
1.307 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.308 + TInt r = UserSvr::ChangeLocale(KTestLocale);
1.309 + test_KErrNone(r);
1.310 +
1.311 + // File names will be used for testing boundaries
1.312 + _LIT(KTestFileName3C3B, "Abc"); // 3 characters, 3 bytes long
1.313 + _LIT(KTestFileName3C3B_short, "ABC"); // Expected short name
1.314 + _LIT(KTestFileName4C8B, "\x65B0\x6587\x4EF6\x4EF6");// 4 characters, 8 bytes long
1.315 + _LIT(KTestFileName4C8B_short, "\x65B0\x6587\x4EF6\x4EF6");// Expected short name
1.316 + _LIT(KTestFileName7C10B, "\x65B0\x6587\x4EF6(01)"); // 7 characters, 10 bytes long
1.317 + _LIT(KTestFileName7C10B_short, "\x65B0\x6587\x4EF6~1"); // Expected short name
1.318 + _LIT(KTestFileName9C9B, "Abcdefghi"); // 9 characters, 9 bytes long
1.319 + _LIT(KTestFileName9C9B_short, "ABCDEF~1"); // Expected short name
1.320 + _LIT(KTestFileName9C10B, "\x65B0(Abcdefgh)"); // 9 characters, 10 bytes long
1.321 + _LIT(KTestFileName9C10B_short, "\x65B0(ABC~1"); // Expected short name
1.322 +
1.323 + // Test file creation and long/short name generation
1.324 + doFileNameTest(KTestFileName3C3B, KTestFileName3C3B_short);
1.325 + doFileNameTest(KTestFileName4C8B, KTestFileName4C8B_short);
1.326 + doFileNameTest(KTestFileName7C10B, KTestFileName7C10B_short);
1.327 + doFileNameTest(KTestFileName9C9B, KTestFileName9C9B_short);
1.328 + doFileNameTest(KTestFileName9C10B, KTestFileName9C10B_short);
1.329 +
1.330 + doDirNameTest(KTestFileName3C3B, KTestFileName3C3B_short);
1.331 + doDirNameTest(KTestFileName4C8B, KTestFileName4C8B_short);
1.332 + doDirNameTest(KTestFileName7C10B, KTestFileName7C10B_short);
1.333 + doDirNameTest(KTestFileName9C9B, KTestFileName9C9B_short);
1.334 + doDirNameTest(KTestFileName9C10B, KTestFileName9C10B_short);
1.335 +#else
1.336 + test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
1.337 +#endif // _DEBUG) || _DEBUG_RELEASE
1.338 + }
1.339 +
1.340 +//----------------------------------------------------------------------------------------------
1.341 +//! @SYMTestCaseID PBASE-t_fatcharsetconv-0794
1.342 +//! @SYMTestCaseDesc This test case is to test the extensions of the short names generated are consistent for file names
1.343 +//! consisting of UNICODE characters. In a shortname, if the character at the third location (in 8.3 format)
1.344 +//! is a head byte of a UNICODE character then it should be ignored.
1.345 +//! @SYMTestActions 1. Creates files and directories with different Unicode strings that
1.346 +//! have different combinations of extension length (of characters) and size (of
1.347 +//! bytes occupied), check for error of creation.
1.348 +//! 2. Gets their short name, compares with expected values, gets their long
1.349 +//! name, compares with original Unicode strings.
1.350 +//! The strings and short name tested are as below:
1.351 +//! 2.1. original string: "abcdef.\x65B0"
1.352 +//! expected short name: "ABCDEF.\x65B0";
1.353 +//! 2.2. original string: "abcdef.t\x65B0"
1.354 +//! expected short name: "ABCDEF.T\x65B0";
1.355 +//! 2.3. original string: "abcdef.\x65B0t"
1.356 +//! expected short name: "ABCDEF.\x65B0T";
1.357 +//! 2.4. original string: "abcdefg.\x65B0\x65B0"
1.358 +//! expected short name: "ABCDEF~1.\x65B0";
1.359 +//!
1.360 +//! @SYMTestExpectedResults
1.361 +//! 1. File should be created with no error;
1.362 +//! 2. Comparisons should return 0;
1.363 +//! @SYMTestPriority High
1.364 +//! @SYMTestStatus Implemented
1.365 +//----------------------------------------------------------------------------------------------
1.366 +
1.367 +void TestConsistentShortNameExtGeneration()
1.368 + {
1.369 + test.Next(_L("Test consistent short name extensions are generated"));
1.370 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.371 + TInt r = UserSvr::ChangeLocale(KTestLocale);
1.372 + test_KErrNone(r);
1.373 +
1.374 + // File names will be used for testing boundaries
1.375 + _LIT(KTestFileNameExt1C2B, "abcdefg.\x65B0"); // 1 characters, 2 bytes long ;only one Unicode character in the extension
1.376 + _LIT(KTestFileNameExt1C2B_short, "ABCDEFG.\x65B0"); //Expected short name
1.377 + _LIT(KTestFileNameExt2C3B2U, "abcdefg.t\x65B0"); // 2 characters, 3 bytes long ;Unicode character at the 2nd location of the extension
1.378 + _LIT(KTestFileNameExt2C3B2U_short, "ABCDEFG.T\x65B0"); //Expected short name
1.379 + _LIT(KTestFileNameExt2C3B1U, "abcdefg.\x65B0t"); // 2 characters, 3 bytes long ;Unicode character at the 1st location of the extension
1.380 + _LIT(KTestFileNameExt2C3B1U_short, "ABCDEFG.\x65B0T"); //Expected short name
1.381 + _LIT(KTestFileNameExt2C4B, "abcdefg.\x65B0\x65B0");// 2 characters, 4 bytes long ;both are Unicode characters in the extension
1.382 + _LIT(KTestFileNameExt2C4B_short, "ABCDEF~1.\x65B0"); //Expected short name
1.383 +
1.384 +
1.385 + // Test file creation and long/short name generation
1.386 + doFileNameTest(KTestFileNameExt1C2B, KTestFileNameExt1C2B_short);
1.387 + doFileNameTest(KTestFileNameExt2C3B2U, KTestFileNameExt2C3B2U_short);
1.388 + doFileNameTest(KTestFileNameExt2C3B1U, KTestFileNameExt2C3B1U_short);
1.389 + doFileNameTest(KTestFileNameExt2C4B, KTestFileNameExt2C4B_short);
1.390 +
1.391 + doDirNameTest(KTestFileNameExt1C2B, KTestFileNameExt1C2B_short);
1.392 + doDirNameTest(KTestFileNameExt2C3B2U, KTestFileNameExt2C3B2U_short);
1.393 + doDirNameTest(KTestFileNameExt2C3B1U, KTestFileNameExt2C3B1U_short);
1.394 + doDirNameTest(KTestFileNameExt2C4B, KTestFileNameExt2C4B_short);
1.395 +#else
1.396 + test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
1.397 +#endif // _DEBUG) || _DEBUG_RELEASE
1.398 + }
1.399 +
1.400 +
1.401 +//----------------------------------------------------------------------------------------------
1.402 +//! @SYMTestCaseID PBASE-t_fatcharsetconv-0795
1.403 +//! @SYMTestCaseDesc This test case is to test whether the short names generated for file names
1.404 +//! consisting of UNICODE characters are consistent or not. In a shortname, if the character immediately
1.405 +//! preceding the tilde(~) is a head byte of a UNICODE character then it should be ignored.
1.406 +//! @SYMTestActions 1. Creates files and directories with different Unicode strings that
1.407 +//! have different combinations of length (of characters) and size (of
1.408 +//! bytes occupied), check for error of creation.
1.409 +//! 2. Gets their short name, compares with expected values, gets their long
1.410 +//! name, compares with original Unicode strings.
1.411 +//! The strings and short name tested are as below:
1.412 +//! 2.1. original string: "a\x65B0(bcd)"
1.413 +//! expected short name: "A\x65B0(BCD)";
1.414 +//! 2.2. original string: "ab\x65B0(cdef)"
1.415 +//! expected short name: "AB\x65B0(C~1")";
1.416 +//! 2.3. original string: "abc\x65B0(def)"
1.417 +//! expected short name: "ABC\x65B0(~1";
1.418 +//! 2.4. original string: "abcd\x65B0(ef)"
1.419 +//! expected short name: "ABCD\x65B0~1";
1.420 +//! 2.5. original string: "abcde\x65B0(f)"
1.421 +//! expected short name: "ABCDE~1";
1.422 +//! @SYMTestExpectedResults
1.423 +//! 1. File should be created with no error;
1.424 +//! 2. Comparisons should return 0;
1.425 +//! @SYMTestPriority High
1.426 +//! @SYMTestStatus Implemented
1.427 +//----------------------------------------------------------------------------------------------
1.428 +void TestConsistentShortNameGeneration()
1.429 + {
1.430 + test.Next(_L("Test consistent short name generation"));
1.431 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.432 + TInt r = UserSvr::ChangeLocale(KTestLocale);
1.433 + test_KErrNone(r);
1.434 +
1.435 + //unicode characters.
1.436 +
1.437 + _LIT(KTestFileName7C8B2U, "a\x65B0(bcd)"); // 7 characters, 8 bytes long ,Unicode character at the 2nd location.
1.438 + _LIT(KTestFileName7C8B2U_short, "A\x65B0(BCD)"); // Expected short name
1.439 + _LIT(KTestFileName9C10B3U, "ab\x65B0(cdef)"); // 9 characters, 10 bytes long ,Unicode character at the 3rd location.
1.440 + _LIT(KTestFileName9C10B3U_short,"AB\x65B0(C~1"); // Expected short name
1.441 + _LIT(KTestFileName9C10B4U, "abc\x65B0(def)"); // 9 characters, 10 bytes long ,Unicode character at the 4th location.
1.442 + _LIT(KTestFileName9C10B4U_short,"ABC\x65B0(~1"); // Expected short name
1.443 + _LIT(KTestFileName9C10B5U, "abcd\x65B0(ef)"); // 9 characters, 10 bytes long ,Unicode character at the 6th location.
1.444 + _LIT(KTestFileName9C10B5U_short,"ABCD\x65B0~1"); // Expected short name
1.445 + _LIT(KTestFileName9C10B6U, "abcde\x65B0(f)"); // 9 characters, 10 bytes long ,repeat Unicode character at the 6th location.
1.446 + _LIT(KTestFileName9C10B6U_short,"ABCDE~1"); // Expected short name
1.447 +
1.448 + // Test file creation and long/short name generation
1.449 + doFileNameTest(KTestFileName7C8B2U, KTestFileName7C8B2U_short);
1.450 + doFileNameTest(KTestFileName9C10B3U, KTestFileName9C10B3U_short);
1.451 + doFileNameTest(KTestFileName9C10B4U, KTestFileName9C10B4U_short);
1.452 + doFileNameTest(KTestFileName9C10B5U, KTestFileName9C10B5U_short);
1.453 + doFileNameTest(KTestFileName9C10B6U, KTestFileName9C10B6U_short);
1.454 +
1.455 + doDirNameTest(KTestFileName7C8B2U, KTestFileName7C8B2U_short);
1.456 + doDirNameTest(KTestFileName9C10B3U, KTestFileName9C10B3U_short);
1.457 + doDirNameTest(KTestFileName9C10B4U, KTestFileName9C10B4U_short);
1.458 + doDirNameTest(KTestFileName9C10B5U, KTestFileName9C10B5U_short);
1.459 + doDirNameTest(KTestFileName9C10B6U, KTestFileName9C10B6U_short);
1.460 +#else
1.461 + test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
1.462 +#endif // _DEBUG) || _DEBUG_RELEASE
1.463 + }
1.464 +
1.465 +//----------------------------------------------------------------------------------------------
1.466 +//! @SYMTestCaseID PBASE-t_fatcharsetconv-0409
1.467 +//! @SYMTestType CIT
1.468 +//! @SYMDEF DEF101875 INC100580
1.469 +//! @SYMTestCaseDesc This test case is to test creation of files with their Unicode names are
1.470 +//! duplicate to existing files.
1.471 +//! @SYMTestActions 1. Creates a file with its name contains 4 Unicode characters but occupies
1.472 +//! 8 bytes ("\x65B0\x6587\x4EF6\x4EF6"), check for creation;
1.473 +//! 2. Creates a file with 11 bytes' long Unicode name and first 8 bytes are
1.474 +//! identical with the file created in Action 1 ("\x65B0\x6587\x4EF6\x4EF6(A)"),
1.475 +//! check for file creation;
1.476 +//! 3. Gets the short name of the file created in Action 2, compares it with
1.477 +//! expected short name ("\x65B0\x6587\x4EF6~1"), gets the long name of this
1.478 +//! file and compares it with its original Unicode name;
1.479 +//! 4. Creates a file with 12 bytes' long Unicode name and first 8 bytes are
1.480 +//! identical with the file created in Action 1 and Action 2
1.481 +//! ("\x65B0\x6587\x4EF6\x4EF6(AB)"), check for file creation;
1.482 +//! 5. Gets the short name of the file created in Action 4, compares it with
1.483 +//! expected values ("\x65B0\x6587\x4EF6~2"), gets the long name of this file
1.484 +//! and compares it with its original Unicode name;
1.485 +//! @SYMTestExpectedResults
1.486 +//! 1. File creation should return KErrNone;
1.487 +//! 2. File creation should return KErrNone;
1.488 +//! 3. Comparisons should return 0;
1.489 +//! 4. File creation should return KErrNone;
1.490 +//! 5. Comparisons should return 0;
1.491 +//! @SYMTestPriority High
1.492 +//! @SYMTestStatus Implemented
1.493 +//----------------------------------------------------------------------------------------------
1.494 +void TestDuplicateLongFileNames()
1.495 + {
1.496 + test.Next(_L("Testing tilde and numbers (\"~n\") are applied correctly for multiple long-named files"));
1.497 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.498 + TInt r = UserSvr::ChangeLocale(KTestLocale);
1.499 + test_KErrNone(r);
1.500 +
1.501 + // These are to test "~1", "~2" behaviours when the first 8 bytes of new files
1.502 + // are identical with existing files
1.503 + _LIT(KTestFileName4C8B, "\x65B0\x6587\x4EF6\x4EF6.TXT");
1.504 + _LIT(KTestFileName7C11B, "\x65B0\x6587\x4EF6\x4EF6(A).TXT");
1.505 + _LIT(KTestFileName7C11B_short, "\x65B0\x6587\x4EF6~1.TXT");
1.506 + _LIT(KTestFileName8C12B, "\x65B0\x6587\x4EF6\x4EF6(AB).TXT");
1.507 + _LIT(KTestFileName8C12B_short, "\x65B0\x6587\x4EF6~2.TXT");
1.508 +
1.509 + ////////////////////////////////////////
1.510 + // 1. Test duplicate long file names
1.511 + ////////////////////////////////////////
1.512 + TFileName sn;
1.513 +
1.514 + MakeFile(KTestFileName4C8B);
1.515 + MakeFile(KTestFileName7C11B);
1.516 +
1.517 + r = TheFs.GetShortName(KTestFileName7C11B, sn);
1.518 + test_KErrNone(r);
1.519 + r = sn.Compare(KTestFileName7C11B_short);
1.520 + test_Equal(r, 0);
1.521 +
1.522 +
1.523 + MakeFile(KTestFileName8C12B);
1.524 +
1.525 + r = TheFs.GetShortName(KTestFileName8C12B, sn);
1.526 + test_KErrNone(r);
1.527 + r = sn.Compare(KTestFileName8C12B_short);
1.528 + test_Equal(r, 0);
1.529 +
1.530 + test_KErrNone(TheFs.Delete(KTestFileName4C8B));
1.531 + test_KErrNone(TheFs.Delete(KTestFileName7C11B));
1.532 + test_KErrNone(TheFs.Delete(KTestFileName8C12B));
1.533 +
1.534 +#else
1.535 + test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
1.536 +#endif // _DEBUG) || _DEBUG_RELEASE
1.537 + }
1.538 +
1.539 +
1.540 +//----------------------------------------------------------------------------------------------
1.541 +//! @SYMTestCaseID PBASE-t_fatcharsetconv-0410
1.542 +//! @SYMTestType CIT
1.543 +//! @SYMDEF DEF101875 INC100580
1.544 +//! @SYMTestCaseDesc This test case is to test creation of directories with their Unicode names are
1.545 +//! duplicate to existing directories .
1.546 +//! @SYMTestActions 1. Creates a directories with its name contains 4 Unicode characters but occupies
1.547 +//! 8 bytes ("\x65B0\x6587\x4EF6\x4EF6"), check for creation;
1.548 +//! 2. Creates a directories with 11 bytes' long Unicode name and first 8 bytes are
1.549 +//! identical with the directories created in Action 1 ("\x65B0\x6587\x4EF6\x4EF6(A)"),
1.550 +//! check for file creation;
1.551 +//! 3. Gets the short name of the directories created in Action 2, compares it with
1.552 +//! expected short name ("\x65B0\x6587\x4EF6~1"), gets the long name of this
1.553 +//! directories and compares it with its original Unicode name;
1.554 +//! 4. Creates a directories with 12 bytes' long Unicode name and first 8 bytes are
1.555 +//! identical with the directories created in Action 1 and Action 2
1.556 +//! ("\x65B0\x6587\x4EF6\x4EF6(AB)"), check for directories creation;
1.557 +//! 5. Gets the short name of the directories created in Action 4, compares it with
1.558 +//! expected values ("\x65B0\x6587\x4EF6~2"), gets the long name of this directories
1.559 +//! and compares it with its original Unicode name;
1.560 +//! @SYMTestExpectedResults
1.561 +//! 1. Dir creation should return KErrNone;
1.562 +//! 2. Dir creation should return KErrNone;
1.563 +//! 3. Comparisons should return 0;
1.564 +//! 4. Dir creation should return KErrNone;
1.565 +//! 5. Comparisons should return 0;
1.566 +//! @SYMTestPriority High
1.567 +//! @SYMTestStatus Implemented
1.568 +//----------------------------------------------------------------------------------------------
1.569 +void TestDuplicateLongDirNames()
1.570 + {
1.571 + test.Next(_L("Testing tilde and number appended correctly for duplicate long name dirs"));
1.572 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.573 + TheFs.SessionPath(gSessionPath);
1.574 + TInt r = UserSvr::ChangeLocale(KTestLocale);
1.575 + test_KErrNone(r);
1.576 +
1.577 + // These are to test "~1", "~2" behaviours when the first 8 bytes of new directories
1.578 + // are identical with existing directories
1.579 + _LIT(KTestDirName4C8B, "\\F32-TST\\T_LOCALEUTILS_CP932\\\x65B0\x6587\x4EF6\x4EF6\\");
1.580 + _LIT(KTestDirName7C11B, "\\F32-TST\\T_LOCALEUTILS_CP932\\\x65B0\x6587\x4EF6\x4EF6(A)\\");
1.581 + _LIT(KTestDirName7C11B_short, "\x65B0\x6587\x4EF6~1");
1.582 + _LIT(KTestDirName8C12B, "\\F32-TST\\T_LOCALEUTILS_CP932\\\x65B0\x6587\x4EF6\x4EF6(AB)\\");
1.583 + _LIT(KTestDirName8C12B_short, "\x65B0\x6587\x4EF6~2");
1.584 +
1.585 + // Create 1st file with 8 bytes long/short name
1.586 + MakeDir(KTestDirName4C8B);
1.587 + MakeDir(KTestDirName7C11B);
1.588 + TFileName sn;
1.589 +
1.590 + r = TheFs.GetShortName(KTestDirName7C11B, sn);
1.591 + test_KErrNone(r);
1.592 + r = sn.Compare(KTestDirName7C11B_short);
1.593 + test_Equal(r, 0);
1.594 +
1.595 + MakeDir(KTestDirName8C12B);
1.596 +
1.597 + r = TheFs.GetShortName(KTestDirName8C12B, sn);
1.598 + test_KErrNone(r);
1.599 + r = sn.Compare(KTestDirName8C12B_short);
1.600 + test_Equal(r, 0);
1.601 +
1.602 +#else
1.603 + test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
1.604 +#endif // _DEBUG) || _DEBUG_RELEASE
1.605 + }
1.606 +
1.607 +//----------------------------------------------------------------------------------------------
1.608 +//! @SYMTestCaseID PBASE-t_fatcharsetconv-0791
1.609 +//! @SYMTestType CIT
1.610 +//! @SYMDEF DEF117345
1.611 +//! @SYMTestCaseDesc This test case is to test short name with 'E5' as the leading byte is correctly
1.612 +//! handled on FAT implementations
1.613 +//! @SYMTestActions 1. Creates a file with unicode long name "\x88F9.TXT", it will be converted into
1.614 +//! "\xE5E5.TXT" according to codepage 932 when creating short name.
1.615 +//! 2. Gets the short name and compare it with its original unicode "\x88F9.TXT", make
1.616 +//! sure the conversion "\xE5E5.TXT" has been handled correctly
1.617 +//! @SYMTestExpectedResults
1.618 +//! 1. Comparisons should return 0;
1.619 +//! @SYMTestPriority High
1.620 +//! @SYMTestStatus Implemented
1.621 +//----------------------------------------------------------------------------------------------
1.622 +void TestLeadingE5Handling()
1.623 + {
1.624 + test.Next(_L("Test Leading \'E5\' byte handling (DEF117345)"));
1.625 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.626 + TheFs.SessionPath(gSessionPath);
1.627 + TInt r = UserSvr::ChangeLocale(KTestLocale);
1.628 + test_KErrNone(r);
1.629 +
1.630 + _LIT(KTestFilePathAndName, "\\F32-TST\\T_LOCALEUTILS_CP932\\\x88F9.TXT");
1.631 + _LIT(KTestFileShortName, "\x88F9.TXT");
1.632 +
1.633 + MakeFile(KTestFilePathAndName);
1.634 + TFileName sn;
1.635 + r = TheFs.GetShortName(KTestFilePathAndName, sn);
1.636 + test_KErrNone(r);
1.637 + r = sn.Compare(KTestFileShortName);
1.638 + test_Equal(r, 0);
1.639 +
1.640 +#else
1.641 + test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
1.642 +#endif // _DEBUG) || _DEBUG_RELEASE
1.643 + }
1.644 +//----------------------------------------------------------------------------------------------
1.645 +//! @SYMTestCaseID PBASE-t_fatcharsetconv-2320
1.646 +//! @SYMTestType CIT
1.647 +//! @SYMDEF PDEF130334
1.648 +//! @SYMTestCaseDesc This test case is to test creating a file with "\u3005" name correctly
1.649 +//! @SYMTestActions 1. Creates a file with unicode long name "\u3005.TXT"
1.650 +//! 2. Gets the short name and compare it with its original unicode "\u3005.TXT"
1.651 +//! 3. Gets the long name and compare it with its original unicode "\u3005.TXT"
1.652 +//! @SYMTestExpectedResults
1.653 +//! 1. Comparisons should return 0;
1.654 +//! @SYMTestPriority High
1.655 +//! @SYMTestStatus Implemented
1.656 +//----------------------------------------------------------------------------------------------
1.657 +void TestDEF130334()
1.658 + {
1.659 + test.Next(_L("Test creating a file with \\x3005 name correctly (DEF128521)"));
1.660 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.661 + TheFs.SessionPath(gSessionPath);
1.662 + TInt r = UserSvr::ChangeLocale(KTestLocale);
1.663 + test_KErrNone(r);
1.664 +
1.665 + _LIT(KTestFilePathAndName, "\\F32-TST\\T_LOCALEUTILS_CP932\\\x3005.TXT");
1.666 + _LIT(KTestFileName, "\x3005.TXT");
1.667 +
1.668 + MakeFile(KTestFilePathAndName);
1.669 + TFileName sn;
1.670 + r = TheFs.GetShortName(KTestFilePathAndName, sn);
1.671 + test_KErrNone(r);
1.672 + r = sn.Compare(KTestFileName);
1.673 + test_Equal(r, 0);
1.674 + TFileName ln;
1.675 + r = TheFs.GetLongName(KTestFilePathAndName, ln);
1.676 + test_KErrNone(r);
1.677 + r = ln.Compare(KTestFileName);
1.678 + test_Equal(r, 0);
1.679 +
1.680 +#else
1.681 + test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
1.682 +#endif
1.683 + }
1.684 +//----------------------------------------------------------------------------------------------
1.685 +//! @SYMTestCaseID PBASE-t_fatcharsetconv-1359
1.686 +//! @SYMTestType CIT
1.687 +//! @SYMDEF INC125768
1.688 +//! @SYMTestCaseDesc This test case is to test the compatibility of file opening, to make sure files
1.689 +//! with only one DOS entry which contains unicode short name is accessible on Symbian OS
1.690 +//! from version 9.3 onwards.
1.691 +//! @SYMTestActions Manually creates a single entried, unicode named file under root direcotry, then
1.692 +//! access it via RFs::Entry() API using its uniocde name. Check the entry is accessible.
1.693 +//! @SYMTestExpectedResults
1.694 +//! RFs::Entry() should return with KErrNone;
1.695 +//! @SYMTestPriority High
1.696 +//! @SYMTestStatus Implemented
1.697 +//----------------------------------------------------------------------------------------------
1.698 +void TestCompatibility()
1.699 + {
1.700 + test.Next(_L("test file opening compatibility"));
1.701 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.702 + GetBootInfo();
1.703 +
1.704 + RFile file;
1.705 + TFileName fn = _L("\\ABCD");
1.706 +
1.707 + TInt r=file.Create(TheFs,fn,EFileRead);
1.708 + test(r==KErrNone);
1.709 + file.Close();
1.710 +
1.711 + // Assume this file is the first entry in the root directory
1.712 + r=TheDisk.Open(TheFs,CurrentDrive());
1.713 + test(r==KErrNone);
1.714 +
1.715 + //-- read the 1st dir entry, it should be a DOS entry
1.716 + const TInt posEntry1=gBootSector.RootDirStartSector() << KDefaultSectorLog2; //-- dir entry1 position
1.717 +
1.718 + TFatDirEntry fatEntry1;
1.719 + TPtr8 ptrEntry1((TUint8*)&fatEntry1,sizeof(TFatDirEntry));
1.720 + test(TheDisk.Read(posEntry1, ptrEntry1)==KErrNone);
1.721 + test(!fatEntry1.IsVFatEntry());
1.722 +
1.723 + // Manually modify the short name into unicode characters
1.724 + // Unicode: 0x(798F 5C71 96C5 6CBB)
1.725 + // Shift-JIS: 0x(959F 8E52 89EB 8EA1)
1.726 +
1.727 + TBuf8<8> unicodeSN = _L8("ABCD1234");
1.728 + unicodeSN[0] = 0x95;
1.729 + unicodeSN[1] = 0x9F;
1.730 + unicodeSN[2] = 0x8E;
1.731 + unicodeSN[3] = 0x52;
1.732 + unicodeSN[4] = 0x89;
1.733 + unicodeSN[5] = 0xEB;
1.734 + unicodeSN[6] = 0x8E;
1.735 + unicodeSN[7] = 0xA1;
1.736 +
1.737 + fatEntry1.SetName(unicodeSN);
1.738 + test(TheDisk.Write(posEntry1, ptrEntry1)==KErrNone);
1.739 + TheDisk.Close();
1.740 +
1.741 + // Access the file using its unicode file name
1.742 + r = UserSvr::ChangeLocale(KTestLocale);
1.743 + test_KErrNone(r);
1.744 +
1.745 + fn = _L("\\ABCD");
1.746 + fn[1] = 0x798F;
1.747 + fn[2] = 0x5C71;
1.748 + fn[3] = 0x96C5;
1.749 + fn[4] = 0x6CBB;
1.750 +
1.751 + TEntry entry;
1.752 + TInt err = TheFs.Entry(fn, entry);
1.753 + test(err==KErrNone);
1.754 + err = TheFs.Delete(fn);
1.755 + test(err==KErrNone);
1.756 +#else
1.757 + test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
1.758 +#endif // _DEBUG) || _DEBUG_RELEASE
1.759 + }
1.760 +
1.761 +//----------------------------------------------------------------------------------------------
1.762 +//! @SYMTestCaseID PBASE-t_fatcharsetconv-1395
1.763 +//! @SYMTestType CIT
1.764 +//! @SYMDEF INC126563
1.765 +//! @SYMTestCaseDesc This test case is to test the definition of valid DOS characters on Symbian
1.766 +//! FAT/FAT32 complies with FAT Spec.
1.767 +//! @SYMTestActions Manually creates a file with "0x7F" characters in its name, then check it can
1.768 +//! ben accessed successfully.
1.769 +//! @SYMTestExpectedResults
1.770 +//! RFs::Entry() should return with KErrNone;
1.771 +//! @SYMTestPriority High
1.772 +//! @SYMTestStatus Implemented
1.773 +//----------------------------------------------------------------------------------------------
1.774 +void TestINC126563()
1.775 + {
1.776 + test.Next(_L("Test INC126563: FAT/FAT32: unable to open or delete file whose name contains illegal characters"));
1.777 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.778 + GetBootInfo();
1.779 +
1.780 + RFile file;
1.781 + TFileName fn = _L("\\AB");
1.782 +
1.783 + test.Next(_L("create file \"AB\" under root directory"));
1.784 + TInt r=file.Create(TheFs,fn,EFileRead);
1.785 + test(r==KErrNone);
1.786 + file.Close();
1.787 +
1.788 + test.Next(_L("manually change file name to \"0x7F0x450x7F0x45\" via raw disk accessing"));
1.789 + // Assume this file is the first entry in the root directory
1.790 + r=TheDisk.Open(TheFs,CurrentDrive());
1.791 + test(r==KErrNone);
1.792 +
1.793 + //-- read the first dir entry, it should be a DOS entry
1.794 + const TInt posEntry1=gBootSector.RootDirStartSector() << KDefaultSectorLog2; //-- dir entry1 position
1.795 +
1.796 + TFatDirEntry fatEntry1;
1.797 + TPtr8 ptrEntry1((TUint8*)&fatEntry1,sizeof(TFatDirEntry));
1.798 + test(TheDisk.Read(posEntry1, ptrEntry1)==KErrNone);
1.799 + test(!fatEntry1.IsVFatEntry());
1.800 +
1.801 + TBuf8<8> unicodeSN = _L8("ABCD");
1.802 + unicodeSN[0] = 0x7F;
1.803 + unicodeSN[1] = 0x45;
1.804 + unicodeSN[2] = 0x7F;
1.805 + unicodeSN[3] = 0x45;
1.806 +
1.807 + fatEntry1.SetName(unicodeSN);
1.808 + test(TheDisk.Write(posEntry1, ptrEntry1)==KErrNone);
1.809 + TheDisk.Close();
1.810 +
1.811 + // Access the file using its unicode file name
1.812 + r = UserSvr::ChangeLocale(KTestLocale);
1.813 + test(KErrNone==r);
1.814 +
1.815 + test.Next(_L("access entries under root directory via RDir::Open()"));
1.816 + RDir dir;
1.817 + r = dir.Open(TheFs, _L("\\"), KEntryAttNormal);
1.818 + test(KErrNone == r);
1.819 + TEntryArray entryArray;
1.820 + r = dir.Read(entryArray);
1.821 + test(entryArray.Count()==1);
1.822 + TBuf<0x10> name;
1.823 + TEntry entry;
1.824 + entry = entryArray[0];
1.825 + test.Printf(_L("entryArray[0] = \"%S\"\n"), &entry.iName);
1.826 + name = entry.iName;
1.827 + dir.Close();
1.828 +
1.829 + TFileName fullname= _L("\\");
1.830 + fullname.Append(name);
1.831 +
1.832 + test.Next(_L("try to open or delete file entries retrieved"));
1.833 + r = file.Open(TheFs, fullname, EFileRead);
1.834 + test(KErrNone == r);
1.835 + file.Close();
1.836 +
1.837 + r = TheFs.Delete(fullname);
1.838 + test(KErrNone == r);
1.839 +#else
1.840 + test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
1.841 +#endif // _DEBUG) || _DEBUG_RELEASE
1.842 + }
1.843 +
1.844 +//----------------------------------------------------------------------------------------------
1.845 +//! @SYMTestCaseID PBASE-t_fatcharsetconv-1402
1.846 +//! @SYMTestType CIT
1.847 +//! @SYMDEF INC127905
1.848 +//! @SYMTestCaseDesc This test case is to test RFs::ScanDrive() does not incorrectly remove files
1.849 +//! with unicode short file names.
1.850 +//! @SYMTestActions Creates a file with unicode file names then check if the file is still accessible
1.851 +//! after scandrive operations.
1.852 +//! @SYMTestExpectedResults
1.853 +//! RFs::Delete() should return with KErrNone;
1.854 +//! @SYMTestPriority High
1.855 +//! @SYMTestStatus Implemented
1.856 +//----------------------------------------------------------------------------------------------
1.857 +void TestINC127905()
1.858 + {
1.859 + test.Next(_L("Test INC127905: Unicode name file deleted after Scandrive"));
1.860 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.861 + TFileName fn = _L("ABCDE");
1.862 + fn[0] = 0x3055;
1.863 + fn[1] = 0x307E;
1.864 + fn[2] = 0x3056;
1.865 + fn[3] = 0x307E;
1.866 + fn[4] = 0x306A;
1.867 +
1.868 + TInt r = UserSvr::ChangeLocale(KTestLocale);
1.869 + test(KErrNone==r);
1.870 +
1.871 + MakeFile(fn);
1.872 +
1.873 + _LIT(KShortName, "\x3055\x307E\x3056~1");
1.874 + TFileName sn;
1.875 + r = TheFs.GetShortName(fn, sn);
1.876 + test(r==KErrNone);
1.877 + r = sn.Compare(KShortName);
1.878 + test(r==0);
1.879 +
1.880 + r = TheFs.ScanDrive(_L("gSessionPath"));
1.881 + test(r==KErrNone);
1.882 +
1.883 + r = TheFs.Delete(fn);
1.884 + test(r == KErrNone);
1.885 +#else
1.886 + test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
1.887 +#endif // _DEBUG) || _DEBUG_RELEASE
1.888 + }
1.889 +
1.890 +void CallTestsL(void)
1.891 + {
1.892 +
1.893 + test.Title();
1.894 + test.Start(_L("Starting T_LOCALEUTILS_CP932 tests"));
1.895 +
1.896 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.897 +
1.898 + // Test only runs on Fat file systems
1.899 + TheFs.SessionPath(gSessionPath);
1.900 + TInt driveNum = CurrentDrive();
1.901 + TFSName name;
1.902 + TInt r = TheFs.FileSystemName(name, driveNum);
1.903 + if (KErrNone == r)
1.904 + {
1.905 + if (name.Compare(_L("Fat")) != 0)
1.906 + {
1.907 + test.Printf(_L("Test only runs on 'Fat' drives"));
1.908 + }
1.909 + else
1.910 + {
1.911 + // Enables codepage dll implementation of LocaleUtils functions for this test only
1.912 + r = TheFs.ControlIo(driveNum, KControlIoEnableFatUtilityFunctions);
1.913 + test_KErrNone(r);
1.914 +
1.915 + CreateTestDirectory(_L("\\F32-TST\\T_LOCALEUTILS_CP932\\"));
1.916 + TestBeforeFATCharsetConvInteg();
1.917 + TestUnicodeVolumeLabel();
1.918 + TestShortNameBoundary();
1.919 + TestConsistentShortNameGeneration();
1.920 + TestConsistentShortNameExtGeneration();
1.921 + TestDuplicateLongFileNames();
1.922 + TestDuplicateLongDirNames();
1.923 + TestLeadingE5Handling();
1.924 + TestDEF130334();
1.925 + TestINC127905();
1.926 + DeleteTestDirectory();
1.927 +
1.928 + TestCompatibility();
1.929 + TestINC126563();
1.930 + // Disables codepage dll implementation of LocaleUtils functions for other base tests
1.931 + r = TheFs.ControlIo(driveNum, KControlIoDisableFatUtilityFunctions);
1.932 + test_KErrNone(r);
1.933 + }
1.934 + }
1.935 + else
1.936 + {
1.937 + test.Printf(_L("Drive %C: is not ready!"), 'A'+driveNum);
1.938 + test(EFalse);
1.939 + }
1.940 +#else
1.941 + test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
1.942 +#endif // _DEBUG) || _DEBUG_RELEASE
1.943 + test.End();
1.944 + }