summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/tools/qlocale/tst_qlocale.cpp')
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index 0466ced10a..edaa00098e 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -370,7 +370,7 @@ void tst_QLocale::ctor()
&& l.country() == QLocale::exp_country, \
QString("requested: \"" + QString(req_lc) + "\", got: " \
+ QLocale::languageToString(l.language()) \
- + "/" + QLocale::countryToString(l.country())).toLatin1().constData()); \
+ + QLatin1Char('/') + QLocale::countryToString(l.country())).toLatin1().constData()); \
QCOMPARE(l, QLocale(QLocale::exp_lang, QLocale::exp_country)); \
QCOMPARE(qHash(l), qHash(QLocale(QLocale::exp_lang, QLocale::exp_country))); \
}
@@ -431,8 +431,8 @@ void tst_QLocale::ctor()
&& l.country() == QLocale::exp_country, \
QString("requested: \"" + QString(req_lc) + "\", got: " \
+ QLocale::languageToString(l.language()) \
- + "/" + QLocale::scriptToString(l.script()) \
- + "/" + QLocale::countryToString(l.country())).toLatin1().constData()); \
+ + QLatin1Char('/') + QLocale::scriptToString(l.script()) \
+ + QLatin1Char('/') + QLocale::countryToString(l.country())).toLatin1().constData()); \
}
TEST_CTOR("zh_CN", Chinese, SimplifiedHanScript, China)
@@ -606,7 +606,7 @@ void tst_QLocale::legacyNames()
&& l.country() == QLocale::exp_country, \
QString("requested: \"" + QString(req_lc) + "\", got: " \
+ QLocale::languageToString(l.language()) \
- + "/" + QLocale::countryToString(l.country())).toLatin1().constData()); \
+ + QLatin1Char('/') + QLocale::countryToString(l.country())).toLatin1().constData()); \
}
TEST_CTOR("mo_MD", Romanian, Moldova)
@@ -1278,13 +1278,13 @@ void tst_QLocale::formatTimeZone()
QLocale enUS("en_US");
QDateTime dt1(QDate(2013, 1, 1), QTime(1, 0, 0), Qt::OffsetFromUTC, 60 * 60);
- QCOMPARE(enUS.toString(dt1, "t"), QString("UTC+01:00"));
+ QCOMPARE(enUS.toString(dt1, "t"), QLatin1String("UTC+01:00"));
QDateTime dt2(QDate(2013, 1, 1), QTime(1, 0, 0), Qt::OffsetFromUTC, -60 * 60);
- QCOMPARE(enUS.toString(dt2, "t"), QString("UTC-01:00"));
+ QCOMPARE(enUS.toString(dt2, "t"), QLatin1String("UTC-01:00"));
QDateTime dt3(QDate(2013, 1, 1), QTime(0, 0, 0), Qt::UTC);
- QCOMPARE(enUS.toString(dt3, "t"), QString("UTC"));
+ QCOMPARE(enUS.toString(dt3, "t"), QLatin1String("UTC"));
// LocalTime should vary
if (europeanTimeZone) {
@@ -1293,14 +1293,14 @@ void tst_QLocale::formatTimeZone()
#ifdef Q_OS_WIN
QEXPECT_FAIL("", "Windows only returns long name (QTBUG-32759)", Continue);
#endif // Q_OS_WIN
- QCOMPARE(enUS.toString(dt4, "t"), QString("CET"));
+ QCOMPARE(enUS.toString(dt4, "t"), QLatin1String("CET"));
// Time definitely in Daylight Time
QDateTime dt5(QDate(2013, 6, 1), QTime(0, 0, 0), Qt::LocalTime);
#ifdef Q_OS_WIN
QEXPECT_FAIL("", "Windows only returns long name (QTBUG-32759)", Continue);
#endif // Q_OS_WIN
- QCOMPARE(enUS.toString(dt5, "t"), QString("CEST"));
+ QCOMPARE(enUS.toString(dt5, "t"), QLatin1String("CEST"));
} else {
QSKIP("You must test using Central European (CET/CEST) time zone, e.g. TZ=Europe/Oslo");
}
@@ -1309,13 +1309,13 @@ void tst_QLocale::formatTimeZone()
#ifdef Q_OS_WIN
QEXPECT_FAIL("", "QTimeZone windows backend only returns long name", Continue);
#endif
- QCOMPARE(enUS.toString(dt6, "t"), QString("CET"));
+ QCOMPARE(enUS.toString(dt6, "t"), QLatin1String("CET"));
QDateTime dt7(QDate(2013, 6, 1), QTime(0, 0, 0), QTimeZone("Europe/Berlin"));
#ifdef Q_OS_WIN
QEXPECT_FAIL("", "QTimeZone windows backend only returns long name", Continue);
#endif
- QCOMPARE(enUS.toString(dt7, "t"), QString("CEST"));
+ QCOMPARE(enUS.toString(dt7, "t"), QLatin1String("CEST"));
// Current datetime should return current abbreviation
QCOMPARE(enUS.toString(QDateTime::currentDateTime(), "t"),
@@ -1461,9 +1461,9 @@ void tst_QLocale::macDefaultLocale()
if (timeString.contains(QString("GMT"))) {
QString expectedGMTSpecifierBase("GMT");
if (diff >= 0)
- expectedGMTSpecifierBase.append("+");
+ expectedGMTSpecifierBase.append(QLatin1Char('+'));
else
- expectedGMTSpecifierBase.append("-");
+ expectedGMTSpecifierBase.append(QLatin1Char('-'));
QString expectedGMTSpecifier = expectedGMTSpecifierBase + QString("%1").arg(qAbs(diff));
QString expectedGMTSpecifierZeroExtended = expectedGMTSpecifierBase + QString("0%1").arg(qAbs(diff));
@@ -1698,9 +1698,11 @@ void tst_QLocale::testNames_data()
for (int i = 0; i < locale_data_count; ++i) {
const QLocaleData &item = locale_data[i];
- const QString testName = QString::fromLatin1("data_%1 (%2/%3)").arg(i)
- .arg(QLocale::languageToString((QLocale::Language)item.m_language_id))
- .arg(QLocale::countryToString((QLocale::Country)item.m_country_id));
+
+ const QString testName = QLatin1String("data_") + QString::number(i) + QLatin1String(" (")
+ + QLocale::languageToString((QLocale::Language)item.m_language_id)
+ + QLatin1Char('/') + QLocale::countryToString((QLocale::Country)item.m_country_id)
+ + QLatin1Char(')');
QTest::newRow(testName.toLatin1().constData()) << (int)item.m_language_id << (int)item.m_country_id;
}
}