From 6437bd240f64a60e376ff3c5432c9d7e53072782 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 24 Nov 2021 17:25:45 +0100 Subject: Skip test if it has no data-rows On QNX, tst_QDateTime::fromStringStringFormat_localTimeZone_data() failed to set up any rows for the data-driven tests to fetch, leading to an assertion failure on trying to fetch a row. Change-Id: I7c405b1142a8cb6d445b501ea44fe3d440570cf3 Reviewed-by: Andreas Buhr Reviewed-by: Andrei Golubev --- tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp index ef0be8a97c..b8f61ea8fd 100644 --- a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp @@ -2902,10 +2902,12 @@ void tst_QDateTime::fromStringStringFormat_localTimeZone_data() QTest::addColumn("string"); QTest::addColumn("format"); QTest::addColumn("expected"); + bool lacksRows = true; #if QT_CONFIG(timezone) QTimeZone etcGmtWithOffset("Etc/GMT+3"); if (etcGmtWithOffset.isValid()) { + lacksRows = false; QTest::newRow("local-timezone-with-offset:Etc/GMT+3") << QByteArrayLiteral("GMT") << QString("2008-10-13 Etc/GMT+3 11.50") << QString("yyyy-MM-dd t hh.mm") << QDateTime(QDate(2008, 10, 13), QTime(11, 50), etcGmtWithOffset); @@ -2916,18 +2918,21 @@ void tst_QDateTime::fromStringStringFormat_localTimeZone_data() } QTimeZone gmtWithOffset("GMT-2"); if (gmtWithOffset.isValid()) { + lacksRows = false; QTest::newRow("local-timezone-with-offset:GMT-2") << QByteArrayLiteral("GMT") << QString("2008-10-13 GMT-2 11.50") << QString("yyyy-MM-dd t hh.mm") << QDateTime(QDate(2008, 10, 13), QTime(11, 50), gmtWithOffset); } QTimeZone gmt("GMT"); if (gmt.isValid()) { + lacksRows = false; QTest::newRow("local-timezone-with-offset:GMT") << QByteArrayLiteral("GMT") << QString("2008-10-13 GMT 11.50") << QString("yyyy-MM-dd t hh.mm") << QDateTime(QDate(2008, 10, 13), QTime(11, 50), gmt); } QTimeZone helsinki("Europe/Helsinki"); if (helsinki.isValid()) { + lacksRows = false; // QTBUG-96861: QAsn1Element::toDateTime() tripped over an assert in // QTimeZonePrivate::dataForLocalTime() on macOS and iOS. // The first 20m 11s of 1921-05-01 were skipped, so the parser's attempt @@ -2939,6 +2944,8 @@ void tst_QDateTime::fromStringStringFormat_localTimeZone_data() << QDateTime(QDate(1921, 5, 6), QTime(0, 0), Qt::UTC); } #endif + if (lacksRows) + QSKIP("Testcases all use zones unsupported on this platform"); } void tst_QDateTime::fromStringStringFormat_localTimeZone() -- cgit v1.2.3