Clean up some trivia in tst_QTimeZone

Fix a mistaken #ifdef that should have been #if; and only call
QTimeZone::availableTimeZoneIds() once in transitionEachZone_data(),
while switching to use of a ranged-for.

Change-Id: Id27aae9ef450f21350283099c892ca7173884b94
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Edward Welbourne 2018-04-11 19:11:34 +02:00
parent 6a4b6971f4
commit 5c63e6fd75
1 changed files with 3 additions and 2 deletions

View File

@ -481,8 +481,9 @@ void tst_QTimeZone::transitionEachZone_data()
};
QString name;
const auto zones = QTimeZone::availableTimeZoneIds();
for (int k = sizeof(table) / sizeof(table[0]); k-- > 0; ) {
foreach (QByteArray zone, QTimeZone::availableTimeZoneIds()) {
for (const QByteArray &zone : zones) {
name.sprintf("%s@%d", zone.constData(), table[k].year);
QTest::newRow(name.toUtf8().constData())
<< zone
@ -907,7 +908,7 @@ void tst_QTimeZone::tzTest()
QLocale enUS("en_US");
// Only test names in debug mode, names used can vary by ICU version installed
if (debug) {
#ifdef QT_CONFIG(icu)
#if QT_CONFIG(icu)
QCOMPARE(tzp.displayName(QTimeZone::StandardTime, QTimeZone::LongName, enUS),
QString("Central European Standard Time"));
QCOMPARE(tzp.displayName(QTimeZone::StandardTime, QTimeZone::ShortName, enUS),