X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/042908a1acd23c52bc5c98e129ef257322dd7a8b..f155075229d771430f0793700f5048ad4be00e9d:/tests/xlocale/xlocale.cpp diff --git a/tests/xlocale/xlocale.cpp b/tests/xlocale/xlocale.cpp index 9feddf9a2c..2b3474b96f 100644 --- a/tests/xlocale/xlocale.cpp +++ b/tests/xlocale/xlocale.cpp @@ -39,11 +39,13 @@ public: private: CPPUNIT_TEST_SUITE( XLocaleTestCase ); CPPUNIT_TEST( TestCtor ); + CPPUNIT_TEST( PreserveLocale ); CPPUNIT_TEST( TestCtypeFunctions ); CPPUNIT_TEST( TestStdlibFunctions ); CPPUNIT_TEST_SUITE_END(); void TestCtor(); + void PreserveLocale(); void TestCtypeFunctions(); void TestStdlibFunctions(); @@ -56,7 +58,7 @@ private: // register in the unnamed registry so that these tests are run by default CPPUNIT_TEST_SUITE_REGISTRATION( XLocaleTestCase ); -// 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( XLocaleTestCase, "XLocaleTestCase" ); @@ -73,7 +75,7 @@ void XLocaleTestCase::TestCtor() #ifdef wxHAS_XLOCALE_SUPPORT CPPUNIT_ASSERT( wxXLocale(wxLANGUAGE_FRENCH).IsOk() ); -#ifdef __WXMSW__ +#ifdef __WINDOWS__ CPPUNIT_ASSERT( wxXLocale("french").IsOk() ); #else CPPUNIT_ASSERT( wxXLocale("fr_FR").IsOk() ); @@ -81,6 +83,16 @@ void XLocaleTestCase::TestCtor() #endif } +void XLocaleTestCase::PreserveLocale() +{ + // Test that using locale functions doesn't change the global C locale. + const wxString origLocale(setlocale(LC_ALL, NULL)); + + wxStrtod_l(wxT("1.234"), NULL, wxCLocale); + + CPPUNIT_ASSERT_EQUAL( origLocale, setlocale(LC_ALL, NULL) ); +} + // test the ctype functions with the given locale void XLocaleTestCase::TestCtypeFunctionsWith(const wxXLocale& loc) {