]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/datetime/datetimetest.cpp
make wxStringOperationsWchar methods templates too to be able to reuse them with...
[wxWidgets.git] / tests / datetime / datetimetest.cpp
index 745a8d8d36421feac1c3b6b1ba2fe517c9452477..8fed158607ab5e77f44823adf537030bece163d8 100644 (file)
@@ -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 )
                 {