diff options
Diffstat (limited to 'sal/qa/osl/file/osl_File.cxx')
-rw-r--r-- | sal/qa/osl/file/osl_File.cxx | 1110 |
1 files changed, 0 insertions, 1110 deletions
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index fcf3a8b15739..8a16c605fdba 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -100,133 +100,6 @@ rtl::OString errorToStr( ::osl::FileBase::RC const& nError) return suBuf; } -/** print a file type name. -*/ -inline void printFileType( const ::osl::FileStatus::Type nType ) -{ - printf( "#printFileType# " ); - switch ( nType ) { - case ::osl::FileStatus::Directory: - printf( "This file is a: Directory.\n" ); - break; - case ::osl::FileStatus::Volume: - printf( "This file is a: volume device.\n" ); - break; - case ::osl::FileStatus::Regular: - printf( "This file is a: regular file.\n" ); - break; - case ::osl::FileStatus::Fifo: - printf( "This file is a: fifo.\n" ); - break; - case ::osl::FileStatus::Socket: - printf( "This file is a: socket.\n" ); - break; - case ::osl::FileStatus::Link: - printf( "This file is a: link file.\n" ); - break; - case ::osl::FileStatus::Special: - printf( "This file is a: special.\n" ); - break; - case ::osl::FileStatus::Unknown: - printf( "The file type is unknown %d \n", nType ); - break; - } -} - -/** print a file attributes. -*/ -inline void printFileAttributes( const sal_Int64 nAttributes ) -{ - printf( "#printFileAttributes# This file is a: (" ); - if ( ( nAttributes | osl_File_Attribute_ReadOnly ) == nAttributes ) - printf( " ReadOnly " ); - if ( ( nAttributes | osl_File_Attribute_Hidden ) == nAttributes ) - printf( " Hidden " ); - if ( ( nAttributes | osl_File_Attribute_Executable ) == nAttributes ) - printf( " Executable " ); - if ( ( nAttributes | osl_File_Attribute_GrpWrite ) == nAttributes ) - printf( " GrpWrite " ); - if ( ( nAttributes | osl_File_Attribute_GrpRead ) == nAttributes ) - printf( " GrpRead " ); - if ( ( nAttributes | osl_File_Attribute_GrpExe ) == nAttributes ) - printf( " GrpExe " ); - if ( ( nAttributes | osl_File_Attribute_OwnWrite ) == nAttributes ) - printf( " OwnWrite " ); - if ( ( nAttributes | osl_File_Attribute_OwnRead ) == nAttributes ) - printf( " OwnRead " ); - if ( ( nAttributes | osl_File_Attribute_OwnExe ) == nAttributes ) - printf( " OwnExe " ); - if ( ( nAttributes | osl_File_Attribute_OthWrite ) == nAttributes ) - printf( " OthWrite " ); - if ( ( nAttributes | osl_File_Attribute_OthRead ) == nAttributes ) - printf( " OthRead " ); - if ( ( nAttributes | osl_File_Attribute_OthExe ) == nAttributes ) - printf( " OthExe " ); - printf( ") file!\n" ); -} - -/** print an output wrong message. -*/ -inline void printError( const ::osl::FileBase::RC nError ) -{ - printf( "#printError# " ); - printf( "%s\n", errorToStr(nError).getStr() ); -} - -/** print an signed Integer Number. -*/ -inline void printInt( sal_Int64 i ) -{ - printf( "#printInt_i64# " ); - printf( "The Integer64 is %" SAL_PRIdINT64 "\n", i); -} - -/** print an unsigned Integer Number. -*/ -inline void printInt( sal_uInt64 i ) -{ - printf( "#printInt_u64# " ); - printf( "The unsigned Integer64 is %" SAL_PRIuUINT64 "\n", i); -} - -/** print Boolean value. -*/ -inline void printBool( bool bOk ) -{ - printf( "#printBool# " ); - bOk ? printf( "YES!\n" ): printf( "NO!\n" ); -} - -/** print struct TimeValue in local time format. -*/ -inline void printTime( TimeValue *tv ) -{ - oslDateTime *pDateTime = ( oslDateTime* )malloc( sizeof( oslDateTime ) ) ; - CPPUNIT_ASSERT_MESSAGE( "Error in printTime() function,malloc ", pDateTime != NULL ); - TimeValue *pLocalTV = ( TimeValue* )malloc( sizeof( TimeValue ) ); - CPPUNIT_ASSERT_MESSAGE( "Error in printTime() function,malloc ", pLocalTV != NULL ); - - CPPUNIT_ASSERT_MESSAGE( "Error in printTime() function,osl_getLocalTimeFromSystemTime ",sal_True == osl_getLocalTimeFromSystemTime( tv, pLocalTV ) ); - CPPUNIT_ASSERT_MESSAGE( "Error in printTime() function,osl_gepDateTimeFromTimeValue ",sal_True == osl_getDateTimeFromTimeValue( pLocalTV, pDateTime ) ); - - printf( "#printTime# " ); - printf( " Time is: %d/%d/%d ", pDateTime->Month, pDateTime->Day, pDateTime->Year); - switch ( pDateTime->DayOfWeek ) - { - case 0: printf("Sun. "); break; - case 1: printf("Mon. "); break; - case 2: printf("Tue. "); break; - case 3: printf("Wed. "); break; - case 4: printf("Thu. "); break; - case 5: printf("Fri. "); break; - case 6: printf("Sat. "); break; - } - printf( " %d:%d:%d %d nsecs\n", pDateTime->Hours, pDateTime->Minutes, pDateTime->Seconds, (int) pDateTime->NanoSeconds); - - free( pDateTime ); - free( pLocalTV ); -} - /** compare two TimeValue, unit is "ms", since Windows time precision is better than UNX. */ /* FIXME: the above assertion is bogus */ @@ -237,20 +110,6 @@ inline void printTime( TimeValue *tv ) # define delta 1800 //time precision, 1.8s #endif -inline sal_Int64 t_abs64(sal_Int64 _nValue) -{ - // std::abs() seems to have some ambiguity problems (so-texas) - // return abs(_nValue); - printf("t_abs64(%ld)\n", (long) _nValue); - // CPPUNIT_ASSERT(_nValue < 2147483647); - - if (_nValue < 0) - { - _nValue = -_nValue; - } - return _nValue; -} - inline bool t_compareTime( TimeValue *m_aEndTime, TimeValue *m_aStartTime, sal_Int32 nDelta) { // sal_uInt64 uTimeValue; @@ -296,25 +155,6 @@ inline bool compareFileName( const ::rtl::OUString & ustr1, const ::rtl::OUStrin return bOk; } -/** compare a OUString and an ASCII file name. -*/ -inline bool compareFileName( const ::rtl::OUString & ustr, const sal_Char *astr ) -{ - (void)ustr; - ::rtl::OUString ustr1 = rtl::OUString::createFromAscii( astr ); - bool bOk = ustr1.equalsIgnoreAsciiCase( ustr1 ); // TODO: does it really compare with the same var? - - return bOk; -} - -/** simple version to judge if a file name or directory name is a URL or a system path, just to see if it - is start with "file:///";. -*/ -inline bool isURL( const sal_Char *pathname ) -{ - return ( 0 == strncmp( pathname, FILE_PREFIX, sizeof( FILE_PREFIX ) - 1 ) ); -} - /** simple version to judge if a file name or directory name is a URL or a system path, just to see if it is start with "file:///";. */ @@ -464,49 +304,6 @@ typedef enum { osl_Check_Mode_WriteAccess } oslCheckMode; -// not used here -inline bool checkFile( const ::rtl::OUString & str, oslCheckMode nCheckMode ) -{ - ::osl::FileBase::RC nError1, nError2; - ::osl::File testFile( str ); - bool bCheckResult; - - bCheckResult = false; - nError1 = testFile.open ( osl_File_OpenFlag_Read ); - if ( ( ::osl::FileBase::E_NOENT != nError1 ) && ( ::osl::FileBase::E_ACCES != nError1 ) ){ - - switch ( nCheckMode ) { - case osl_Check_Mode_Exist: - /// check if the file is exist. - if ( ::osl::FileBase::E_None == nError1 ) - bCheckResult = true; - break; - case osl_Check_Mode_OpenAccess: - /// check if the file is openable. - if ( ::osl::FileBase::E_None == nError1 ) - bCheckResult = true; - break; - case osl_Check_Mode_WriteAccess: - /// check the file name and whether it can be written. - /// write chars into the file. - sal_uInt64 nCount_write; - nError2 = testFile.write( pBuffer_Char, 10, nCount_write ); - if ( ::osl::FileBase::E_None == nError2 ) - bCheckResult = true; - break; - - default: - bCheckResult = false; - }/// swith - - nError2 = testFile.close(); - CPPUNIT_ASSERT_MESSAGE( " in CheckFile() function, close file ", nError2 == FileBase::E_None ); - - } - - return bCheckResult; -} - //check if the file exist inline bool ifFileExist( const ::rtl::OUString & str ) { @@ -1439,879 +1236,6 @@ namespace osl_FileBase CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_FileBase::createTempFile, "osl_FileBase" ); }// namespace osl_FileBase -// Beginning of the test cases for VolumeInfo class - -namespace osl_VolumeInfo -{ - - // testing the method - // VolumeInfo( sal_uInt32 nMask ): _nMask( nMask ) - - class ctors : public CppUnit::TestFixture - { - ::rtl::OUString aUStr; - ::osl::FileBase::RC nError1, nError2; - - ::osl::VolumeDevice aVolumeDevice1; - - public: - ctors() :nError1(FileBase::E_None),nError2(FileBase::E_None) {} - // initialization - void setUp() SAL_OVERRIDE - { - } - - void tearDown() SAL_OVERRIDE - { - } - - // test code. - void ctors_001() - { - ::osl::VolumeInfo aVolumeInfo( 0 ); - nError1 = ::osl::Directory::getVolumeInfo( aRootURL, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - sal_uInt64 uiTotalSpace = aVolumeInfo.getTotalSpace(); - sal_uInt32 uiMaxPathLength = aVolumeInfo.getMaxPathLength(); - aUStr = aVolumeInfo.getFileSystemName(); - - CPPUNIT_ASSERT_MESSAGE( "test for ctors function: mask is empty", - ( 0 == uiTotalSpace ) && - ( 0 == uiMaxPathLength ) && - compareFileName( aUStr, aNullURL ) ); - } - -#if ( defined UNX ) - void ctors_002() - { - ::osl::VolumeInfo aVolumeInfo( osl_VolumeInfo_Mask_TotalSpace | - osl_VolumeInfo_Mask_UsedSpace | - osl_VolumeInfo_Mask_FileSystemName ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL4, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - //CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) ); - sal_uInt64 uiTotalSpace = aVolumeInfo.getTotalSpace(); - sal_uInt64 uiUsedSpace = aVolumeInfo.getUsedSpace(); - aUStr = aVolumeInfo.getFileSystemName(); - - CPPUNIT_ASSERT_MESSAGE( "test for ctors function: mask is specified as certain valid fields, and get the masked fields", - ( 0 != uiTotalSpace ) && - ( 0 != uiUsedSpace ) && - compareFileName( aUStr, "nfs" ) ); - } -#else /// Windows version,here we can not determine whichvolume in Windows is serve as an nfs volume. - void ctors_002() - { - CPPUNIT_ASSERT_MESSAGE( "test for ctors function: mask is specified as certain valid fields, and get the masked fields( Windows version )", - 1 == 1 ); - } -#endif - - void ctors_003() - { - - sal_Int32 mask1 = osl_VolumeInfo_Mask_FreeSpace; - ::osl::VolumeInfo aVolumeInfo1( mask1 ); - nError1 = ::osl::Directory::getVolumeInfo( aRootURL, aVolumeInfo1 ); - CPPUNIT_ASSERT( aVolumeInfo1.isValid( mask1 ) ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - - sal_uInt64 uiTotalSpace1 = aVolumeInfo1.getTotalSpace(); - aUStr = aVolumeInfo1.getFileSystemName(); - - sal_Int32 mask2 = osl_VolumeInfo_Mask_TotalSpace; - ::osl::VolumeInfo aVolumeInfo2( mask2 ); - nError2 = ::osl::Directory::getVolumeInfo( aRootURL, aVolumeInfo2 ); - CPPUNIT_ASSERT( aVolumeInfo2.isValid( mask2 ) ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError2 ); - - sal_uInt64 uiTotalSpace2 = aVolumeInfo2.getTotalSpace(); - - CPPUNIT_ASSERT_MESSAGE( "test for ctors function: mask is specified as certain valid fields, but get unmasked fields, use mask to FreeSpace, but I can get TotalSpace, did not pass in (UNX)(W32)", - ( 0 == uiTotalSpace1 ) && ( 0 != uiTotalSpace2 ) && - compareFileName( aUStr, aNullURL ) ); - } - - CPPUNIT_TEST_SUITE( ctors ); - CPPUNIT_TEST( ctors_001 ); - CPPUNIT_TEST( ctors_002 ); - CPPUNIT_TEST( ctors_003 ); - CPPUNIT_TEST_SUITE_END(); - };// class ctors - - // testing the method - // inline sal_Bool isValid( sal_uInt32 nMask ) const - - class isValid : public CppUnit::TestFixture - { - ::osl::VolumeDevice aVolumeDevice; - ::rtl::OUString aUStr; - ::osl::FileBase::RC nError1; - - public: - isValid() :nError1(FileBase::E_None) {} - // initialization - void setUp() SAL_OVERRIDE - { - } - - void tearDown() SAL_OVERRIDE - { - - } - - // test code. - void isValid_001() - { - sal_Int32 mask = 0; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL4, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - - CPPUNIT_ASSERT_MESSAGE( "test for isValid function: no fields specified.", - aVolumeInfo.isValid( mask ) ); - } - -#if ( defined UNX ) - void isValid_002() - { - sal_Int32 mask = osl_VolumeInfo_Mask_Attributes | osl_VolumeInfo_Mask_TotalSpace | osl_VolumeInfo_Mask_UsedSpace | - osl_VolumeInfo_Mask_FreeSpace | osl_VolumeInfo_Mask_MaxNameLength | - osl_VolumeInfo_Mask_MaxPathLength | osl_VolumeInfo_Mask_FileSystemName; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL4, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - - CPPUNIT_ASSERT_MESSAGE( "test for isValid function: all valid fields specified for a nfs volume.", - aVolumeInfo.isValid( mask ) ); - } -#else /// Windows version,here we can not determine whichvolume in Windows is serve as an nfs volume. - void isValid_002() - { - CPPUNIT_ASSERT_MESSAGE( "test for isValid function: all valid fields specified for a nfs volume.( Windows version )", - 1 == 1 ); - } -#endif - - void isValid_003() - { - ::osl::VolumeDevice aVolumeDevice1; - sal_Int32 mask = osl_VolumeInfo_Mask_Attributes; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - bool bOk1 = aVolumeInfo.isValid( mask ); - - nError1 = ::osl::Directory::getVolumeInfo( aVolURL2, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - bool bOk2 = aVolumeInfo.isValid( mask ); - - CPPUNIT_ASSERT_MESSAGE( "test for isValid function: osl_VolumeInfo_Mask_Attributes, it should be valid for some volume such as /, floppy, cdrom, etc. but it did not pass", - bOk1 && bOk2 ); - } - - CPPUNIT_TEST_SUITE( isValid ); - CPPUNIT_TEST( isValid_001 ); - CPPUNIT_TEST( isValid_002 ); - CPPUNIT_TEST( isValid_003 ); - CPPUNIT_TEST_SUITE_END(); - };// class isValid - - // testing the method - // inline sal_Bool getRemoteFlag() const - - class getRemoteFlag : public CppUnit::TestFixture - { - ::osl::VolumeDevice aVolumeDevice; - ::rtl::OUString aUStr; - ::osl::FileBase::RC nError1; - - public: - getRemoteFlag() :nError1(FileBase::E_None) {} - // test code. - void getRemoteFlag_001() - { - sal_Int32 mask = osl_VolumeInfo_Mask_Attributes; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - bool bOk = aVolumeInfo.getRemoteFlag(); - - CPPUNIT_ASSERT_MESSAGE( "test for getRemoteFlag function: get a volume device which is not remote.", - !bOk ); - } - - #if ( defined UNX ) //remote Volume is different in Solaris and Windows - void getRemoteFlag_002() - { - sal_Int32 mask = osl_VolumeInfo_Mask_Attributes; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL4, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - bool bOk = aVolumeInfo.getRemoteFlag(); - - CPPUNIT_ASSERT_MESSAGE( "test for getRemoteFlag function: get a volume device which is remote( Solaris version ).", - bOk ); - } -#else //Windows version - void getRemoteFlag_002() - { - CPPUNIT_ASSERT_MESSAGE( "test for getRemoteFlag function: get a volume device which is remote( Windows version )", - 1 == 1 ); - } -#endif - - CPPUNIT_TEST_SUITE( getRemoteFlag ); - CPPUNIT_TEST( getRemoteFlag_001 ); - CPPUNIT_TEST( getRemoteFlag_002 ); - CPPUNIT_TEST_SUITE_END(); - };// class getRemoteFlag - - // testing the method - // inline sal_Bool getRemoveableFlag() const - - class getRemoveableFlag : public CppUnit::TestFixture - { - ::osl::FileBase::RC nError1; - - public: - getRemoveableFlag() :nError1(FileBase::E_None) {} - // test code. - void getRemoveableFlag_001() - { - sal_Int32 mask = osl_VolumeInfo_Mask_Attributes; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - bool bOk = aVolumeInfo.getRemoveableFlag(); - - CPPUNIT_ASSERT_MESSAGE( "test for getRemoveableFlag function: get a volume device which is not removable.", - !bOk ); - } - - void getRemoveableFlag_002() - { - sal_Int32 mask = osl_VolumeInfo_Mask_Attributes; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL2, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - bool bOk = aVolumeInfo.getRemoveableFlag(); - - CPPUNIT_ASSERT_MESSAGE( "test for getRemoveableFlag function: get a volume device which is removable, not sure, here we use floppy disk, but it did not pass.", - bOk ); - } - CPPUNIT_TEST_SUITE( getRemoveableFlag ); - CPPUNIT_TEST( getRemoveableFlag_001 ); - CPPUNIT_TEST( getRemoveableFlag_002 ); - CPPUNIT_TEST_SUITE_END(); - };// class getRemoveableFlag - - // testing the method - // inline sal_Bool getCompactDiscFlag() const - - class getCompactDiscFlag : public CppUnit::TestFixture - { - ::osl::FileBase::RC nError1; - - public: - getCompactDiscFlag() :nError1(FileBase::E_None) {} - // test code. - void getCompactDiscFlag_001() - { - sal_Int32 mask = osl_VolumeInfo_Mask_Attributes; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - bool bOk = aVolumeInfo.getCompactDiscFlag(); - - CPPUNIT_ASSERT_MESSAGE( "test for getCompactDiscFlag function: get a volume device which is not a cdrom.", - !bOk ); - } - - void getCompactDiscFlag_002() - { - sal_Int32 mask = osl_VolumeInfo_Mask_Attributes; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL6, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - bool bOk = aVolumeInfo.getCompactDiscFlag(); - - CPPUNIT_ASSERT_MESSAGE( "test for getCompactDiscFlag function: get a cdrom volume device flag, it did not pass.", - bOk ); - } - CPPUNIT_TEST_SUITE( getCompactDiscFlag ); - CPPUNIT_TEST( getCompactDiscFlag_001 ); - CPPUNIT_TEST( getCompactDiscFlag_002 ); - CPPUNIT_TEST_SUITE_END(); - };// class getCompactDiscFlag - - // testing the method - // inline sal_Bool getFloppyDiskFlag() const - - class getFloppyDiskFlag : public CppUnit::TestFixture - { - ::osl::FileBase::RC nError1; - - public: - getFloppyDiskFlag() :nError1(FileBase::E_None) {} - // test code. - void getFloppyDiskFlag_001() - { - sal_Int32 mask = osl_VolumeInfo_Mask_Attributes; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - bool bOk = aVolumeInfo.getFloppyDiskFlag(); - - CPPUNIT_ASSERT_MESSAGE( "test for getFloppyDiskFlag function: get a volume device which is not a floppy disk.", - !bOk ); - } - - void getFloppyDiskFlag_002() - { - sal_Int32 mask = osl_VolumeInfo_Mask_Attributes; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL2, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - bool bOk = aVolumeInfo.getFloppyDiskFlag(); - - CPPUNIT_ASSERT_MESSAGE( "test for getFloppyDiskFlag function: get a floppy volume device flag, it did not pass.", - bOk ); - } - CPPUNIT_TEST_SUITE( getFloppyDiskFlag ); - CPPUNIT_TEST( getFloppyDiskFlag_001 ); - CPPUNIT_TEST( getFloppyDiskFlag_002 ); - CPPUNIT_TEST_SUITE_END(); - };// class getFloppyDiskFlag - - // testing the method - // inline sal_Bool getFixedDiskFlag() const - - class getFixedDiskFlag : public CppUnit::TestFixture - { - ::osl::FileBase::RC nError1; - - public: - getFixedDiskFlag() :nError1(FileBase::E_None) {} - // test code. - void getFixedDiskFlag_001() - { - sal_Int32 mask = osl_VolumeInfo_Mask_Attributes; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL2, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - bool bOk = aVolumeInfo.getFixedDiskFlag(); - - CPPUNIT_ASSERT_MESSAGE( "test for getFixedDiskFlag function: get a volume device which is not a fixed disk.", - !bOk ); - } - - void getFixedDiskFlag_002() - { - sal_Int32 mask = osl_VolumeInfo_Mask_Attributes; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - bool bOk = aVolumeInfo.getFixedDiskFlag(); - - CPPUNIT_ASSERT_MESSAGE( "test for getFixedDiskFlag function: get a fixed disk volume device flag, it did not pass.", - bOk ); - } - CPPUNIT_TEST_SUITE( getFixedDiskFlag ); - CPPUNIT_TEST( getFixedDiskFlag_001 ); - CPPUNIT_TEST( getFixedDiskFlag_002 ); - CPPUNIT_TEST_SUITE_END(); - };// class getFixedDiskFlag - - // testing the method - // inline sal_Bool getRAMDiskFlag() const - - class getRAMDiskFlag : public CppUnit::TestFixture - { - ::osl::FileBase::RC nError1; - - public: - getRAMDiskFlag() :nError1(FileBase::E_None) {} - // test code. - void getRAMDiskFlag_001() - { - sal_Int32 mask = osl_VolumeInfo_Mask_Attributes; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - bool bOk = aVolumeInfo.getRAMDiskFlag(); - - CPPUNIT_ASSERT_MESSAGE( "test for getRAMDiskFlag function: get a volume device which is not a RAM disk.", - !bOk ); - } - - void getRAMDiskFlag_002() - { - sal_Int32 mask = osl_VolumeInfo_Mask_Attributes; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - bool bOk = aVolumeInfo.getRAMDiskFlag(); - - CPPUNIT_ASSERT_MESSAGE( "test for getRAMDiskFlag function: FIX ME, don't know how to get a RAM disk flag, perhaps Windows 98 boot disk can create a RAM disk, it did not pass in (UNX)(W32).", - bOk ); - } - CPPUNIT_TEST_SUITE( getRAMDiskFlag ); - CPPUNIT_TEST( getRAMDiskFlag_001 ); - CPPUNIT_TEST( getRAMDiskFlag_002 ); - CPPUNIT_TEST_SUITE_END(); - };// class getRAMDiskFlag - - // testing the method - // inline sal_uInt64 getTotalSpace() const - - class getTotalSpace : public CppUnit::TestFixture - { - ::osl::FileBase::RC nError1; - - public: - getTotalSpace() :nError1(FileBase::E_None) {} - // test code. - void getTotalSpace_001() - { - sal_Int32 mask = osl_VolumeInfo_Mask_TotalSpace; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) ); - sal_uInt64 uiTotalSpace = aVolumeInfo.getTotalSpace(); - - CPPUNIT_ASSERT_MESSAGE( "test for getTotalSpace function: get total space of Fixed disk volume mounted on /, it should not be 0", - 0 != uiTotalSpace ); - } - - #if defined( UNX ) - void getTotalSpace_002() - { - sal_Int32 mask = osl_VolumeInfo_Mask_TotalSpace; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL3, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) ); - sal_uInt64 uiTotalSpace = aVolumeInfo.getTotalSpace(); - - CPPUNIT_ASSERT_MESSAGE( "test for getTotalSpace function: get total space of /proc, it should be 0", - 0 == uiTotalSpace ); - } -#else /// Windows version, in Windows, there is no /proc directory - void getTotalSpace_002() - { - CPPUNIT_ASSERT_MESSAGE( "test for getTotalSpace function:not applicable for /proc( Windows version )", - 1 == 1 ); - } -#endif - -#if defined(SOLARIS) - void getTotalSpace_003() - { - struct statvfs aStatFS; - static const sal_Char name[] = "/"; - - memset (&aStatFS, 0, sizeof(aStatFS)); - statvfs( name, &aStatFS); - sal_uInt64 TotalSpace = aStatFS.f_frsize * aStatFS.f_blocks ; - - sal_Int32 mask = osl_VolumeInfo_Mask_TotalSpace; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - CPPUNIT_ASSERT( sal_True == aVolumeInfo.isValid( mask ) ); - sal_uInt64 uiTotalSpace = aVolumeInfo.getTotalSpace(); - - CPPUNIT_ASSERT_MESSAGE( "test for getTotalSpace function: get total space by hand, then compare with getTotalSpace, it did not pass", - uiTotalSpace == TotalSpace ); - } -#else /// Windows version - void getTotalSpace_003() - { - CPPUNIT_ASSERT_MESSAGE( "test for getTotalSpace function:not implemented yet( Windows version )", - 1 == 1 ); - } -#endif - - CPPUNIT_TEST_SUITE( getTotalSpace ); - CPPUNIT_TEST( getTotalSpace_001 ); - CPPUNIT_TEST( getTotalSpace_002 ); - CPPUNIT_TEST( getTotalSpace_003 ); - CPPUNIT_TEST_SUITE_END(); - };// class getTotalSpace - - // testing the method - // inline sal_uInt64 getFreeSpace() const - - class getFreeSpace : public CppUnit::TestFixture - { - ::osl::FileBase::RC nError1; - - public: - getFreeSpace() :nError1(FileBase::E_None) {} - // test code. - void getFreeSpace_001() - { - sal_Int32 mask = osl_VolumeInfo_Mask_FreeSpace; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) ); - sal_uInt64 uiFreeSpace = aVolumeInfo.getFreeSpace(); - - CPPUNIT_ASSERT_MESSAGE( "test for getFreeSpace function: get free space of Fixed disk volume mounted on /, it should not be 0, suggestion: returned value, -1 is better, since some times the free space may be 0", - 0 != uiFreeSpace ); - } - -#if defined( UNX ) - void getFreeSpace_002() - { - sal_Int32 mask = osl_VolumeInfo_Mask_FreeSpace; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL3, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) ); - sal_uInt64 uiFreeSpace = aVolumeInfo.getFreeSpace(); - - CPPUNIT_ASSERT_MESSAGE( "test for getFreeSpace function: get free space of /proc, it should be 0", - 0 == uiFreeSpace ); - } -#else /// Windows version, in Windows, there is no /proc directory - void getFreeSpace_002() - { - CPPUNIT_ASSERT_MESSAGE( "test for getFreeSpace function: not applicable for /proc( Windows version )", - 1 == 1 ); - } -#endif - -#if defined(SOLARIS) - void getFreeSpace_003() - { - struct statvfs aStatFS; - static const sal_Char name[] = "/"; - - memset (&aStatFS, 0, sizeof(aStatFS)); - statvfs( name, &aStatFS); - sal_uInt64 FreeSpace = aStatFS.f_bfree * aStatFS.f_frsize ; - - sal_Int32 mask = osl_VolumeInfo_Mask_FreeSpace; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - CPPUNIT_ASSERT( sal_True == aVolumeInfo.isValid( mask ) ); - sal_uInt64 uiFreeSpace = aVolumeInfo.getFreeSpace(); - - CPPUNIT_ASSERT_MESSAGE( "test for getFreeSpace function: get free space by hand, then compare with getFreeSpace, it did not pass", - uiFreeSpace == FreeSpace ); - } -#else //Windows version - void getFreeSpace_003() - { - CPPUNIT_ASSERT_MESSAGE( "test for getFreeSpace function: not implemented yet( Windows version )", - 1 == 1 ); - } -#endif - - CPPUNIT_TEST_SUITE( getFreeSpace ); - CPPUNIT_TEST( getFreeSpace_001 ); - CPPUNIT_TEST( getFreeSpace_002 ); - CPPUNIT_TEST( getFreeSpace_003 ); - CPPUNIT_TEST_SUITE_END(); - };// class getFreeSpace - - // testing the method - // inline sal_uInt64 getUsedSpace() const - - class getUsedSpace : public CppUnit::TestFixture - { - ::osl::FileBase::RC nError1; - - public: - getUsedSpace() :nError1(FileBase::E_None) {} - // test code. - void getUsedSpace_001() - { - sal_Int32 mask = osl_VolumeInfo_Mask_UsedSpace; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) ); - sal_uInt64 uiUsedSpace = aVolumeInfo.getUsedSpace(); - - CPPUNIT_ASSERT_MESSAGE( "test for getUsedSpace function: get used space of Fixed disk volume mounted on /, it should not be 0, suggestion: returned value, -1 is better, since some times the used space may be 0", - 0 != uiUsedSpace ); - } - -#if defined( UNX ) - void getUsedSpace_002() - { - sal_Int32 mask = osl_VolumeInfo_Mask_UsedSpace; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL3, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) ); - sal_uInt64 uiUsedSpace = aVolumeInfo.getUsedSpace(); - - CPPUNIT_ASSERT_MESSAGE( "test for getUsedSpace function: get used space of /proc, it should be 0", - 0 == uiUsedSpace ); - } -#else /// Windows version, in Windows, there is no /proc directory - void getUsedSpace_002() - { - CPPUNIT_ASSERT_MESSAGE( "test for getUsedSpace function: not applicable for /proc( Windows version )", - 1 == 1 ); - } -#endif - -#if defined(SOLARIS) - void getUsedSpace_003() - { - struct statvfs aStatFS; - static const sal_Char name[] = "/"; - - memset (&aStatFS, 0, sizeof(aStatFS)); - statvfs( name, &aStatFS); - sal_uInt64 UsedSpace = ( aStatFS.f_blocks - aStatFS.f_bavail ) * aStatFS.f_frsize; - - sal_Int32 mask = osl_VolumeInfo_Mask_UsedSpace; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - CPPUNIT_ASSERT( sal_True == aVolumeInfo.isValid( mask ) ); - sal_uInt64 uiUsedSpace = aVolumeInfo.getUsedSpace(); - - CPPUNIT_ASSERT_MESSAGE( "test for getUsedSpace function: get used space by hand, then compare with getUsedSpace, it did not pass", - uiUsedSpace == UsedSpace ); - } -#else //Windows version - void getUsedSpace_003() - { - CPPUNIT_ASSERT_MESSAGE( "test for getUsedSpace function: not implemented yet( Windows version )", - 1 == 1 ); - } -#endif - - CPPUNIT_TEST_SUITE( getUsedSpace ); - CPPUNIT_TEST( getUsedSpace_001 ); - CPPUNIT_TEST( getUsedSpace_002 ); - CPPUNIT_TEST( getUsedSpace_003 ); - CPPUNIT_TEST_SUITE_END(); - };// class getUsedSpace - - // testing the method - // inline sal_uInt32 getMaxNameLength() const - - class getMaxNameLength : public CppUnit::TestFixture - { - ::osl::FileBase::RC nError1; - - public: - getMaxNameLength() :nError1(FileBase::E_None) {} - // test code. - void getMaxNameLength_001() - { - sal_Int32 mask = osl_VolumeInfo_Mask_MaxNameLength; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) ); - sal_uInt32 uiMaxNameLength = aVolumeInfo.getMaxNameLength(); - - CPPUNIT_ASSERT_MESSAGE( "test for getMaxNameLength function: get max name length of Fixed disk volume mounted on /, it should not be 0", - 0 != uiMaxNameLength ); - } - -#if defined(UNX) && !defined(ANDROID) - void getMaxNameLength_002() - { - struct statvfs aStatFS; - static const sal_Char name[] = "/"; - - memset (&aStatFS, 0, sizeof(aStatFS)); - statvfs( name, &aStatFS); - sal_uInt64 MaxNameLength = aStatFS.f_namemax; - - sal_Int32 mask = osl_VolumeInfo_Mask_MaxNameLength; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) ); - sal_uInt64 uiMaxNameLength = aVolumeInfo.getMaxNameLength(); - - CPPUNIT_ASSERT_MESSAGE( "test for getMaxNameLength function: get max name length by hand, then compare with getMaxNameLength", - uiMaxNameLength == MaxNameLength ); - } -#else //Windows version - void getMaxNameLength_002() - { - CPPUNIT_ASSERT_MESSAGE( "test for getMaxNameLength function: not implemented yet( Windows version )", - 1 == 1 ); - } -#endif - - CPPUNIT_TEST_SUITE( getMaxNameLength ); - CPPUNIT_TEST( getMaxNameLength_001 ); - CPPUNIT_TEST( getMaxNameLength_002 ); - CPPUNIT_TEST_SUITE_END(); - };// class getMaxNameLength - - // testing the method - // inline sal_uInt32 getMaxPathLength() const - - class getMaxPathLength : public CppUnit::TestFixture - { - ::osl::FileBase::RC nError1; - - public: - getMaxPathLength() :nError1(FileBase::E_None) {} - // test code. - void getMaxPathLength_001() - { - sal_Int32 mask = osl_VolumeInfo_Mask_MaxPathLength; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) ); - sal_uInt32 uiMaxPathLength = aVolumeInfo.getMaxPathLength(); - - CPPUNIT_ASSERT_MESSAGE( "test for getMaxPathLength function: get max path length of Fixed disk volume mounted on /, it should not be 0", - 0 != uiMaxPathLength ); - } - -#if ( defined UNX ) - void getMaxPathLength_002() - { - sal_Int32 mask = osl_VolumeInfo_Mask_MaxPathLength; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) ); - sal_uInt64 uiMaxPathLength = aVolumeInfo.getMaxPathLength(); - - CPPUNIT_ASSERT_MESSAGE( "test for getMaxPathLength function: get max path length by hand, then compare with getMaxPathLength", - uiMaxPathLength == PATH_MAX ); - } -#else //Windows version - void getMaxPathLength_002() - { - CPPUNIT_ASSERT_MESSAGE( "test for getMaxPathLength function: not implemented yet( Windows version )", - 1 == 1 ); - } -#endif - - CPPUNIT_TEST_SUITE( getMaxPathLength ); - CPPUNIT_TEST( getMaxPathLength_001 ); - CPPUNIT_TEST( getMaxPathLength_002 ); - CPPUNIT_TEST_SUITE_END(); - };// class getMaxPathLength - - // testing the method - // inline ::rtl::OUString getFileSystemName() const - - class getFileSystemName : public CppUnit::TestFixture - { - ::rtl::OUString aUStr; - ::osl::FileBase::RC nError1; - - public: - getFileSystemName() :nError1(FileBase::E_None) {} - // test code. - void getFileSystemName_001() - { - sal_Int32 mask = osl_VolumeInfo_Mask_FileSystemName; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - CPPUNIT_ASSERT( aVolumeInfo.isValid( mask ) ); - aUStr = aVolumeInfo.getFileSystemName(); - - CPPUNIT_ASSERT_MESSAGE( "test for getFileSystemName function: get file system name of Fixed disk volume mounted on /, it should not be empty string", - !compareFileName( aNullURL, aUStr ) ); - } - -#if defined(SOLARIS) - void getFileSystemName_002() - { - struct statvfs aStatFS; - static const sal_Char name[] = "/"; - - memset (&aStatFS, 0, sizeof(aStatFS)); - statvfs( name, &aStatFS); - sal_Char * astrFileSystemName = aStatFS.f_basetype; - - sal_Int32 mask = osl_VolumeInfo_Mask_FileSystemName; - ::osl::VolumeInfo aVolumeInfo( mask ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - CPPUNIT_ASSERT( sal_True == aVolumeInfo.isValid( mask ) ); - aUStr = aVolumeInfo.getFileSystemName(); - - CPPUNIT_ASSERT_MESSAGE( "test for getFileSystemName function: get file system name by hand, then compare with getFileSystemName", - sal_True == compareFileName( aUStr, astrFileSystemName ) ); - } -#else //Windows version - void getFileSystemName_002() - { - CPPUNIT_ASSERT_MESSAGE( "test for getFileSystemName function: not implemented yet( Windows version )", - 1 == 1 ); - } -#endif - - CPPUNIT_TEST_SUITE( getFileSystemName ); - CPPUNIT_TEST( getFileSystemName_001 ); - CPPUNIT_TEST( getFileSystemName_002 ); - CPPUNIT_TEST_SUITE_END(); - };// class getFileSystemName - - // testing the method - // inline VolumeDevice getDeviceHandle() const - - class getDeviceHandle : public CppUnit::TestFixture - { - ::rtl::OUString aUStr; - ::osl::FileBase::RC nError1; - - public: - getDeviceHandle() :nError1(FileBase::E_None) {} - // test code. - void getDeviceHandle_001() - { - ::osl::VolumeInfo aVolumeInfo( osl_VolumeInfo_Mask_Attributes ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL1, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - - ::osl::VolumeDevice aVolumeDevice1( aVolumeInfo.getDeviceHandle() ); - bool bOk = compareFileName( aNullURL, aVolumeDevice1.getMountPath() ); - - CPPUNIT_ASSERT_MESSAGE( "test for getDeviceHandle function: get device handle of Fixed disk volume mounted on /, it should not be NULL, it did not pass in (W32) (UNX).", - !bOk ); - } - - CPPUNIT_TEST_SUITE( getDeviceHandle ); - CPPUNIT_TEST( getDeviceHandle_001 ); - CPPUNIT_TEST_SUITE_END(); - };// class getDeviceHandle - - /*CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_VolumeInfo::ctors, "osl_VolumeInfo" ); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_VolumeInfo::isValid, "osl_VolumeInfo" ); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_VolumeInfo::getRemoteFlag, "osl_VolumeInfo" ); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_VolumeInfo::getRemoveableFlag, "osl_VolumeInfo" ); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_VolumeInfo::getCompactDiscFlag, "osl_VolumeInfo" ); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_VolumeInfo::getFloppyDiskFlag, "osl_VolumeInfo" ); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_VolumeInfo::getFixedDiskFlag, "osl_VolumeInfo" ); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_VolumeInfo::getRAMDiskFlag, "osl_VolumeInfo" ); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_VolumeInfo::getTotalSpace, "osl_VolumeInfo" ); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_VolumeInfo::getFreeSpace, "osl_VolumeInfo" ); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_VolumeInfo::getUsedSpace, "osl_VolumeInfo" ); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_VolumeInfo::getMaxNameLength, "osl_VolumeInfo" ); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_VolumeInfo::getMaxPathLength, "osl_VolumeInfo" ); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_VolumeInfo::getFileSystemName, "osl_VolumeInfo" ); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_VolumeInfo::getDeviceHandle, "osl_VolumeInfo" );*/ -}// namespace osl_VolumeInfo - -// Beginning of the test cases for VolumeDevice class - namespace osl_FileStatus { @@ -4162,15 +3086,6 @@ namespace osl_File CPPUNIT_ASSERT_MESSAGE( "test for copy function: the dest file exist", nFilePointer == 200 ); } - //copyLink has not been impletmented yet - void copy_007() - { -#if ( defined UNX ) - - CPPUNIT_ASSERT_MESSAGE( "test for copy function: source file is link file", - ::osl::FileBase::E_INVAL == nError1 ); -#endif - } CPPUNIT_TEST_SUITE( copy ); CPPUNIT_TEST( copy_001 ); @@ -4305,30 +3220,7 @@ namespace osl_File (::osl::FileBase::E_None == nError1 ) && (::osl::FileBase::E_EXIST == nError2 ) ); } - // oldpath and newpath are not on the same filesystem.EXDEV,no such error no on Solaris, only on linux - void move_008() - { - CPPUNIT_ASSERT_MESSAGE( "oldpath and newpath are not on the same filesystem, should error returns", - ::osl::FileBase::E_None == nError1 ); - } //bugid# 115420, after the bug fix, add the case - void move_009() - { - //create directory $TEMP/tmpname. - createTestDirectory( aTmpName6 ); - //create directory $TEMP/tmpname/tmpdir - createTestDirectory( aTmpName8 ); - //move directory $TEMP/tmpname to $TEMP/tmpname/tmpdir/tmpname - rtl::OUString newName = aTmpName8 + "/tmpname"; - nError1 = ::osl::File::move( aTmpName3, newName ); - //deleteTestDirectory( newName + "/tmpname" ); - //deleteTestDirectory( newName ); - deleteTestDirectory( aTmpName8 ); - deleteTestDirectory( aTmpName6 ); - CPPUNIT_ASSERT_MESSAGE( "test for move function: move a directory to it's subdirectory", - ::osl::FileBase::E_None != nError1 ); - } - CPPUNIT_TEST_SUITE( move ); CPPUNIT_TEST( move_001 ); CPPUNIT_TEST( move_002 ); @@ -4337,8 +3229,6 @@ namespace osl_File CPPUNIT_TEST( move_005 ); CPPUNIT_TEST( move_006 ); CPPUNIT_TEST( move_007 ); - // CPPUNIT_TEST( move_008 ); - //CPPUNIT_TEST( move_009 ); CPPUNIT_TEST_SUITE_END(); };// class move |