From 9036b3dba876131085251a18c2c0563fc86b7da0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 9 Dec 2017 19:16:47 -0700 Subject: [PATCH] Remove "C" locale date and time formats test This test didn't make sense at all as it didn't actually test "C" locale formats as calling setlocale(LC_ALL, "C") didn't actually change the values returned by wxLocale::GetInfo(), so it still returned the values corresponding to the French locale set in this test setUp() method and the test only passed because it used wrong values (i.e. the same ones as in French locale test). We also don't have any simple way to test "C" locale formats, we can only test them for wxLANGUAGE_DEFAULT, but this corresponds to the OS defaults which can be customized by user (e.g. in the control panel under MSW) and so we can't expect them to be equal to any fixed values. The simplest solution is to just drop this test, as it's not very useful anyhow (French locale test above already covers the same code). --- tests/intl/intltest.cpp | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/tests/intl/intltest.cpp b/tests/intl/intltest.cpp index 6825f8a20a..38a7df1a1c 100644 --- a/tests/intl/intltest.cpp +++ b/tests/intl/intltest.cpp @@ -42,7 +42,6 @@ private: CPPUNIT_TEST( Domain ); CPPUNIT_TEST( Headers ); CPPUNIT_TEST( DateTimeFmtFrench ); - CPPUNIT_TEST( DateTimeFmtC ); CPPUNIT_TEST( IsAvailable ); CPPUNIT_TEST_SUITE_END(); @@ -50,7 +49,6 @@ private: void Domain(); void Headers(); void DateTimeFmtFrench(); - void DateTimeFmtC(); void IsAvailable(); static wxString GetDecimalPoint() @@ -212,35 +210,6 @@ void IntlTestCase::DateTimeFmtFrench() m_locale->GetInfo(wxLOCALE_TIME_FMT) ); } -void IntlTestCase::DateTimeFmtC() -{ - // again, glibc uses different defaults -#ifdef __GLIBC__ - static const char *C_DATE_FMT = "%m/%d/%y"; - static const char *C_LONG_DATE_FMT = "%a %b %d %Y"; - static const char *C_DATE_TIME_FMT = "%a %b %d %H:%M:%S %Y"; -#else - static const char *C_DATE_FMT = "%d/%m/%Y"; - static const char *C_LONG_DATE_FMT = "%A %d %B %Y"; -#ifdef __WXOSX__ - static const char *C_DATE_TIME_FMT = "%A %d %B %Y %H:%M:%S"; -#else - static const char *C_DATE_TIME_FMT = "%d/%m/%Y %H:%M:%S"; -#endif -#endif - - setlocale(LC_ALL, "C"); - - WX_ASSERT_EQUAL_FORMAT( "C short date", C_DATE_FMT, - m_locale->GetInfo(wxLOCALE_SHORT_DATE_FMT) ); - WX_ASSERT_EQUAL_FORMAT( "C long date", C_LONG_DATE_FMT, - m_locale->GetInfo(wxLOCALE_LONG_DATE_FMT) ); - WX_ASSERT_EQUAL_FORMAT( "C date and time", C_DATE_TIME_FMT, - m_locale->GetInfo(wxLOCALE_DATE_TIME_FMT) ); - WX_ASSERT_EQUAL_FORMAT( "C time", "%H:%M:%S", - m_locale->GetInfo(wxLOCALE_TIME_FMT) ); -} - void IntlTestCase::IsAvailable() { const wxString origLocale(setlocale(LC_ALL, NULL));