]> git.saurik.com Git - wxWidgets.git/commitdiff
fixes for Italian locale: ignore a final 'CET' string and don't test '%p' for it
authorFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Sat, 21 Mar 2009 00:37:19 +0000 (00:37 +0000)
committerFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Sat, 21 Mar 2009 00:37:19 +0000 (00:37 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59682 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/datetime/datetimetest.cpp

index 745a8d8d36421feac1c3b6b1ba2fe517c9452477..24f554e37bff76aae669f0508cce7746f813351e 100644 (file)
@@ -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 )
                 {