X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6b522db5c814ff32786d7686e2fb2d064c28b3de..5b119b8b2e49ba2e36ca689b8bb85cce6341f47c:/tests/datetime/datetimetest.cpp diff --git a/tests/datetime/datetimetest.cpp b/tests/datetime/datetimetest.cpp index 745a8d8d36..8fed158607 100644 --- a/tests/datetime/datetimetest.cpp +++ b/tests/datetime/datetimetest.cpp @@ -23,6 +23,7 @@ #if wxUSE_DATETIME #include "wx/datetime.h" +#include "wx/wxcrt.h" // for wxStrstr() // need this to be able to use CPPUNIT_ASSERT_EQUAL with wxDateTime objects static std::ostream& operator<<(std::ostream& ostr, const wxDateTime& dt) @@ -648,6 +649,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 +672,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 ) {