X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ff3d9a3532d011db02c121bac04bd3134f02172e..bf473da729e2be34f890d8b9c9af4a4143f1647b:/tests/filename/filenametest.cpp diff --git a/tests/filename/filenametest.cpp b/tests/filename/filenametest.cpp index 2ce261d716..27ad3ae870 100644 --- a/tests/filename/filenametest.cpp +++ b/tests/filename/filenametest.cpp @@ -89,12 +89,18 @@ private: CPPUNIT_TEST( TestSplit ); CPPUNIT_TEST( TestSetPath ); CPPUNIT_TEST( TestStrip ); +#ifdef __WINDOWS__ + CPPUNIT_TEST( TestShortLongPath ); +#endif // __WINDOWS__ CPPUNIT_TEST_SUITE_END(); void TestConstruction(); void TestSplit(); void TestSetPath(); void TestStrip(); +#ifdef __WINDOWS__ + void TestShortLongPath(); +#endif // __WINDOWS__ DECLARE_NO_COPY_CLASS(FileNameTestCase) }; @@ -148,6 +154,10 @@ void FileNameTestCase::TestSplit() CPPUNIT_ASSERT( name == fni.name ); CPPUNIT_ASSERT( ext == fni.ext ); } + + // special case of empty extension + wxFileName fn(_T("foo.")); + CPPUNIT_ASSERT( fn.GetFullPath() == _T("foo.") ); } void FileNameTestCase::TestSetPath() @@ -178,3 +188,17 @@ void FileNameTestCase::TestStrip() CPPUNIT_ASSERT( wxTestStripExtension( _T("good.wav") ) == _T("good") ); CPPUNIT_ASSERT( wxTestStripExtension( _T("good.wav.wav") ) == _T("good.wav") ); } + +#ifdef __WINDOWS__ + +void FileNameTestCase::TestShortLongPath() +{ + wxFileName fn(_T("C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe")); + + // incredibly enough, GetLongPath() used to return different results during + // the first and subsequent runs, test for this + CPPUNIT_ASSERT_EQUAL( fn.GetLongPath(), fn.GetLongPath() ); + CPPUNIT_ASSERT_EQUAL( fn.GetShortPath(), fn.GetShortPath() ); +} + +#endif // __WINDOWS__