Recognize UNCs starting with forward slashes too in wxFileName.

Treat \\share\path and //share/path in the same way (for wxPATH_DOS paths).

Add a test for UNC parsing to the unit test.

Closes #11376.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62561 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-11-05 14:59:39 +00:00
parent eb6fda807a
commit 7b611a3ae9
2 changed files with 28 additions and 3 deletions

View File

@@ -124,6 +124,7 @@ private:
#ifdef __WINDOWS__
CPPUNIT_TEST( TestShortLongPath );
#endif // __WINDOWS__
CPPUNIT_TEST( TestUNC );
CPPUNIT_TEST_SUITE_END();
void TestConstruction();
@@ -136,6 +137,7 @@ private:
#ifdef __WINDOWS__
void TestShortLongPath();
#endif // __WINDOWS__
void TestUNC();
DECLARE_NO_COPY_CLASS(FileNameTestCase)
};
@@ -493,3 +495,15 @@ void FileNameTestCase::TestShortLongPath()
}
#endif // __WINDOWS__
void FileNameTestCase::TestUNC()
{
wxFileName fn("//share/path/name.ext", wxPATH_DOS);
CPPUNIT_ASSERT_EQUAL( "share", fn.GetVolume() );
CPPUNIT_ASSERT_EQUAL( "/path", fn.GetPath() );
fn.Assign("\\\\share2\\path2\\name.ext", wxPATH_DOS);
CPPUNIT_ASSERT_EQUAL( "share2", fn.GetVolume() );
CPPUNIT_ASSERT_EQUAL( "/path2", fn.GetPath() );
}