X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cbc2233eb9f3a89519147e530e5341491e5674dd..603cfe42185349e119ba4c69bd56a79998babcc4:/tests/mbconv/mbconvtest.cpp diff --git a/tests/mbconv/mbconvtest.cpp b/tests/mbconv/mbconvtest.cpp index b413b5bdbd..93f3ea020f 100644 --- a/tests/mbconv/mbconvtest.cpp +++ b/tests/mbconv/mbconvtest.cpp @@ -217,7 +217,7 @@ private: // register in the unnamed registry so that these tests are run by default CPPUNIT_TEST_SUITE_REGISTRATION( MBConvTestCase ); -// 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( MBConvTestCase, "MBConvTestCase" ); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MBConvTestCase, "MBConv" ); @@ -984,35 +984,23 @@ void MBConvTestCase::CP1252Tests() void MBConvTestCase::LibcTests() { - // There isn't a locale that all systems support (except "C"), so leave - // this one disabled for non-Windows systems for the moment, until - // a solution can be found. -#ifdef __WXMSW__ - -#ifdef __WXMSW__ - setlocale( LC_ALL, "English_United States.1252" ); - const unsigned char* systemMB = CP1252; - size_t systemMB_size = sizeof(CP1252); - const unsigned char* systemMB_utf8 = CP1252_utf8; - size_t systemMB_utf8_size = sizeof(CP1252_utf8); -#else - setlocale( LC_ALL, "en_US.iso8859-1" ); - const unsigned char* systemMB = iso8859_1; - size_t systemMB_size = sizeof(iso8859_1); - const unsigned char* systemMB_utf8 = iso8859_1_utf8; - size_t systemMB_utf8_size = sizeof(iso8859_1_utf8); -#endif + // The locale name are OS-dependent so this test is done only under Windows + // when using MSVC (surprisingly it fails with MinGW, even though it's + // supposed to use the same CRT -- no idea why and unfortunately gdb is too + // flaky to debug it) +#ifdef __VISUALC__ + LocaleSetter loc("English_United States.1252"); + wxMBConvLibc convLibc; TestCoder( - (const char*)systemMB, - systemMB_size, - (const char*)systemMB_utf8, - systemMB_utf8_size, + (const char*)CP1252, + sizeof(CP1252), + (const char*)CP1252_utf8, + sizeof(CP1252_utf8), convLibc, 1 ); - -#endif // __WXMSW__ +#endif // __VISUALC__ } // verifies that the specified mb sequences decode to the specified wc sequence @@ -1040,7 +1028,12 @@ void MBConvTestCase::TestDecoder( 0 ); // make sure the correct output length was calculated - CPPUNIT_ASSERT_EQUAL( wideChars, outputWritten ); + WX_ASSERT_EQUAL_MESSAGE + ( + ("while converting \"%s\"", multiBuffer), + wideChars, + outputWritten + ); // convert the string size_t guardChars = 8; // to make sure we're not overrunning the output buffer