summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergio Ahumada <sergio.ahumada@digia.com>2012-11-09 16:49:22 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-12 13:33:55 (GMT)
commit492dd97f9b214b661cd45ab178fff316709b6382 (patch)
tree6c4681e3de3edb8697a1386db8c0d0ecf86c1353
parent8a7bab8f497a777335814e3a3bdc78b10732f57a (diff)
downloadQt-492dd97f9b214b661cd45ab178fff316709b6382.zip
Qt-492dd97f9b214b661cd45ab178fff316709b6382.tar.gz
Qt-492dd97f9b214b661cd45ab178fff316709b6382.tar.bz2
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 (back port from qtbase 65685fbd2a3a587e654807d9ce44708064afdfa2) Task-number: QTBUG-27790 Change-Id: I668ff8882cf676d4420bf4dd66dc2cdd3b84fc18 Reviewed-by: Liang Qi <liang.qi@digia.com>
-rw-r--r--tests/auto/qlocale/tst_qlocale.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp
index 795a284..d7e278f 100644
--- a/tests/auto/qlocale/tst_qlocale.cpp
+++ b/tests/auto/qlocale/tst_qlocale.cpp
@@ -91,7 +91,9 @@ public:
private slots:
void initTestCase();
void windowsDefaultLocale();
+#ifdef Q_OS_MAC
void macDefaultLocale();
+#endif
void ctor();
void emptyCtor();
@@ -1106,12 +1108,9 @@ void tst_QLocale::toDateTime()
QCOMPARE(l.toDateTime(string, QLocale::LongFormat), result);
}
+#ifdef Q_OS_MAC
void tst_QLocale::macDefaultLocale()
{
-#ifndef Q_OS_MAC
- QSKIP("This is a Mac OS X-only test", SkipAll);
-#endif
-
QLocale locale = QLocale::system();
if (locale.name() != QLatin1String("en_US")) {
QSKIP("This test only tests for en_US", SkipAll);
@@ -1128,7 +1127,10 @@ void tst_QLocale::macDefaultLocale()
QCOMPARE(locale.decimalPoint(), QChar('.'));
QCOMPARE(locale.groupSeparator(), QChar(','));
QCOMPARE(locale.dateFormat(QLocale::ShortFormat), QString("M/d/yy"));
- QCOMPARE(locale.dateFormat(QLocale::LongFormat), QString("MMMM d, yyyy"));
+ if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_6)
+ 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"));
@@ -1154,6 +1156,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"));
@@ -1190,6 +1193,7 @@ void tst_QLocale::macDefaultLocale()
QCOMPARE(locale.weekdays(), days);
}
+#endif
#ifdef Q_OS_WIN
#include <qt_windows.h>