summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2020-04-23 17:11:40 +0300
committerAndrei Golubev <andrei.golubev@qt.io>2020-05-11 14:42:00 +0300
commitb428e98052aa1b97a42f31ed52b1266d17e186ee (patch)
treed6ce2fefdef8279b986239b2f09a5c3fa36da473 /tests/auto/widgets
parent255cc55d74b55dfbecd9af0ea8d39aaf181da4ce (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/widgets')
-rw-r--r--tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp2
-rw-r--r--tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp14
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
index 0243b587b2..a9d2b413f0 100644
--- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
@@ -1605,7 +1605,9 @@ void tst_QItemDelegate::dateTextForRole_data()
// Ensure we exercise every time-spec variant:
QTest::newRow("local") << QDateTime(date, time, Qt::LocalTime);
QTest::newRow("UTC") << QDateTime(date, time, Qt::UTC);
+#if QT_CONFIG(timezone)
QTest::newRow("zone") << QDateTime(date, time, QTimeZone("Europe/Dublin"));
+#endif
QTest::newRow("offset") << QDateTime(date, time, Qt::OffsetFromUTC, 36000);
#endif
}
diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
index 08c80c96ab..6efac708b9 100644
--- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -4510,6 +4510,7 @@ void tst_QDateTimeEdit::stepModifierPressAndHold()
QCOMPARE(value.toDate(), expectedDate);
}
+#if QT_CONFIG(timezone)
/*
The following tests verify correct handling of the spring forward gap; which
hour is skipped, and on which day, depends on the local time zone. We try to
@@ -4535,6 +4536,7 @@ static QDateTime findSpring(int year, const QTimeZone &timeZone)
return spring;
};
+#endif
/*!
Test that typing in a time that is invalid due to spring forward gap
@@ -4542,6 +4544,7 @@ static QDateTime findSpring(int year, const QTimeZone &timeZone)
*/
void tst_QDateTimeEdit::springForward_data()
{
+#if QT_CONFIG(timezone)
QTest::addColumn<QDateTime>("start");
QTest::addColumn<QAbstractSpinBox::CorrectionMode>("correctionMode");
QTest::addColumn<QTime>("inputTime");
@@ -4589,10 +4592,14 @@ void tst_QDateTimeEdit::springForward_data()
<< QAbstractSpinBox::CorrectToNearestValue
<< springGapMiddle
<< springTransition;
+#else
+ QSKIP("Needs timezone feature enabled");
+#endif
}
void tst_QDateTimeEdit::springForward()
{
+#if QT_CONFIG(timezone)
QFETCH(QDateTime, start);
QFETCH(QAbstractSpinBox::CorrectionMode, correctionMode);
QFETCH(QTime, inputTime);
@@ -4621,6 +4628,7 @@ void tst_QDateTimeEdit::springForward()
QTest::keyClick(&edit, Qt::Key_Return, {});
QCOMPARE(edit.dateTime(), expected);
+#endif
}
/*!
@@ -4632,6 +4640,7 @@ void tst_QDateTimeEdit::springForward()
*/
void tst_QDateTimeEdit::stepIntoDSTGap_data()
{
+#if QT_CONFIG(timezone)
QTest::addColumn<QDateTime>("start");
QTest::addColumn<QDateTimeEdit::Section>("section");
QTest::addColumn<int>("steps");
@@ -4706,10 +4715,14 @@ void tst_QDateTimeEdit::stepIntoDSTGap_data()
<< QDateTimeEdit::YearSection
<< -1
<< springTransition;
+#else
+ QSKIP("Needs timezone feature enabled");
+#endif
}
void tst_QDateTimeEdit::stepIntoDSTGap()
{
+#if QT_CONFIG(timezone)
QFETCH(QDateTime, start);
QFETCH(QDateTimeEdit::Section, section);
QFETCH(int, steps);
@@ -4732,6 +4745,7 @@ void tst_QDateTimeEdit::stepIntoDSTGap()
QTest::keyClick(&edit, steps > 0 ? Qt::Key_Up : Qt::Key_Down, {});
QCOMPARE(edit.dateTime(), end);
+#endif
}
QTEST_MAIN(tst_QDateTimeEdit)