]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/intl/intltest.cpp
Fix incorrect use of setlocale() in wxLocale::IsAvailable().
[wxWidgets.git] / tests / intl / intltest.cpp
index 02b98472ed849721237d4817077c564ba089bce9..3308e4e2100d5fe6bf4b5805e1c279e87f71519b 100644 (file)
@@ -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;
 
@@ -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