diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2019-03-22 14:29:05 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-06-23 16:59:45 +0200 |
commit | f6d1be7c66782e718b23dc0905b60a975b19e14c (patch) | |
tree | 7af02313b32b7157dff58413d12fa58eebd383be /tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp | |
parent | 21b5c7875cc39c575b14b190add676a5b96fb0b5 (diff) |
Use ranged for loops in place of foreach in QTimeZone tests
This (and use of Q_SLOTS for the test slots) makes it possible to
enable QT_NO_KEYWORDS and QT_NO_FOREACH in all the corelib/time/
tests.
Change-Id: I85fd358f3d1a72c9269d5260d0224640c1751f2d
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp')
-rw-r--r-- | tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp index 5c2af3b115..82fea3c716 100644 --- a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2019 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -42,7 +42,7 @@ class tst_QTimeZone : public QObject public: tst_QTimeZone(); -private slots: +private Q_SLOTS: // Public class default system tests void createTest(); void nullTest(); @@ -385,8 +385,8 @@ void tst_QTimeZone::dataStreamTest() void tst_QTimeZone::isTimeZoneIdAvailable() { - QList<QByteArray> available = QTimeZone::availableTimeZoneIds(); - foreach (const QByteArray &id, available) { + const QList<QByteArray> available = QTimeZone::availableTimeZoneIds(); + for (const QByteArray &id : available) { QVERIFY(QTimeZone::isTimeZoneIdAvailable(id)); QVERIFY(QTimeZone(id).isValid()); } @@ -701,8 +701,8 @@ void tst_QTimeZone::availableTimeZoneIds() void tst_QTimeZone::stressTest() { - QList<QByteArray> idList = QTimeZone::availableTimeZoneIds(); - foreach (const QByteArray &id, idList) { + const QList<QByteArray> idList = QTimeZone::availableTimeZoneIds(); + for (const QByteArray &id : idList) { QTimeZone testZone = QTimeZone(id); QCOMPARE(testZone.isValid(), true); QCOMPARE(testZone.id(), id); |