From 8e722eb85a91389ac4c9064fdd8c29e1dbc63c27 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 9 Nov 2012 05:11:34 +0100 Subject: [PATCH] test: fix tst_QLocale::macDefaultLocale 1. There is a behaviour change for CFDateFormatterGetFormat() between 10.6 and later, QLocale::dateFormat(QLocale::LongFormat) will return "MMMM d, yyyy" for 10.6 and "MMMM d, y" for 10.7, 10.8 2. Add a comment for toCurrencyString() test, need another system settings Task-number: QTBUG-27790 Change-Id: I4fe684d6e0c1d4a140e3b1f1ef395b7fdad030b4 Reviewed-by: Samuli Piippo Reviewed-by: Janne Anttila Reviewed-by: Sergio Ahumada --- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 40b5b3f..a1b6d1c 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -1137,8 +1137,9 @@ void tst_QLocale::macDefaultLocale() QCOMPARE(locale.groupSeparator(), QChar(',')); QCOMPARE(locale.dateFormat(QLocale::ShortFormat), QString("M/d/yy")); if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_6) - QEXPECT_FAIL("", "QTBUG-27790", Continue); - QCOMPARE(locale.dateFormat(QLocale::LongFormat), QString("MMMM d, yyyy")); + QCOMPARE(locale.dateFormat(QLocale::LongFormat), QString("MMMM d, y")); + else + QCOMPARE(locale.dateFormat(QLocale::LongFormat), QString("MMMM d, yyyy")); QCOMPARE(locale.timeFormat(QLocale::ShortFormat), QString("h:mm AP")); QCOMPARE(locale.timeFormat(QLocale::LongFormat), QString("h:mm:ss AP t")); @@ -1164,6 +1165,7 @@ void tst_QLocale::macDefaultLocale() const QString timeString = locale.toString(QTime(1,2,3), QLocale::LongFormat); QVERIFY(timeString.contains(QString("1:02:03"))); + // System Preferences->Language & Text, Region Tab, should choose "United States" for Region field QCOMPARE(locale.toCurrencyString(qulonglong(1234)), QString("$1,234.00")); QCOMPARE(locale.toCurrencyString(qlonglong(-1234)), QString("($1,234.00)")); QCOMPARE(locale.toCurrencyString(double(1234.56)), QString("$1,234.56")); -- 2.7.4