correct French short date format for glibc; added more detailed messages for failing tests
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59954 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -123,7 +123,8 @@ void IntlTestCase::Headers()
|
|||||||
CPPUNIT_ASSERT_EQUAL( "", m_locale->GetHeaderValue("X-Not-Here") );
|
CPPUNIT_ASSERT_EQUAL( "", m_locale->GetHeaderValue("X-Not-Here") );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CompareFormats(const wxString& expected, wxString actual)
|
static void
|
||||||
|
CompareFormats(const char *msg, const wxString& expected, wxString actual)
|
||||||
{
|
{
|
||||||
if ( actual.empty() )
|
if ( actual.empty() )
|
||||||
{
|
{
|
||||||
@@ -138,7 +139,7 @@ static void CompareFormats(const wxString& expected, wxString actual)
|
|||||||
actual.Replace("%e", "%d");
|
actual.Replace("%e", "%d");
|
||||||
#endif // __GLIBC__
|
#endif // __GLIBC__
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL( expected, actual );
|
CPPUNIT_ASSERT_EQUAL_MESSAGE( msg, expected, actual );
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntlTestCase::DateTimeFmt()
|
void IntlTestCase::DateTimeFmt()
|
||||||
@@ -149,25 +150,31 @@ void IntlTestCase::DateTimeFmt()
|
|||||||
#ifdef __GLIBC__
|
#ifdef __GLIBC__
|
||||||
// glibc also uses dots for French locale separator for some reason (the
|
// glibc also uses dots for French locale separator for some reason (the
|
||||||
// standard format uses slashes)
|
// standard format uses slashes)
|
||||||
static const char *FRENCH_DATE_FMT = "%d.%m.%y";
|
static const char *FRENCH_DATE_FMT = "%d.%m.%Y";
|
||||||
#else
|
#else
|
||||||
static const char *FRENCH_DATE_FMT = "%d/%m/%y";
|
static const char *FRENCH_DATE_FMT = "%d/%m/%y";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CompareFormats( FRENCH_DATE_FMT, m_locale->GetInfo(wxLOCALE_SHORT_DATE_FMT) );
|
CompareFormats( "French short date", FRENCH_DATE_FMT,
|
||||||
CompareFormats( "%a %d %b %Y", m_locale->GetInfo(wxLOCALE_LONG_DATE_FMT) );
|
m_locale->GetInfo(wxLOCALE_SHORT_DATE_FMT) );
|
||||||
CompareFormats( "%a %d %b %Y %H:%M:%S %Z",
|
CompareFormats( "French long date", "%a %d %b %Y",
|
||||||
|
m_locale->GetInfo(wxLOCALE_LONG_DATE_FMT) );
|
||||||
|
CompareFormats( "French date and time", "%a %d %b %Y %H:%M:%S %Z",
|
||||||
m_locale->GetInfo(wxLOCALE_DATE_TIME_FMT) );
|
m_locale->GetInfo(wxLOCALE_DATE_TIME_FMT) );
|
||||||
CompareFormats( "%H:%M:%S", m_locale->GetInfo(wxLOCALE_TIME_FMT) );
|
CompareFormats( "French time", "%H:%M:%S",
|
||||||
|
m_locale->GetInfo(wxLOCALE_TIME_FMT) );
|
||||||
|
|
||||||
// also test for "C" locale
|
// also test for "C" locale
|
||||||
setlocale(LC_ALL, "C");
|
setlocale(LC_ALL, "C");
|
||||||
|
|
||||||
CompareFormats( "%m/%d/%y", m_locale->GetInfo(wxLOCALE_SHORT_DATE_FMT) );
|
CompareFormats( "C short date", "%m/%d/%y",
|
||||||
CompareFormats( "%a %b %d %Y", m_locale->GetInfo(wxLOCALE_LONG_DATE_FMT) );
|
m_locale->GetInfo(wxLOCALE_SHORT_DATE_FMT) );
|
||||||
CompareFormats( "%a %b %d %H:%M:%S %Y",
|
CompareFormats( "C long date", "%a %b %d %Y",
|
||||||
|
m_locale->GetInfo(wxLOCALE_LONG_DATE_FMT) );
|
||||||
|
CompareFormats( "C date and time", "%a %b %d %H:%M:%S %Y",
|
||||||
m_locale->GetInfo(wxLOCALE_DATE_TIME_FMT) );
|
m_locale->GetInfo(wxLOCALE_DATE_TIME_FMT) );
|
||||||
CompareFormats( "%H:%M:%S", m_locale->GetInfo(wxLOCALE_TIME_FMT) );
|
CompareFormats( "C time", "%H:%M:%S",
|
||||||
|
m_locale->GetInfo(wxLOCALE_TIME_FMT) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_INTL
|
#endif // wxUSE_INTL
|
||||||
|
Reference in New Issue
Block a user