X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f2a5052baa9f3cf87a5198e445021b8a6a1be134..c29c95fe24973b94fd724db767193171ca7c513d:/tests/strings/numformatter.cpp diff --git a/tests/strings/numformatter.cpp b/tests/strings/numformatter.cpp index 7d5971901e..ab67abf9ab 100644 --- a/tests/strings/numformatter.cpp +++ b/tests/strings/numformatter.cpp @@ -27,27 +27,22 @@ 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. - wxLanguage lang; - if ( wxLocale::IsAvailable(wxLANGUAGE_ENGLISH_US) ) - lang = wxLANGUAGE_ENGLISH_US; - else if ( wxLocale::IsAvailable(wxLANGUAGE_ENGLISH_UK) ) - lang = wxLANGUAGE_ENGLISH_UK; - else - { - m_locale = NULL; - return; - } - - m_locale = new wxLocale(lang, wxLOCALE_DONT_LOAD_DEFAULT); + m_locale = new wxLocale(wxLANGUAGE_ENGLISH_UK, + wxLOCALE_DONT_LOAD_DEFAULT); + if ( !m_locale->IsOk() ) + tearDown(); } - virtual ~NumFormatterTestCase() + virtual void tearDown() { delete m_locale; + m_locale = NULL; } private: @@ -85,7 +80,7 @@ private: // register in the unnamed registry so that these tests are run by default CPPUNIT_TEST_SUITE_REGISTRATION( NumFormatterTestCase ); -// 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( NumFormatterTestCase, "NumFormatterTestCase" ); // ----------------------------------------------------------------------------