summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qtimezone
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2016-09-30 17:01:57 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2016-12-12 13:58:58 +0000
commitaa06ea0d8b3d63b8a936da57df61ca258307c927 (patch)
tree73f521dbe030e24708bc3c40fefe790bfdc727b0 /tests/auto/corelib/tools/qtimezone
parent772b12c436e49fbaedea85e95ac645f40e4aa104 (diff)
tst_QTimeZone: tidy up handling of debug member
Make it const, initialize it instead of assigning, consolidate testing of it round some #if-ery. Change-Id: I2efbf58292a0edd2ceb3da8d3cc16246e84a3bac Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools/qtimezone')
-rw-r--r--tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
index 593cb7821d..9137de8baf 100644
--- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
+++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
@@ -63,13 +63,13 @@ private:
#ifdef QT_BUILD_INTERNAL
void testCetPrivate(const QTimeZonePrivate &tzp);
#endif // QT_BUILD_INTERNAL
- bool debug;
+ const bool debug;
};
tst_QTimeZone::tst_QTimeZone()
-{
// Set to true to print debug output, test Display Names and run long stress tests
- debug = false;
+ : debug(false)
+{
}
void tst_QTimeZone::printTimeZone(const QTimeZone tz)
@@ -756,9 +756,9 @@ void tst_QTimeZone::tzTest()
// Test display names by type, either ICU or abbreviation only
QLocale enUS("en_US");
-#ifdef QT_USE_ICU
// Only test names in debug mode, names used can vary by ICU version installed
if (debug) {
+#ifdef QT_USE_ICU
QCOMPARE(tzp.displayName(QTimeZone::StandardTime, QTimeZone::LongName, enUS),
QString("Central European Standard Time"));
QCOMPARE(tzp.displayName(QTimeZone::StandardTime, QTimeZone::ShortName, enUS),
@@ -778,9 +778,7 @@ void tst_QTimeZone::tzTest()
QString("GMT+01:00"));
QCOMPARE(tzp.displayName(QTimeZone::GenericTime, QTimeZone::OffsetName, enUS),
QString("UTC+01:00"));
- }
#else
- if (debug) {
QCOMPARE(tzp.displayName(QTimeZone::StandardTime, QTimeZone::LongName, enUS),
QString("CET"));
QCOMPARE(tzp.displayName(QTimeZone::StandardTime, QTimeZone::ShortName, enUS),
@@ -799,10 +797,8 @@ void tst_QTimeZone::tzTest()
QString("CET"));
QCOMPARE(tzp.displayName(QTimeZone::GenericTime, QTimeZone::OffsetName, enUS),
QString("CET"));
- }
#endif // QT_USE_ICU
- if (debug) {
// Test Abbreviations
QCOMPARE(tzp.abbreviation(std), QString("CET"));
QCOMPARE(tzp.abbreviation(dst), QString("CEST"));