os/kernelhwsrv/kerneltest/f32test/outsideBMP/src/t_surrogatepair.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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 // f32test\locl\localeutils\T_SURROGATEPAIR.cpp
    15 // 
    16 //
    17 
    18 #define __E32TEST_EXTENSION__
    19 
    20 #include <e32test.h>
    21 #include <HAL.H>
    22 #include <f32fsys.h>
    23 #include <f32dbg.h>
    24 #include "..\server\t_server.h"
    25 
    26 RTest test(_L("T_SURROGATEPAIR"));
    27 
    28 /* 
    29  * Helper function to capture and return any MakeFile error code.
    30  */
    31 TInt SurrogatePair_MakeFile(const TDesC& aFileName)
    32 	{
    33 	RFile file;
    34 	TInt r=file.Replace(TheFs,aFileName,0);
    35 	file.Close();
    36 	return r;
    37 	}
    38 
    39 /*
    40  *  Tests given ShortName against LongName and vice versa for a File Entry.
    41  */
    42 void doFileNameTest(const TDesC& aLongName, const TDesC& aShortName)
    43 	{
    44 	TFileName lgnFullPath;
    45 	TFileName shnFullPath;
    46 	TFileName lgn;
    47 	TFileName shn;
    48 
    49 	TInt r = TheFs.SessionPath(gSessionPath);
    50 	test_KErrNone(r);
    51 	lgnFullPath = gSessionPath;
    52 	lgnFullPath += aLongName;
    53 
    54 	MakeFile(lgnFullPath);
    55 
    56 	// Check short name	
    57 	r = TheFs.GetShortName(lgnFullPath, shn);
    58 	test_KErrNone(r);
    59 	r = shn.Compare(aShortName);
    60 	test(r==0);
    61 
    62 	// Check long name	
    63 	shnFullPath = gSessionPath;
    64 	shnFullPath += aShortName;
    65 
    66 	r = TheFs.GetLongName(shnFullPath, lgn);
    67 	test_KErrNone(r);
    68 	r = lgn.Compare(aLongName);
    69 	test(r==0);
    70 
    71 	test_KErrNone(TheFs.Delete(lgnFullPath));
    72 	}
    73 
    74 /*
    75  *  Tests given ShortName against LongName and vice versa for a Directory Entry.
    76  */
    77 void doDirNameTest(const TDesC& aLongName, const TDesC& aShortName)
    78 	{
    79 	TBuf<KMaxFileName> longDirNamePath;
    80 	TBuf<KMaxFileName> shortDirNamePath;
    81 	TBuf<KMaxFileName> longName;
    82 	TBuf<KMaxFileName> shortName;
    83 	longDirNamePath = gSessionPath;
    84 	longDirNamePath += aLongName;
    85 	longDirNamePath.Append('\\');
    86 
    87 	// Create new directory and check creation
    88 	TInt r = TheFs.MkDir(longDirNamePath);
    89 	test_KErrNone(r);
    90 	TUint dumUint=0;
    91 	CDir* dumDir;
    92 	r= TheFs.GetDir(longDirNamePath, dumUint, dumUint, dumDir);
    93 	test_KErrNone(r);
    94 	test_NotNull(dumDir);
    95 	delete dumDir;
    96 
    97 	// Check short name
    98 	r = TheFs.GetShortName(longDirNamePath, shortName);
    99 	test_KErrNone(r);
   100 	r = shortName.Compare(aShortName);
   101 	test(r==0);
   102 	
   103 	// Check long name
   104 	shortDirNamePath = gSessionPath;
   105 	shortDirNamePath += shortName;
   106 	shortDirNamePath.Append('\\');
   107 	r = TheFs.GetLongName(shortDirNamePath, longName);
   108 	test_KErrNone(r);
   109 	r = longName.Compare(aLongName);
   110 	test(r==0);
   111 
   112 	r = TheFs.RmDir(longDirNamePath);
   113 	test_KErrNone(r);
   114 	}
   115 
   116 /*
   117  *  Tests File entry and Dir entry.
   118  */
   119 void TestConversion(const TDesC& aLongName, const TDesC& aShortName)
   120 	{
   121 	doFileNameTest(aLongName, aShortName);
   122 	doDirNameTest(aLongName, aShortName);
   123 	}
   124 
   125 /*
   126  * Tests different characters for its validity and conversion in absence of cp dll.
   127  * Expects ReplacementForUnconvertibleUnicodeCharacters : "_" : UNDERSCORE for all
   128  * Illegal Characters
   129  */
   130 void TestShortNameCharacter()
   131 	{
   132 	test.Next(_L("++TestShortNameCharacter"));
   133 	TInt r;
   134 	
   135 	// one-byte chars
   136 	_LIT16(Uni_1, 									"\x0019.TXT");
   137 	_LIT16(Uni_1_ShortName, 						"_.TXT");
   138 	TestConversion( Uni_1, Uni_1_ShortName);
   139 	
   140 	_LIT16(Uni_2, 									"\x0020.TXT");
   141 	_LIT(Uni_2_ShortName, 							"_.TXT");
   142 	TestConversion( Uni_2, Uni_2_ShortName);
   143 	
   144 	_LIT16(Uni_3, 									"\x0021.TXT");
   145 	_LIT16(Uni_3_ShortName, 						"\x0021.TXT");
   146 	TestConversion( Uni_3, Uni_3_ShortName);
   147 
   148  	_LIT16(Uni_4, 									"\x0079"); // y lower case 
   149 	_LIT16(Uni_4_ShortName, 						"\x0059");	// Y upper case
   150 	TestConversion( Uni_4, Uni_4_ShortName);
   151 
   152 	_LIT16(Uni_5,									"\x0080");
   153 	_LIT16(Uni_5_ShortName, 						"_");
   154 	TestConversion( Uni_5, Uni_5_ShortName);
   155 
   156 	_LIT16(Uni_6,									"\x0081");
   157 	_LIT16(Uni_6_ShortName, 						"_");
   158 	TestConversion( Uni_6, Uni_6_ShortName);
   159 
   160 	_LIT16(Uni_7, 									"\x00fe");
   161 	_LIT16(Uni_7_ShortName, 						"_");
   162 	TestConversion( Uni_7, Uni_7_ShortName);
   163 
   164 	_LIT16(Uni_8, 									"\x00ff");
   165 	_LIT16(Uni_8_ShortName, 						"_");
   166 	TestConversion( Uni_8, Uni_8_ShortName);
   167 	
   168 	// two-byte chars
   169 	_LIT16(Uni_9, 									"\x0100");
   170 	_LIT16(Uni_9_ShortName, 						"_");
   171 	TestConversion( Uni_9, Uni_9_ShortName);
   172 
   173 	_LIT16(Uni_10, 									"\x0101");
   174 	_LIT16(Uni_10_ShortName, 						"_");
   175 	TestConversion( Uni_10, Uni_10_ShortName);
   176 
   177 	_LIT16(Uni_11, 									"\x0ffe");
   178 	_LIT16(Uni_11_ShortName, 						"_");
   179 	TestConversion( Uni_11, Uni_11_ShortName);
   180 
   181 	_LIT16(Uni_12, 									"\x0fff");
   182 	_LIT16(Uni_12_ShortName,						"_");
   183 	TestConversion( Uni_12, Uni_12_ShortName);
   184 
   185 	_LIT16(Uni_13, 									"\x1000");
   186 	_LIT16(Uni_13_ShortName, 						"_");
   187 	TestConversion( Uni_13, Uni_13_ShortName);
   188 
   189 	_LIT16(Uni_14, 									"\x1001");
   190 	_LIT16(Uni_14_ShortName, 						"_");
   191 	TestConversion( Uni_14, Uni_14_ShortName);
   192 
   193 	_LIT16(Uni_15, 									"\x2999.TXT");
   194 	_LIT16(Uni_15_ShortName, 						"_.TXT");
   195 	TestConversion( Uni_15, Uni_15_ShortName);
   196 
   197 	_LIT16(Uni_16, 									"\x4E02.TXT");	
   198 	_LIT16(Uni_16_ShortName, 						"_.TXT");
   199 	TestConversion( Uni_16, Uni_16_ShortName);
   200 
   201 	_LIT16(Uni_17, 									"\x4E02.TXT");	
   202 	_LIT(Uni_17_ShortName, 							"_.TXT");
   203 	TestConversion( Uni_17, Uni_17_ShortName);
   204 
   205 	_LIT16(Uni_18, 									"\xfffe");
   206 	_LIT16(Uni_18_ShortName, 						"_");
   207 	TestConversion( Uni_18, Uni_18_ShortName);
   208 
   209 	_LIT16(Uni_19, 									"\xffff");
   210 	_LIT16(Uni_19_ShortName, 						"_");
   211 	TestConversion( Uni_19, Uni_19_ShortName);
   212 
   213 	// four-byte surrogate pairs
   214 	_LIT16(Uni_20, 									"\xd840\xdc00");
   215 	_LIT16(Uni_20_ShortName, 						"_");
   216 	TestConversion( Uni_20, Uni_20_ShortName);	
   217 
   218 	_LIT16(Uni_21, 									"\xd840\xdc01");
   219 	_LIT16(Uni_21_ShortName, 						"_");
   220 	TestConversion( Uni_21, Uni_21_ShortName);	
   221 
   222 	_LIT16(Uni_22, 									"\xD87F\xdffe");
   223 	_LIT16(Uni_22_ShortName, 						"_");
   224 	TestConversion( Uni_22, Uni_22_ShortName);	
   225 
   226 	_LIT16(Uni_23, 									"\xD87F\xdfff");
   227 	_LIT16(Uni_23_ShortName, 						"_");
   228 	TestConversion( Uni_23, Uni_23_ShortName);	
   229 
   230 	//	surrogate pair
   231 	_LIT16(Uni_24, 									"\xd840\xddad");
   232 	_LIT16(Uni_24_ShortName, 						"_");
   233 	TestConversion( Uni_24, Uni_24_ShortName);	
   234 	
   235 	_LIT16(Uni_25, 									"\xd801\xdd00");
   236 	_LIT16(Uni_25_ShortName, 						"_");
   237 	TestConversion( Uni_25, Uni_25_ShortName);
   238 
   239 	// corrupt surrogate in file name
   240 	_LIT16(KTest0xD800, 							"\xD800.TXT");
   241 	r = SurrogatePair_MakeFile(KTest0xD800);
   242 	test(r==KErrBadName);
   243 
   244 	// corrupt surrogate in file ext
   245 	_LIT16(KTest0xD800XT, 							"\xD684.\xD800XT");
   246 	r = SurrogatePair_MakeFile(KTest0xD800XT);
   247 	test(r==KErrBadName);
   248 
   249 	// corrupt surrogate in file ext
   250 	_LIT16(KTestTX0xD800, 							"\xD684.TX\xD800");
   251 	r = SurrogatePair_MakeFile(KTestTX0xD800);
   252 	test(r==KErrBadName);
   253 
   254 	// corrupt surrogate in file name
   255 	_LIT16(KTest0xDFFF, 							"\xDFFF.TXT");
   256 	r = SurrogatePair_MakeFile(KTest0xDFFF);
   257 	test(r==KErrBadName);
   258 
   259 	// corrupt surrogate in file ext
   260 	_LIT16(KTest0xDFFFXT, 							"\xD684.\xDFFFXT");
   261 	r = SurrogatePair_MakeFile(KTest0xDFFFXT);
   262 	test(r==KErrBadName);
   263 
   264 	// corrupt surrogate in file ext
   265 	_LIT16(KTestTX0xDFFF, 							"\xD684.TX\xDFFF");
   266 	r = SurrogatePair_MakeFile(KTestTX0xDFFF);
   267 	test(r==KErrBadName);
   268 
   269 	test.Next(_L("--TestShortNameCharacter"));
   270 	}
   271 
   272 void TestVolumeLabel()
   273 	{
   274 	test.Next(_L("++TestVolumeLabel"));
   275 	test.Next(_L("Test unicode volume labels"));
   276 
   277 	TInt r = TheFs.SessionPath(gSessionPath);
   278 	test_KErrNone(r);
   279 	TInt driveNum;
   280 	r = TheFs.CharToDrive(gSessionPath[0], driveNum);
   281 	test_KErrNone(r);
   282 	
   283 	// Retrieves the original volume label
   284 	TVolumeInfo vInfo;
   285 	r = TheFs.Volume(vInfo, driveNum);
   286 	const TInt KVolumeLabelSize = 11;
   287 	TBuf<KVolumeLabelSize> originalVolumeLabel(vInfo.iName);
   288 
   289 	// Tests setting volume label with 1 byte characters
   290 	_LIT(K1ByteVolumeLabel, 				"\x0079\x0079\x0079");
   291 	_LIT(K1ByteVolumeLabel_ShortName, 		"\x0079\x0079\x0079");
   292 	
   293 	r = TheFs.SetVolumeLabel(K1ByteVolumeLabel, driveNum);
   294 	test_KErrNone(r);
   295 	r = TheFs.Volume(vInfo, driveNum);
   296 	test_KErrNone(r);
   297 	r = vInfo.iName.Compare(K1ByteVolumeLabel_ShortName);
   298 	test_Equal(r, 0);
   299 	
   300 	// Tests setting volume label with 2 byte characters
   301 	_LIT(K2ByteVolumeLabel, 				"\x65B0\x65B0\x65B0");
   302 	_LIT(K2ByteVolumeLabel_ShortName, 		"___");
   303 
   304 	r = TheFs.SetVolumeLabel(K2ByteVolumeLabel, driveNum);
   305 	test_KErrNone(r);
   306 	r = TheFs.Volume(vInfo, driveNum);
   307 	test_KErrNone(r);
   308 	r = vInfo.iName.Compare(K2ByteVolumeLabel_ShortName);
   309 	test_Equal(r, 0);
   310 
   311 	// Tests setting volume label with surrogate pair
   312 	_LIT(KTestVolumeLabelSurrogatePair1, 			"\xD846\xDF1D\x0041\x0042");
   313 	_LIT(KTestVolumeLabelSurrogatePair1_ShortName,	"_AB");
   314 
   315 	r = TheFs.SetVolumeLabel(KTestVolumeLabelSurrogatePair1, driveNum);
   316 	test_KErrNone(r);
   317 	r = TheFs.Volume(vInfo, driveNum);
   318 	test_KErrNone(r);
   319 	r = vInfo.iName.Compare(KTestVolumeLabelSurrogatePair1_ShortName);
   320 	test_Equal(r, 0);
   321 
   322 	_LIT(KTestVolumeLabelSurrogatePair2, 			"\x0041\x0042\xD846\xDF1D");
   323 	_LIT(KTestVolumeLabelSurrogatePair2_ShortName,	"AB_");
   324 
   325 	r = TheFs.SetVolumeLabel(KTestVolumeLabelSurrogatePair2, driveNum);
   326 	test_KErrNone(r);
   327 	r = TheFs.Volume(vInfo, driveNum);
   328 	test_KErrNone(r);
   329 	r = vInfo.iName.Compare(KTestVolumeLabelSurrogatePair2_ShortName);
   330 	test_Equal(r, 0);
   331 
   332 	// Sets back the original volume label
   333 	r = TheFs.SetVolumeLabel(originalVolumeLabel, driveNum);
   334 	test_KErrNone(r);
   335 	
   336 	test.Next(_L("--TestVolumeLabel"));
   337 	}
   338 
   339 void TestConsistentShortNameGeneration()
   340 	{
   341 	test.Next(_L("++TestConsistentShortNameGeneration"));
   342 	test.Next(_L("Test consistent short name generation"));
   343 
   344 	//unicode characters.
   345 	_LIT(KTestFileName1,		 				"a\x65B0(bcd)");
   346 	_LIT(KTestFileName1_ShortName,	 			"A_(BCD)");
   347 	_LIT(KTestFileName2, 						"ab\x65B0(cdef)");
   348 	_LIT(KTestFileName2_ShortName,				"AB_(CD~1");
   349 	_LIT(KTestFileName3, 						"abc\x65B0(def)");
   350 	_LIT(KTestFileName3_ShortName,				"ABC_(D~1");
   351 	_LIT(KTestFileName4, 						"abcd\x65B0(ef)");
   352 	_LIT(KTestFileName4_ShortName,				"ABCD_(~1");
   353 	_LIT(KTestFileName5, 						"abcde\x65B0(f)");
   354 	_LIT(KTestFileName5_ShortName,				"ABCDE_~1");
   355 	_LIT(KTestFileNameSurrogatePair1, 			"\x0041\x0308\x006F\xD846\xDF1D\x0042");
   356 	_LIT(KTestFileNameSurrogatePair1_ShortName,	"A_O_B");
   357 	_LIT(KTestFileNameSurrogatePair2, 			"\xD846\xDF1D\x0041\x0042");
   358 	_LIT(KTestFileNameSurrogatePair2_ShortName,	"_AB");
   359 	_LIT(KTestFileNameSurrogatePair3, 			"\x0041\x0042\xD846\xDF1D");
   360 	_LIT(KTestFileNameSurrogatePair3_ShortName,	"AB_");
   361 
   362 	// Test file creation and long/short name generation
   363 	TestConversion(KTestFileName1,				KTestFileName1_ShortName);
   364 	TestConversion(KTestFileName2, 				KTestFileName2_ShortName);
   365 	TestConversion(KTestFileName3, 				KTestFileName3_ShortName);
   366 	TestConversion(KTestFileName4, 				KTestFileName4_ShortName);
   367 	TestConversion(KTestFileName5, 				KTestFileName5_ShortName);
   368 	TestConversion(KTestFileNameSurrogatePair1,	KTestFileNameSurrogatePair1_ShortName);
   369 	TestConversion(KTestFileNameSurrogatePair2,	KTestFileNameSurrogatePair2_ShortName);
   370 	TestConversion(KTestFileNameSurrogatePair3,	KTestFileNameSurrogatePair3_ShortName);
   371 
   372 	test.Next(_L("--TestConsistentShortNameGeneration"));
   373 	}
   374 
   375 void TestConsistentShortNameExtGeneration()
   376 	{
   377 	test.Next(_L("++TestConsistentShortNameExtGeneration"));
   378 	test.Next(_L("Test consistent short name extensions are generated"));
   379 	
   380 	// File names will be used for testing boundaries
   381 	_LIT(KTestFileNameExt1, 						"abcdefg.\xFFFF");
   382 	_LIT(KTestFileNameExt1_ShortName,				"ABCDEFG._");
   383 	_LIT(KTestFileNameExt2, 						"abcdefg.t_");
   384 	_LIT(KTestFileNameExt2_ShortName, 				"ABCDEFG.T_");
   385 	_LIT(KTestFileNameExt3, 						"abcdefg.\xFFFFt");
   386 	_LIT(KTestFileNameExt3_ShortName,				"ABCDEFG._T");
   387 	_LIT(KTestFileNameExt4, 						"abcdefg.\xFFFF\xFFFF");
   388 	_LIT(KTestFileNameExt4_ShortName,				"ABCDEFG.__");
   389 	_LIT(KTestFileNameExtSurrogatePair1, 			"ABCDEFG.\xD846\xDF1D\x0041");
   390 	_LIT(KTestFileNameExtSurrogatePair1_ShortName,	"ABCDEFG._A");
   391 	_LIT(KTestFileNameExtSurrogatePair2, 			"ABCDEFG.\x0041\xD846\xDF1D");
   392 	_LIT(KTestFileNameExtSurrogatePair2_ShortName,	"ABCDEFG.A_");
   393 
   394 	// Test file creation and long/short name generation
   395 	TestConversion(KTestFileNameExt1, 				KTestFileNameExt1_ShortName);
   396 	TestConversion(KTestFileNameExt2, 				KTestFileNameExt2_ShortName);
   397 	TestConversion(KTestFileNameExt3, 				KTestFileNameExt3_ShortName);
   398 	TestConversion(KTestFileNameExt4, 				KTestFileNameExt4_ShortName);
   399 	TestConversion(KTestFileNameExtSurrogatePair1, 	KTestFileNameExtSurrogatePair1_ShortName);
   400 	TestConversion(KTestFileNameExtSurrogatePair2, 	KTestFileNameExtSurrogatePair2_ShortName);
   401 
   402 	test.Next(_L("--TestConsistentShortNameExtGeneration"));
   403 	}
   404 
   405 void TestDuplicateLongFileNames()
   406 	{
   407 	test.Next(_L("++TestDuplicateLongFileNames"));
   408 	test.Next(_L("Testing tilde and numbers (\"~n\") are applied correctly for multiple long-named files"));
   409 
   410 	// These are to test "~1", "~2" behaviours when the first 8 bytes of new files
   411 	// are identical with existing files
   412 	_LIT(KTestFileName1, 							"ABCD\xFFFE(A).TXT");
   413 	_LIT(KTestFileName1_ShortName, 					"ABCD_(A).TXT");
   414 	_LIT(KTestFileName2, 							"ABCD\xFFFE(AB).TXT");
   415 	_LIT(KTestFileName2_ShortName, 					"ABCD_(~1.TXT");
   416 	_LIT(KTestFileName3, 							"ABCD\xFFFE(ABC).TXT");
   417 	_LIT(KTestFileName3_ShortName, 					"ABCD_(~2.TXT");
   418 	_LIT(KTestFileNameSurrogatePair1, 				"ABCD\xD846\xDF1D(ABC).TXT");
   419 	_LIT(KTestFileNameSurrogatePair1_ShortName,		"ABCD_(~3.TXT");
   420 	_LIT(KTestFileNameSurrogatePair2, 				"ABCD\xD846\xDF1D(DEF).TXT");
   421 	_LIT(KTestFileNameSurrogatePair2_ShortName,		"ABCD_(~4.TXT");
   422 
   423 	TFileName sn;
   424 	MakeFile(KTestFileName1);
   425 	TInt r = TheFs.GetShortName(KTestFileName1, sn);
   426 	test_KErrNone(r);
   427 	r = sn.Compare(KTestFileName1_ShortName);
   428 	test_Equal(r, 0);
   429 
   430 	MakeFile(KTestFileName2);
   431 	r = TheFs.GetShortName(KTestFileName2, sn);
   432 	test_KErrNone(r);
   433 	r = sn.Compare(KTestFileName2_ShortName);
   434 	test_Equal(r, 0);
   435 
   436 	MakeFile(KTestFileName3);
   437 	r = TheFs.GetShortName(KTestFileName3, sn);
   438 	test_KErrNone(r);
   439 	r = sn.Compare(KTestFileName3_ShortName);
   440 	test_Equal(r, 0);
   441 
   442 	MakeFile(KTestFileNameSurrogatePair1);
   443 	r = TheFs.GetShortName(KTestFileNameSurrogatePair1, sn);
   444 	test_KErrNone(r);
   445 	r = sn.Compare(KTestFileNameSurrogatePair1_ShortName);
   446 	test_Equal(r, 0);
   447 
   448 	MakeFile(KTestFileNameSurrogatePair2);
   449 	r = TheFs.GetShortName(KTestFileNameSurrogatePair2, sn);
   450 	test_KErrNone(r);
   451 	r = sn.Compare(KTestFileNameSurrogatePair2_ShortName);
   452 	test_Equal(r, 0);
   453 
   454 	test_KErrNone(TheFs.Delete(KTestFileName1));
   455 	test_KErrNone(TheFs.Delete(KTestFileName2));
   456 	test_KErrNone(TheFs.Delete(KTestFileName3));
   457 	test_KErrNone(TheFs.Delete(KTestFileNameSurrogatePair1));
   458 	test_KErrNone(TheFs.Delete(KTestFileNameSurrogatePair2));
   459 
   460 	test.Next(_L("--TestDuplicateLongFileNames"));
   461 	}
   462 
   463 void TestDuplicateLongDirNames()
   464 	{
   465 	test.Next(_L("++TestDuplicateLongDirNames"));
   466 	test.Next(_L("Testing tilde and number appended correctly for duplicate long name dirs"));
   467 
   468 	TheFs.SessionPath(gSessionPath);
   469 
   470 	// These are to test "~1", "~2" behaviours when the first 8 bytes of new directories
   471 	// are identical with existing directories
   472 	_LIT(KTestDirName1, 							"\\F32-TST\\T_SURROGATEPAIR\\ABCD\xFFFE(A)\\");
   473 	_LIT(KTestDirName1_ShortName, 					"ABCD_(A)");
   474 	_LIT(KTestDirName2, 							"\\F32-TST\\T_SURROGATEPAIR\\ABCD\xFFFE(AB)\\");
   475 	_LIT(KTestDirName2_ShortName, 					"ABCD_(~1");
   476 	_LIT(KTestDirName3, 							"\\F32-TST\\T_SURROGATEPAIR\\ABCD\xFFFE(ABC)\\");
   477 	_LIT(KTestDirName3_ShortName,				 	"ABCD_(~2");
   478 	_LIT(KTestDirNameSurrogatePair1, 				"\\F32-TST\\T_SURROGATEPAIR\\ABCD\xD846\xDF1D(ABCD)\\");
   479 	_LIT(KTestDirNameSurrogatePair1_ShortName,		"ABCD_(~3");
   480 	_LIT(KTestDirNameSurrogatePair2, 				"\\F32-TST\\T_SURROGATEPAIR\\ABCD\xD846\xDF1D(ABCDE)\\");
   481 	_LIT(KTestDirNameSurrogatePair2_ShortName,		"ABCD_(~4");
   482 
   483 	TFileName sn;
   484 	MakeDir(KTestDirName1);
   485 	TInt r = TheFs.GetShortName(KTestDirName1, sn);
   486 	test_KErrNone(r);
   487 	r = sn.Compare(KTestDirName1_ShortName);
   488 	test_Equal(r, 0);
   489 
   490 	MakeDir(KTestDirName2);
   491 	r = TheFs.GetShortName(KTestDirName2, sn);
   492 	test_KErrNone(r);
   493 	r = sn.Compare(KTestDirName2_ShortName);
   494 	test_Equal(r, 0);
   495 
   496 	MakeDir(KTestDirName3);
   497 	r = TheFs.GetShortName(KTestDirName3, sn);
   498 	test_KErrNone(r);
   499 	r = sn.Compare(KTestDirName3_ShortName);
   500 	test_Equal(r, 0);
   501 
   502 	MakeDir(KTestDirNameSurrogatePair1);
   503 	r = TheFs.GetShortName(KTestDirNameSurrogatePair1, sn);
   504 	test_KErrNone(r);
   505 	r = sn.Compare(KTestDirNameSurrogatePair1_ShortName);
   506 	test_Equal(r, 0);
   507 
   508 	MakeDir(KTestDirNameSurrogatePair2);
   509 	r = TheFs.GetShortName(KTestDirNameSurrogatePair2, sn);
   510 	test_KErrNone(r);
   511 	r = sn.Compare(KTestDirNameSurrogatePair2_ShortName);
   512 	test_Equal(r, 0);
   513 
   514 	test_KErrNone(TheFs.RmDir(KTestDirName1));
   515 	test_KErrNone(TheFs.RmDir(KTestDirName2));
   516 	test_KErrNone(TheFs.RmDir(KTestDirName3));
   517 	test_KErrNone(TheFs.RmDir(KTestDirNameSurrogatePair1));
   518 	test_KErrNone(TheFs.RmDir(KTestDirNameSurrogatePair2));
   519 
   520 	test.Next(_L("--TestDuplicateLongDirNames"));
   521 	}
   522 
   523 void CallTestsL(void)
   524 	{
   525 
   526 	test.Title();
   527 	test.Start(_L("Starting T_SURROGATEPAIR tests"));
   528 
   529 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
   530 
   531 	// Test only runs on Fat file systems
   532 	TheFs.SessionPath(gSessionPath);
   533 	TInt driveNum = CurrentDrive();
   534 	TFSName name;
   535 	TInt r = TheFs.FileSystemName(name, driveNum);
   536 	if (KErrNone == r)
   537 		{
   538 		if (name.Compare(_L("Fat")) != 0)
   539 			{
   540 			test.Printf(_L("Test only runs on 'Fat' drives"));
   541 			}
   542 		else
   543 			{
   544 			// Check for the default implementation
   545 			// Disables codepage dll implementation of LocaleUtils functions
   546 			r = TheFs.ControlIo(driveNum, KControlIoDisableFatUtilityFunctions);
   547 			test_KErrNone(r);
   548 
   549 			CreateTestDirectory(_L("\\F32-TST\\T_SURROGATEPAIR\\"));
   550 
   551 			TestVolumeLabel();
   552 			TestShortNameCharacter();
   553 			TestConsistentShortNameGeneration();
   554 			TestConsistentShortNameExtGeneration();
   555 			TestDuplicateLongFileNames();
   556 			TestDuplicateLongDirNames();
   557 
   558 			DeleteTestDirectory();
   559 
   560 			// Disables codepage dll implementation of LocaleUtils functions for other base tests
   561 			r = TheFs.ControlIo(driveNum, KControlIoDisableFatUtilityFunctions);
   562 			test_KErrNone(r);
   563 			}
   564 		}
   565 	else
   566 		{
   567 		test.Printf(_L("Drive %C: is not ready!"), 'A'+driveNum);
   568 		test(EFalse);
   569 		}
   570 #else
   571 	test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
   572 #endif  // _DEBUG) || _DEBUG_RELEASE
   573 	test.End();
   574 	}