]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/intl/intltest.cpp
proper default for iphone
[wxWidgets.git] / tests / intl / intltest.cpp
index d821e963cfeb7b7a52d80b56e0f7081ce4dc6332..11f6451afeeb48e946e23c326f1f4f7bdcc1af7c 100644 (file)
@@ -3,7 +3,6 @@
 // Purpose:     wxLocale unit test
 // Author:      Vaclav Slavik
 // Created:     2007-03-26
-// RCS-ID:      $Id$
 // Copyright:   (c) 2007 Vaclav Slavik
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -39,6 +38,7 @@ public:
 
 private:
     CPPUNIT_TEST_SUITE( IntlTestCase );
+        CPPUNIT_TEST( RestoreLocale );
         CPPUNIT_TEST( Domain );
         CPPUNIT_TEST( Headers );
         CPPUNIT_TEST( DateTimeFmtFrench );
@@ -46,12 +46,18 @@ private:
         CPPUNIT_TEST( IsAvailable );
     CPPUNIT_TEST_SUITE_END();
 
+    void RestoreLocale();
     void Domain();
     void Headers();
     void DateTimeFmtFrench();
     void DateTimeFmtC();
     void IsAvailable();
 
+    static wxString GetDecimalPoint()
+    {
+        return wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER);
+    }
+
     wxLocale *m_locale;
 
     DECLARE_NO_COPY_CLASS(IntlTestCase)
@@ -92,6 +98,25 @@ void IntlTestCase::tearDown()
     }
 }
 
+void IntlTestCase::RestoreLocale()
+{
+    if ( !m_locale )
+        return;
+
+    // We must be using the French locale now, it was changed in setUp().
+    CPPUNIT_ASSERT_EQUAL( ",", GetDecimalPoint() );
+
+    // Switch to the English locale.
+    {
+        wxLocale locEn(wxLANGUAGE_ENGLISH);
+        CPPUNIT_ASSERT_EQUAL( ".", GetDecimalPoint() );
+    }
+
+    // Verify that after destroying the English locale object, French locale is
+    // restored.
+    CPPUNIT_ASSERT_EQUAL( ",", GetDecimalPoint() );
+}
+
 void IntlTestCase::Domain()
 {
     if (!m_locale)