Add test wxFileSystem::FileNameToURL,URLToFileName roundtrip with
Unicode filenames. See #11491. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63762 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
d4a58a7ce5
commit
abd5e008f1
@ -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)
|
||||
};
|
||||
@ -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 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(filename_utf8));
|
||||
|
||||
wxString url = wxFileSystem::FileNameToURL(filename);
|
||||
|
||||
CPPUNIT_ASSERT( filename.SameAs(wxFileSystem::URLToFileName(url)) );
|
||||
}
|
||||
|
||||
#endif // wxUSE_FILESYSTEM
|
||||
|
Loading…
Reference in New Issue
Block a user