diff options
author | Leander Beernaert <leander.beernaert@qt.io> | 2020-01-22 13:47:08 +0100 |
---|---|---|
committer | Leander Beernaert <leander.beernaert@qt.io> | 2020-01-24 13:17:33 +0100 |
commit | 502d3d6744913899da87acfda5ebdab42c40329e (patch) | |
tree | 16658a328503bfd5a62b4fd5d69ffb66e9854b18 /tests/auto/corelib/global | |
parent | d1be8b9ceb2c7b20bbe53a07154c79699540ea3d (diff) | |
parent | 06bb315beb6c2c398223cfe52cbc7f66e14a8557 (diff) |
Merge remote-tracking branch 'origin/dev' into merge-dev
Change-Id: I31b761cfd5ea01373c60d02a5da8c33398d34739
Diffstat (limited to 'tests/auto/corelib/global')
-rw-r--r-- | tests/auto/corelib/global/qflags/tst_qflags.cpp | 2 | ||||
-rw-r--r-- | tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp | 11 | ||||
-rw-r--r-- | tests/auto/corelib/global/qglobal/qglobal.c | 2 | ||||
-rw-r--r-- | tests/auto/corelib/global/qlogging/tst_qlogging.cpp | 10 |
4 files changed, 17 insertions, 8 deletions
diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp index 1568855032..be75f5b3cc 100644 --- a/tests/auto/corelib/global/qflags/tst_qflags.cpp +++ b/tests/auto/corelib/global/qflags/tst_qflags.cpp @@ -49,7 +49,7 @@ void tst_QFlags::testFlag() const QVERIFY(btn.testFlag(Qt::LeftButton)); QVERIFY(!btn.testFlag(Qt::MidButton)); - btn = 0; + btn = { }; QVERIFY(!btn.testFlag(Qt::LeftButton)); } diff --git a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp index 94f0afa5ed..a661b0388e 100644 --- a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp +++ b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp @@ -430,6 +430,13 @@ void tst_qfloat16::finite() QVERIFY(!qIsInf(value)); QVERIFY(!qIsNaN(value)); QCOMPARE(qFpClassify(value), mode); + + // *NOT* using QCOMPARE() on finite qfloat16 values, since that uses fuzzy + // comparison, and we need exact here. + const qfloat16 zero(0), plus(+1), minus(-1); + const qfloat16 magnitude = (value < zero) ? -value : value; + QVERIFY(value.copySign(plus) == magnitude); + QVERIFY(value.copySign(minus) == -magnitude); } void tst_qfloat16::properties() @@ -534,7 +541,9 @@ void tst_qfloat16::limits() // See also: qNaN() and infinity() QVERIFY(Bounds::denorm_min() / rose == zero); if (overOptimized) QEXPECT_FAIL("", "Over-optimized on ARM", Continue); - QVERIFY(-Bounds::denorm_min() / rose == -zero); + const qfloat16 under = (-Bounds::denorm_min()) / rose; + QVERIFY(under == -zero); + QCOMPARE(qfloat16(1).copySign(under), qfloat16(-1)); } QTEST_APPLESS_MAIN(tst_qfloat16) diff --git a/tests/auto/corelib/global/qglobal/qglobal.c b/tests/auto/corelib/global/qglobal/qglobal.c index c7124454d0..7a2266ae94 100644 --- a/tests/auto/corelib/global/qglobal/qglobal.c +++ b/tests/auto/corelib/global/qglobal/qglobal.c @@ -28,7 +28,7 @@ #include <QtCore/qglobal.h> -#if QT_HAS_INCLUDE(<stdbool.h>) || __STDC_VERSION__ >= 199901L +#if __has_include(<stdbool.h>) || __STDC_VERSION__ >= 199901L # include <stdbool.h> #else # undef true diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index 6c0470c8fe..6c6f3a2168 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2014 Olivier Goffart <ogoffart@woboq.com> ** Contact: https://www.qt.io/licensing/ ** @@ -767,18 +767,18 @@ void tst_qmessagehandler::qMessagePattern_data() QTest::qWait(10000); QTest::newRow("time") << "/%{time yyyy - MM - d}/%{message}" << true << (QList<QByteArray>() - << ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toUtf8() + "/qDebug")); + << ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toLocal8Bit() + "/qDebug")); QTest::newRow("time-time") << "/%{time yyyy - MM - d}/%{time dd-MM-yy}/%{message}" << true << (QList<QByteArray>() - << ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toUtf8() - + '/' + QDateTime::currentDateTime().toString("dd-MM-yy").toUtf8() + << ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toLocal8Bit() + + '/' + QDateTime::currentDateTime().toString("dd-MM-yy").toLocal8Bit() + "/qDebug")); QTest::newRow("skipped-time-shown-time") << "/%{if-warning}%{time yyyy - MM - d}%{endif}%{if-debug}%{time dd-MM-yy}%{endif}/%{message}" << true << (QList<QByteArray>() - << ('/' + QDateTime::currentDateTime().toString("dd-MM-yy").toUtf8() + "/qDebug")); + << ('/' + QDateTime::currentDateTime().toString("dd-MM-yy").toLocal8Bit() + "/qDebug")); // %{time} should have a padding of 6 so if it takes less than 10 seconds to show // the first message, there should be 5 spaces |