From: Francesco Montorsi Date: Sat, 21 Mar 2009 00:37:19 +0000 (+0000) Subject: fixes for Italian locale: ignore a final 'CET' string and don't test '%p' for it X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/a6121fc4e06c935848b6887f3ac10995784231ae fixes for Italian locale: ignore a final 'CET' string and don't test '%p' for it git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59682 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/tests/datetime/datetimetest.cpp b/tests/datetime/datetimetest.cpp index 745a8d8d36..24f554e37b 100644 --- a/tests/datetime/datetimetest.cpp +++ b/tests/datetime/datetimetest.cpp @@ -648,6 +648,14 @@ void DateTimeTestCase::TestTimeFormat() for ( size_t n = 0; n < WXSIZEOF(formatTestFormats); n++ ) { const char *fmt = formatTestFormats[n].format; + + // skip the check with %p for those locales which have empty AM/PM strings: + // for those locales it's impossible to pass the test with %p... + wxString am, pm; + wxDateTime::GetAmPmStrings(&am, &pm); + if (am.empty() && pm.empty() && wxStrstr(fmt, "%p") != NULL) + continue; + wxString s = dt.Format(fmt); // what can we recover? @@ -663,8 +671,12 @@ void DateTimeTestCase::TestTimeFormat() } else // conversion succeeded { - // should have parsed the entire string - CPPUNIT_ASSERT( !*result ); + // ParseFormat() should have parsed the entire string or left + // some final useless strings (e.g. with Italian locale the + // 's' string for the first test date looks like + // "---> sab 29 mag 1976 18:30:00 CET" + // so we just need to ignore CET) + CPPUNIT_ASSERT( !*result || strcmp(result, "CET") == 0 ); switch ( kind ) {