Use setUp/tearDown() for NumFormatter test case locale setup.
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
This commit is contained in:
@@ -27,23 +27,23 @@
|
|||||||
class NumFormatterTestCase : public CppUnit::TestCase
|
class NumFormatterTestCase : public CppUnit::TestCase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NumFormatterTestCase()
|
NumFormatterTestCase() { m_locale = NULL; }
|
||||||
|
|
||||||
|
virtual void setUp()
|
||||||
{
|
{
|
||||||
// We need to use a locale with known decimal point and which uses the
|
// We need to use a locale with known decimal point and which uses the
|
||||||
// thousands separator for the tests to make sense.
|
// thousands separator for the tests to make sense.
|
||||||
m_locale = new wxLocale(wxLANGUAGE_ENGLISH_UK,
|
m_locale = new wxLocale(wxLANGUAGE_ENGLISH_UK,
|
||||||
wxLOCALE_DONT_LOAD_DEFAULT);
|
wxLOCALE_DONT_LOAD_DEFAULT);
|
||||||
if ( !m_locale->IsOk() )
|
if ( !m_locale->IsOk() )
|
||||||
|
tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void tearDown()
|
||||||
{
|
{
|
||||||
delete m_locale;
|
delete m_locale;
|
||||||
m_locale = NULL;
|
m_locale = NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~NumFormatterTestCase()
|
|
||||||
{
|
|
||||||
delete m_locale;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CPPUNIT_TEST_SUITE( NumFormatterTestCase );
|
CPPUNIT_TEST_SUITE( NumFormatterTestCase );
|
||||||
|
Reference in New Issue
Block a user