kerneltest/f32test/server/t_localeutils_cp932.cpp
changeset 109 b3a1d9898418
parent 33 0173bcd7697c
child 206 ced41fd9a298
child 257 3e88ff8f41d5
child 269 d57b86b1867a
equal deleted inserted replaced
102:ef2a444a7410 109:b3a1d9898418
    41 
    41 
    42 void ReadBootSector(TFatBootSector& aBootSector)
    42 void ReadBootSector(TFatBootSector& aBootSector)
    43 	{
    43 	{
    44 
    44 
    45     TInt nRes = ReadBootSector(TheFs, CurrentDrive(), KBootSectorNum<<KDefaultSectorLog2, aBootSector);
    45     TInt nRes = ReadBootSector(TheFs, CurrentDrive(), KBootSectorNum<<KDefaultSectorLog2, aBootSector);
    46     test(nRes == KErrNone);
    46     test_KErrNone(nRes);
    47 
    47 
    48     if(!aBootSector.IsValid())
    48     if(!aBootSector.IsValid())
    49         {
    49         {
    50         test.Printf(_L("Wrong bootsector! Dump:\n"));
    50         test.Printf(_L("Wrong bootsector! Dump:\n"));
    51         aBootSector.PrintDebugInfo();
    51         aBootSector.PrintDebugInfo();
   252 	
   252 	
   253 	// Tests setting volume label with unicode characters that bigger than 11 bytes
   253 	// Tests setting volume label with unicode characters that bigger than 11 bytes
   254 	_LIT(KVolumeLabelOverflow,		"\x65B0\x65B0\x65B0\x65B0\x65B0\x65B0");
   254 	_LIT(KVolumeLabelOverflow,		"\x65B0\x65B0\x65B0\x65B0\x65B0\x65B0");
   255 	r = TheFs.SetVolumeLabel(KVolumeLabelOverflow, driveNum);
   255 	r = TheFs.SetVolumeLabel(KVolumeLabelOverflow, driveNum);
   256 	// locale dll and codepage dll both return diff retrun values so check against both cases.
   256 	// locale dll and codepage dll both return diff retrun values so check against both cases.
   257 	test((r == KErrBadName) || (r == KErrOverflow));
   257 	test_Value(r, (r == KErrBadName) || (r == KErrOverflow));
   258 
   258 
   259 	r = TheFs.Volume(vInfo, driveNum);
   259 	r = TheFs.Volume(vInfo, driveNum);
   260 	test_KErrNone(r);
   260 	test_KErrNone(r);
   261 	r = vInfo.iName.Compare(KUnicodeVolumeLabel);
   261 	r = vInfo.iName.Compare(KUnicodeVolumeLabel);
   262 	test_Equal(r, 0);
   262 	test_Equal(r, 0);
   700 
   700 
   701 	RFile file;
   701 	RFile file;
   702 	TFileName fn = _L("\\ABCD");
   702 	TFileName fn = _L("\\ABCD");
   703 	
   703 	
   704 	TInt r=file.Create(TheFs,fn,EFileRead);
   704 	TInt r=file.Create(TheFs,fn,EFileRead);
   705 	test(r==KErrNone);
   705 	test_KErrNone(r);
   706 	file.Close();
   706 	file.Close();
   707 
   707 
   708 	//	Assume this file is the first entry in the root directory
   708 	//	Assume this file is the first entry in the root directory
   709 	r=TheDisk.Open(TheFs,CurrentDrive());
   709 	r=TheDisk.Open(TheFs,CurrentDrive());
   710 	test(r==KErrNone);
   710 	test_KErrNone(r);
   711 	
   711 	
   712     //-- read the 1st dir entry, it should be a DOS entry 
   712     //-- read the 1st dir entry, it should be a DOS entry 
   713     const TInt posEntry1=gBootSector.RootDirStartSector() << KDefaultSectorLog2; //-- dir entry1 position
   713     const TInt posEntry1=gBootSector.RootDirStartSector() << KDefaultSectorLog2; //-- dir entry1 position
   714     
   714     
   715     TFatDirEntry fatEntry1;
   715     TFatDirEntry fatEntry1;
   745 	fn[3] = 0x96C5;
   745 	fn[3] = 0x96C5;
   746 	fn[4] = 0x6CBB;
   746 	fn[4] = 0x6CBB;
   747 	
   747 	
   748 	TEntry entry;
   748 	TEntry entry;
   749 	TInt err = TheFs.Entry(fn, entry);
   749 	TInt err = TheFs.Entry(fn, entry);
   750 	test(err==KErrNone);
   750 	test_KErrNone(err);
   751 	err = TheFs.Delete(fn);
   751 	err = TheFs.Delete(fn);
   752 	test(err==KErrNone);
   752 	test_KErrNone(err);
   753 #else
   753 #else
   754 	test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
   754 	test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
   755 #endif  // _DEBUG) || _DEBUG_RELEASE
   755 #endif  // _DEBUG) || _DEBUG_RELEASE
   756 	}
   756 	}
   757 
   757 
   777 	RFile file;
   777 	RFile file;
   778 	TFileName fn = _L("\\AB");
   778 	TFileName fn = _L("\\AB");
   779 	
   779 	
   780 	test.Next(_L("create file \"AB\" under root directory"));
   780 	test.Next(_L("create file \"AB\" under root directory"));
   781 	TInt r=file.Create(TheFs,fn,EFileRead);
   781 	TInt r=file.Create(TheFs,fn,EFileRead);
   782 	test(r==KErrNone);
   782 	test_KErrNone(r);
   783 	file.Close();
   783 	file.Close();
   784 
   784 
   785 	test.Next(_L("manually change file name to \"0x7F0x450x7F0x45\" via raw disk accessing"));
   785 	test.Next(_L("manually change file name to \"0x7F0x450x7F0x45\" via raw disk accessing"));
   786 	//	Assume this file is the first entry in the root directory
   786 	//	Assume this file is the first entry in the root directory
   787 	r=TheDisk.Open(TheFs,CurrentDrive());
   787 	r=TheDisk.Open(TheFs,CurrentDrive());
   788 	test(r==KErrNone);
   788 	test_KErrNone(r);
   789 	
   789 	
   790     //-- read the first dir entry, it should be a DOS entry 
   790     //-- read the first dir entry, it should be a DOS entry 
   791     const TInt posEntry1=gBootSector.RootDirStartSector() << KDefaultSectorLog2; //-- dir entry1 position
   791     const TInt posEntry1=gBootSector.RootDirStartSector() << KDefaultSectorLog2; //-- dir entry1 position
   792     
   792     
   793     TFatDirEntry fatEntry1;
   793     TFatDirEntry fatEntry1;
   868 	MakeFile(fn);
   868 	MakeFile(fn);
   869 	
   869 	
   870 	_LIT(KShortName, "\x3055\x307E\x3056~1");
   870 	_LIT(KShortName, "\x3055\x307E\x3056~1");
   871 	TFileName sn;
   871 	TFileName sn;
   872 	r = TheFs.GetShortName(fn, sn);
   872 	r = TheFs.GetShortName(fn, sn);
   873 	test(r==KErrNone);
   873 	test_KErrNone(r);
   874 	r = sn.Compare(KShortName);
   874 	r = sn.Compare(KShortName);
   875 	test(r==0);
   875 	test_Value(r, r == 0);
   876 	
   876 	
   877 	r = TheFs.ScanDrive(_L("gSessionPath"));
   877 	r = TheFs.ScanDrive(_L("gSessionPath"));
   878 	test(r==KErrNone);
   878 	test_KErrNone(r);
   879 
   879 
   880 	r = TheFs.Delete(fn);
   880 	r = TheFs.Delete(fn);
   881 	test(r == KErrNone);
   881 	test_KErrNone(r);
   882 #else
   882 #else
   883 	test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
   883 	test.Printf(_L("Test only runs on DEBUG builds, see test logs of debug builds for details."));
   884 #endif  // _DEBUG) || _DEBUG_RELEASE
   884 #endif  // _DEBUG) || _DEBUG_RELEASE
   885 	}
   885 	}
   886 
   886