From 5c63e6fd7541609c3fadb694c071b42e93b7acf5 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 11 Apr 2018 19:11:34 +0200 Subject: [PATCH] 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 --- tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp index df4ae59631..d040f3bafd 100644 --- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp @@ -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),