Put timezone related code under ifdef
In case FEATURE_timezone=OFF auto-tests should still be built successfully Change-Id: I0226a7d7781a412bf9e9935c2cf1a48b1ce427b5 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
parent
9618427ee5
commit
42d3e242fa
@ -4805,19 +4805,22 @@ void tst_QSqlQuery::ibaseDateTimeWithTZ_data()
|
|||||||
QTest::addColumn<QList<QDateTime> >("initialDateTimes");
|
QTest::addColumn<QList<QDateTime> >("initialDateTimes");
|
||||||
QTest::addColumn<QList<QDateTime> >("expectedDateTimes");
|
QTest::addColumn<QList<QDateTime> >("expectedDateTimes");
|
||||||
|
|
||||||
|
#if QT_CONFIG(timezone)
|
||||||
const QTimeZone afterUTCTimeZone("Asia/Hong_Kong");
|
const QTimeZone afterUTCTimeZone("Asia/Hong_Kong");
|
||||||
const QTimeZone beforeUTCTimeZone("America/Los_Angeles");
|
const QTimeZone beforeUTCTimeZone("America/Los_Angeles");
|
||||||
const QTimeZone utcTimeZone("UTC");
|
|
||||||
|
|
||||||
const QDateTime dtWithAfterTZ(QDate(2015, 5, 18), QTime(4, 26, 30, 500), afterUTCTimeZone);
|
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 dtWithBeforeTZ(QDate(2015, 5, 18), QTime(4, 26, 30, 500), beforeUTCTimeZone);
|
||||||
|
const QTimeZone utcTimeZone("UTC");
|
||||||
const QDateTime dtWithUTCTZ(QDate(2015, 5, 18), QTime(4, 26, 30, 500), utcTimeZone);
|
const QDateTime dtWithUTCTZ(QDate(2015, 5, 18), QTime(4, 26, 30, 500), utcTimeZone);
|
||||||
|
#endif // QT_CONFIG(timezone)
|
||||||
const QDateTime dtLocalTZ(QDateTime::currentDateTime());
|
const QDateTime dtLocalTZ(QDateTime::currentDateTime());
|
||||||
|
|
||||||
const QList<QDateTime> dateTimes = {
|
const QList<QDateTime> dateTimes = {
|
||||||
|
#if QT_CONFIG(timezone)
|
||||||
dtWithAfterTZ,
|
dtWithAfterTZ,
|
||||||
dtWithBeforeTZ,
|
dtWithBeforeTZ,
|
||||||
dtWithUTCTZ,
|
dtWithUTCTZ,
|
||||||
|
#endif // QT_CONFIG(timezone)
|
||||||
dtLocalTZ
|
dtLocalTZ
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -5018,7 +5021,7 @@ void tst_QSqlQuery::ibaseTimeStampTzArray()
|
|||||||
"create table %1 (timeStampData timestamp with time zone[0:4])").arg(ts.tableName())));
|
"create table %1 (timeStampData timestamp with time zone[0:4])").arg(ts.tableName())));
|
||||||
QVERIFY_SQL(qry, prepare(QLatin1String("insert into %1 (timeStampData)"
|
QVERIFY_SQL(qry, prepare(QLatin1String("insert into %1 (timeStampData)"
|
||||||
" values(?)").arg(ts.tableName())));
|
" values(?)").arg(ts.tableName())));
|
||||||
|
#if QT_CONFIG(timezone)
|
||||||
const QDateTime dtWithAfterTZ(QDate(2015, 5, 18), QTime(4, 26, 30, 500), QTimeZone("Asia/Hong_Kong"));
|
const QDateTime dtWithAfterTZ(QDate(2015, 5, 18), QTime(4, 26, 30, 500), QTimeZone("Asia/Hong_Kong"));
|
||||||
const QDateTime dtWithBeforeTZ(QDate(2015, 5, 18), QTime(4, 26, 30, 500), QTimeZone("America/Los_Angeles"));
|
const QDateTime dtWithBeforeTZ(QDate(2015, 5, 18), QTime(4, 26, 30, 500), QTimeZone("America/Los_Angeles"));
|
||||||
const QDateTime dtWithUTCTZ(QDate(2015, 5, 18), QTime(4, 26, 30, 500), QTimeZone("UTC"));
|
const QDateTime dtWithUTCTZ(QDate(2015, 5, 18), QTime(4, 26, 30, 500), QTimeZone("UTC"));
|
||||||
@ -5036,6 +5039,7 @@ void tst_QSqlQuery::ibaseTimeStampTzArray()
|
|||||||
QVERIFY_SQL(qry, exec("select * from " + ts.tableName()));
|
QVERIFY_SQL(qry, exec("select * from " + ts.tableName()));
|
||||||
QVERIFY(qry.next());
|
QVERIFY(qry.next());
|
||||||
QCOMPARE(qry.value(0).toList(), timeStampData.toList());
|
QCOMPARE(qry.value(0).toList(), timeStampData.toList());
|
||||||
|
#endif // QT_CONFIG(timezone)
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QSqlQuery::ibase_executeBlock()
|
void tst_QSqlQuery::ibase_executeBlock()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user