X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f30bd8f2620617ebbd1fd96d00a6fda514ceeb64..5dec941a5ba3c08870ab4b415dd6e5be368fa0f0:/tests/intl/intltest.cpp diff --git a/tests/intl/intltest.cpp b/tests/intl/intltest.cpp index 0e6b8948b4..d747b7aa26 100644 --- a/tests/intl/intltest.cpp +++ b/tests/intl/intltest.cpp @@ -43,12 +43,14 @@ private: CPPUNIT_TEST( Headers ); CPPUNIT_TEST( DateTimeFmtFrench ); CPPUNIT_TEST( DateTimeFmtC ); + CPPUNIT_TEST( IsAvailable ); CPPUNIT_TEST_SUITE_END(); void Domain(); void Headers(); void DateTimeFmtFrench(); void DateTimeFmtC(); + void IsAvailable(); wxLocale *m_locale; @@ -58,7 +60,7 @@ private: // register in the unnamed registry so that these tests are run by default CPPUNIT_TEST_SUITE_REGISTRATION( IntlTestCase ); -// 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( IntlTestCase, "IntlTestCase" ); void IntlTestCase::setUp() @@ -75,7 +77,7 @@ void IntlTestCase::setUp() CPPUNIT_ASSERT( m_locale ); // don't load default catalog, it may be unavailable: - bool loaded = m_locale->Init(wxLANGUAGE_FRENCH, wxLOCALE_DONT_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING); + bool loaded = m_locale->Init(wxLANGUAGE_FRENCH, wxLOCALE_DONT_LOAD_DEFAULT); CPPUNIT_ASSERT( loaded ); m_locale->AddCatalog("internat"); @@ -204,4 +206,14 @@ void IntlTestCase::DateTimeFmtC() m_locale->GetInfo(wxLOCALE_TIME_FMT) ); } +void IntlTestCase::IsAvailable() +{ + const wxString origLocale(setlocale(LC_ALL, NULL)); + + // Calling IsAvailable() shouldn't change the locale. + wxLocale::IsAvailable(wxLANGUAGE_ENGLISH); + + CPPUNIT_ASSERT_EQUAL( origLocale, setlocale(LC_ALL, NULL) ); +} + #endif // wxUSE_INTL