]> git.saurik.com Git - wxWidgets.git/commitdiff
Use setUp/tearDown() for NumFormatter test case locale setup.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 19 Jan 2011 15:08:11 +0000 (15:08 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 19 Jan 2011 15:08:11 +0000 (15:08 +0000)
Setting the locale in the ctor of the test object doesn't work because the
locale is changed by the other tests that run before this one, use the
initialization method provided by cppunit to change the locale instead, this
is somewhat wasteful but at least it does work, unlike the old version.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66718 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/strings/numformatter.cpp

index 7ab235bc8188761cd79348689e374f21376a84d9..989cd4e1cc9e17721e3a8a8f3a2d957349ae4fe9 100644 (file)
 class NumFormatterTestCase : public CppUnit::TestCase
 {
 public:
-    NumFormatterTestCase()
+    NumFormatterTestCase() { m_locale = NULL; }
+
+    virtual void setUp()
     {
         // We need to use a locale with known decimal point and which uses the
         // thousands separator for the tests to make sense.
         m_locale = new wxLocale(wxLANGUAGE_ENGLISH_UK,
                                 wxLOCALE_DONT_LOAD_DEFAULT);
         if ( !m_locale->IsOk() )
-        {
-            delete m_locale;
-            m_locale = NULL;
-        }
+            tearDown();
     }
 
-    virtual ~NumFormatterTestCase()
+    virtual void tearDown()
     {
         delete m_locale;
+        m_locale = NULL;
     }
 
 private: