diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2020-04-23 17:11:40 +0300 |
---|---|---|
committer | Andrei Golubev <andrei.golubev@qt.io> | 2020-05-11 14:42:00 +0300 |
commit | b428e98052aa1b97a42f31ed52b1266d17e186ee (patch) | |
tree | d6ce2fefdef8279b986239b2f09a5c3fa36da473 /tests/auto/sql | |
parent | 255cc55d74b55dfbecd9af0ea8d39aaf181da4ce (diff) |
Make qtbase compile without QT_CONFIG(timezone)
Fixes: QTBUG-83795
Pick-to: 5.15
Change-Id: I05eaaf57d87a9111d3609ebab81bc707f8af98f0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/sql')
-rw-r--r-- | tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index e15ac4faf3..e60d33081b 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -4018,6 +4018,7 @@ void tst_QSqlQuery::QTBUG_36211() QSqlQuery q(db); QVERIFY_SQL(q, exec(QString("CREATE TABLE %1 (dtwtz timestamptz, dtwotz timestamp)").arg(tableName))); +#if QT_CONFIG(timezone) QTimeZone l_tzBrazil("America/Sao_Paulo"); QTimeZone l_tzChina("Asia/Shanghai"); QVERIFY(l_tzBrazil.isValid()); @@ -4044,6 +4045,7 @@ void tst_QSqlQuery::QTBUG_36211() QVERIFY(diff <= 1000 - keep); } } +#endif } } @@ -4546,6 +4548,7 @@ void tst_QSqlQuery::dateTime_data() QTest::addColumn<QList<QDateTime> >("initialDateTimes"); QTest::addColumn<QList<QDateTime> >("expectedDateTimes"); +#if QT_CONFIG(timezone) // Using time zones which are highly unlikely to be the same as the testing machine's one // as it could pass as a result despite it. // +8.5 hours from UTC to North Korea @@ -4553,17 +4556,37 @@ void tst_QSqlQuery::dateTime_data() // -8 hours from UTC to Belize const QTimeZone beforeUTCTimeZone(-28800); const QTimeZone utcTimeZone("UTC"); - const QDateTime dt(QDate(2015, 5, 18), QTime(4, 26, 30)); - const QDateTime dtWithMS(QDate(2015, 5, 18), QTime(4, 26, 30, 500)); + const QDateTime dtWithAfterTZ(QDate(2015, 5, 18), QTime(4, 26, 30, 500), afterUTCTimeZone); const QDateTime dtWithBeforeTZ(QDate(2015, 5, 18), QTime(4, 26, 30, 500), beforeUTCTimeZone); const QDateTime dtWithUTCTZ(QDate(2015, 5, 18), QTime(4, 26, 30, 500), utcTimeZone); - const QList<QDateTime> dateTimes = { dt, dtWithMS, dtWithAfterTZ, dtWithBeforeTZ, dtWithUTCTZ }; - const QList<QDateTime> expectedDateTimesLocalTZ = { dt, dtWithMS, dtWithAfterTZ.toLocalTime(), - dtWithBeforeTZ.toLocalTime(), - dtWithUTCTZ.toLocalTime() }; - const QList<QDateTime> expectedTimeStampDateTimes = { dt, dtWithMS, dtWithMS, dtWithMS, dtWithMS }; - const QList<QDateTime> expectedDateTimes = { dt, dt, dt, dt, dt }; +#endif + const QDateTime dt(QDate(2015, 5, 18), QTime(4, 26, 30)); + const QDateTime dtWithMS(QDate(2015, 5, 18), QTime(4, 26, 30, 500)); + const QList<QDateTime> dateTimes = { + dt, dtWithMS, +#if QT_CONFIG(timezone) + dtWithAfterTZ, dtWithBeforeTZ, dtWithUTCTZ +#endif + }; + const QList<QDateTime> expectedDateTimesLocalTZ = { + dt, dtWithMS, +#if QT_CONFIG(timezone) + dtWithAfterTZ.toLocalTime(), dtWithBeforeTZ.toLocalTime(), dtWithUTCTZ.toLocalTime() +#endif + }; + const QList<QDateTime> expectedTimeStampDateTimes = { + dt, dtWithMS, +#if QT_CONFIG(timezone) + dtWithMS, dtWithMS, dtWithMS +#endif + }; + const QList<QDateTime> expectedDateTimes = { + dt, dt, +#if QT_CONFIG(timezone) + dt, dt, dt +#endif + }; for (const QString &dbName : qAsConst(dbs.dbNames)) { QSqlDatabase db = QSqlDatabase::database(dbName); |