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 <samuli.piippo@digia.com>
Reviewed-by: Janne Anttila <janne.anttila@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
This commit is contained in:
Liang Qi 2012-11-09 05:11:34 +01:00 committed by The Qt Project
parent 7aae8c0f0f
commit 8e722eb85a

View File

@ -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"));