X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9a83f860948059b0273b5cc6d9e43fadad3ebfca..e1efca652844273c3e8d32c7e5f442b87e455ca7:/tests/filesys/filesystest.cpp diff --git a/tests/filesys/filesystest.cpp b/tests/filesys/filesystest.cpp index ee39285967..bf4e1a564c 100644 --- a/tests/filesys/filesystest.cpp +++ b/tests/filesys/filesystest.cpp @@ -61,10 +61,12 @@ private: CPPUNIT_TEST_SUITE( FileSystemTestCase ); CPPUNIT_TEST( UrlParsing ); CPPUNIT_TEST( FileNameToUrlConversion ); + CPPUNIT_TEST( UnicodeFileNameToUrlConversion ); CPPUNIT_TEST_SUITE_END(); void UrlParsing(); void FileNameToUrlConversion(); + void UnicodeFileNameToUrlConversion(); DECLARE_NO_COPY_CLASS(FileSystemTestCase) }; @@ -72,7 +74,7 @@ private: // register in the unnamed registry so that these tests are run by default CPPUNIT_TEST_SUITE_REGISTRATION( FileSystemTestCase ); -// also include in it's own registry so that these tests can be run alone +// also include in its own registry so that these tests can be run alone CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FileSystemTestCase, "FileSystemTestCase" ); void FileSystemTestCase::UrlParsing() @@ -110,15 +112,30 @@ void FileSystemTestCase::UrlParsing() CPPUNIT_ASSERT( tst.Anchor(d.url) == d.anchor ); } } - + void FileSystemTestCase::FileNameToUrlConversion() { #ifdef __WINDOWS__ wxFileName fn1(wxT("\\\\server\\share\\path\\to\\file")); wxString url1 = wxFileSystem::FileNameToURL(fn1); - + CPPUNIT_ASSERT( fn1.SameAs(wxFileSystem::URLToFileName(url1)) ); #endif } +void FileSystemTestCase::UnicodeFileNameToUrlConversion() +{ + const unsigned char filename_utf8[] = { + 0x4b, 0x72, 0xc3, 0xa1, 0x73, 0x79, 0x50, 0xc5, + 0x99, 0xc3, 0xad, 0x72, 0x6f, 0x64, 0x79, 0x2e, + 0x6a, 0x70, 0x67, 0x00 + // KrásyPřírody.jpg + }; + wxFileName filename(wxString::FromUTF8((const char*)filename_utf8)); + + wxString url = wxFileSystem::FileNameToURL(filename); + + CPPUNIT_ASSERT( filename.SameAs(wxFileSystem::URLToFileName(url)) ); +} + #endif // wxUSE_FILESYSTEM