diff options
Diffstat (limited to 'tests/auto/testlib')
164 files changed, 1124 insertions, 243 deletions
diff --git a/tests/auto/testlib/CMakeLists.txt b/tests/auto/testlib/CMakeLists.txt index 1f8438fa64..35a26a8e34 100644 --- a/tests/auto/testlib/CMakeLists.txt +++ b/tests/auto/testlib/CMakeLists.txt @@ -2,6 +2,7 @@ # SPDX-License-Identifier: BSD-3-Clause add_subdirectory(qsignalspy) +add_subdirectory(tostring) # QTBUG-88507 if(QT_FEATURE_process AND NOT ANDROID) diff --git a/tests/auto/testlib/initmain/tst_initmain.cpp b/tests/auto/testlib/initmain/tst_initmain.cpp index 69376f704c..75a0d9ceb4 100644 --- a/tests/auto/testlib/initmain/tst_initmain.cpp +++ b/tests/auto/testlib/initmain/tst_initmain.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2019 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/outformat/tst_outformat.cpp b/tests/auto/testlib/outformat/tst_outformat.cpp index f7cbcf6dfd..90eb42d843 100644 --- a/tests/auto/testlib/outformat/tst_outformat.cpp +++ b/tests/auto/testlib/outformat/tst_outformat.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/qabstractitemmodeltester/CMakeLists.txt b/tests/auto/testlib/qabstractitemmodeltester/CMakeLists.txt index 3e302c02e7..20329a95f1 100644 --- a/tests/auto/testlib/qabstractitemmodeltester/CMakeLists.txt +++ b/tests/auto/testlib/qabstractitemmodeltester/CMakeLists.txt @@ -5,10 +5,18 @@ ## tst_qabstractitemmodeltester Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qabstractitemmodeltester LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qabstractitemmodeltester SOURCES ../../other/qabstractitemmodelutils/dynamictreemodel.cpp ../../other/qabstractitemmodelutils/dynamictreemodel.h tst_qabstractitemmodeltester.cpp + NO_PCH_SOURCES + tst_qabstractitemmodeltester.cpp # undef QT_NO_FOREACH INCLUDE_DIRECTORIES ../../other/qabstractitemmodelutils LIBRARIES diff --git a/tests/auto/testlib/qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp b/tests/auto/testlib/qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp index a7c90da6a9..c7c833fa09 100644 --- a/tests/auto/testlib/qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp +++ b/tests/auto/testlib/qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp @@ -1,5 +1,7 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses #include <QTest> #include <QAbstractItemModelTester> @@ -54,6 +56,7 @@ void tst_QAbstractItemModelTester::treeWidgetModel() new QTreeWidgetItem(root, QStringList(QString::number(i))); QTreeWidgetItem *remove = root->child(2); root->removeChild(remove); + delete remove; QTreeWidgetItem *parent = new QTreeWidgetItem(&widget, QStringList("parent")); new QTreeWidgetItem(parent, QStringList("child")); parent->setHidden(true); @@ -136,14 +139,8 @@ class AccessibleProxyModel : public QSortFilterProxyModel { Q_OBJECT public: - AccessibleProxyModel(QObject *parent = nullptr) : QSortFilterProxyModel(parent) - { - } - - QModelIndexList persistent() - { - return persistentIndexList(); - } + using QSortFilterProxyModel::QSortFilterProxyModel; + using QSortFilterProxyModel::persistentIndexList; }; class ObservingObject : public QObject @@ -156,15 +153,18 @@ public: storePersistentFailureCount(0), checkPersistentFailureCount(0) { - connect(m_proxy, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)), - SLOT(storePersistent())); - connect(m_proxy, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), - SLOT(checkPersistent())); + // moveRows signals can not come through because the proxy might sort/filter + // out some of the moved rows. therefore layoutChanged signals are sent from + // the QSFPM and we have to listen to them here to get properly notified + connect(m_proxy, &QAbstractProxyModel::layoutAboutToBeChanged, this, + &ObservingObject::storePersistent); + connect(m_proxy, &QAbstractProxyModel::layoutChanged, this, + &ObservingObject::checkPersistent); } public slots: - void storePersistent(const QModelIndex &parent) + void storePersistentRecursive(const QModelIndex &parent) { for (int row = 0; row < m_proxy->rowCount(parent); ++row) { QModelIndex proxyIndex = m_proxy->index(row, 0, parent); @@ -180,26 +180,27 @@ public slots: m_persistentSourceIndexes.append(sourceIndex); m_persistentProxyIndexes.append(proxyIndex); if (m_proxy->hasChildren(proxyIndex)) - storePersistent(proxyIndex); + storePersistentRecursive(proxyIndex); } } - void storePersistent() + void storePersistent(const QList<QPersistentModelIndex> &parents = {}) { - // This method is called from rowsAboutToBeMoved. Persistent indexes should be valid + // This method is called from source model rowsAboutToBeMoved. Persistent indexes should be valid foreach (const QModelIndex &idx, m_persistentProxyIndexes) if (!idx.isValid()) { qWarning("%s: persistentProxyIndexes contains invalid index", Q_FUNC_INFO); ++storePersistentFailureCount; } - - if (!m_proxy->persistent().isEmpty()) { - qWarning("%s: proxy should have no persistent indexes when storePersistent called", + const auto validCount = std::count_if(parents.begin(), parents.end(), + [](const auto &idx) { return idx.isValid(); }); + if (m_proxy->persistentIndexList().size() != validCount) { + qWarning("%s: proxy should have no additional persistent indexes when storePersistent called", Q_FUNC_INFO); ++storePersistentFailureCount; } - storePersistent(QModelIndex()); - if (m_proxy->persistent().isEmpty()) { + storePersistentRecursive(QModelIndex()); + if (m_proxy->persistentIndexList().isEmpty()) { qWarning("%s: proxy should have persistent index after storePersistent called", Q_FUNC_INFO); ++storePersistentFailureCount; @@ -208,6 +209,9 @@ public slots: void checkPersistent() { + QVERIFY(!m_persistentProxyIndexes.isEmpty()); + QVERIFY(!m_persistentSourceIndexes.isEmpty()); + for (int row = 0; row < m_persistentProxyIndexes.size(); ++row) { m_persistentProxyIndexes.at(row); m_persistentSourceIndexes.at(row); diff --git a/tests/auto/testlib/qsignalspy/CMakeLists.txt b/tests/auto/testlib/qsignalspy/CMakeLists.txt index 42aff584ba..3c62050de5 100644 --- a/tests/auto/testlib/qsignalspy/CMakeLists.txt +++ b/tests/auto/testlib/qsignalspy/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qsignalspy Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qsignalspy LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qsignalspy SOURCES tst_qsignalspy.cpp diff --git a/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp b/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp index 8b0319679f..66f8b00505 100644 --- a/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp +++ b/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp @@ -1,14 +1,16 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <QSignalSpy> #include <QTimer> - #include <qdatetime.h> +using namespace std::chrono_literals; +using namespace Qt::StringLiterals; + class tst_QSignalSpy : public QObject { Q_OBJECT @@ -48,6 +50,8 @@ private slots: void spyOnMetaMethod_invalid(); void spyOnMetaMethod_invalid_data(); + + void signalSpyDoesNotRaceOnCrossThreadSignal(); }; struct CustomType {}; @@ -460,30 +464,62 @@ void tst_QSignalSpy::spyOnMetaMethod() Q_DECLARE_METATYPE(QMetaMethod); void tst_QSignalSpy::spyOnMetaMethod_invalid() { + QFETCH(const QByteArray, message); QFETCH(QObject*, object); QFETCH(QMetaMethod, signal); + QTest::ignoreMessage(QtWarningMsg, message.data()); QSignalSpy spy(object, signal); QVERIFY(!spy.isValid()); } void tst_QSignalSpy::spyOnMetaMethod_invalid_data() { + QTest::addColumn<QByteArray>("message"); QTest::addColumn<QObject*>("object"); QTest::addColumn<QMetaMethod>("signal"); QTest::addRow("Invalid object") + << "QSignalSpy: Cannot spy on a null object"_ba << static_cast<QObject*>(nullptr) << QMetaMethod(); QTest::addRow("Empty signal") + << "QSignalSpy: Null signal is not valid"_ba << new QObject(this) << QMetaMethod(); QTest::addRow("Method is not a signal") + << "QSignalSpy: Not a signal: 'deleteLater()'"_ba << new QObject(this) << QObject::staticMetaObject.method(QObject::staticMetaObject.indexOfMethod("deleteLater()")); } +class EmitSignal_Thread : public QThread +{ + Q_OBJECT +public: + void run() override + { + emit valueChanged(42, u"is the answer"_s); + } + +Q_SIGNALS: + void valueChanged(int value, const QString &str); +}; + +void tst_QSignalSpy::signalSpyDoesNotRaceOnCrossThreadSignal() +{ + EmitSignal_Thread thread; + QSignalSpy valueChangedSpy(&thread, &EmitSignal_Thread::valueChanged); + QVERIFY(valueChangedSpy.isValid()); + + thread.start(); + QVERIFY(valueChangedSpy.wait(5s)); + QCOMPARE(valueChangedSpy[0][0].toInt(), 42); + QCOMPARE(valueChangedSpy[0][1].toString(), u"is the answer"_s); + QVERIFY(thread.wait(5s)); +} + QTEST_MAIN(tst_QSignalSpy) #include "tst_qsignalspy.moc" diff --git a/tests/auto/testlib/selftests/CMakeLists.txt b/tests/auto/testlib/selftests/CMakeLists.txt index a6bb30194d..9e17638a66 100644 --- a/tests/auto/testlib/selftests/CMakeLists.txt +++ b/tests/auto/testlib/selftests/CMakeLists.txt @@ -3,6 +3,12 @@ # The whole file is written manually. +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_selftests LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + include(../../../../src/testlib/selfcover.cmake) # ------------- Test runner ------------- @@ -21,6 +27,8 @@ qt_internal_add_test(tst_selftests SOURCES tst_selftests.cpp catch.cpp + NO_PCH_SOURCES + tst_selftests.cpp # undef QT_NO_FOREACH LIBRARIES Qt::TestPrivate TESTDATA ${qmake_expected_files_resource_files} @@ -83,9 +91,11 @@ set(subprograms printdatatagswithglobaltags qexecstringlist silent + silent_fatal signaldumper singleskip skip + skipblacklisted skipcleanup skipcleanuptestcase skipinit diff --git a/tests/auto/testlib/selftests/README b/tests/auto/testlib/selftests/README index 821bed45df..da6637d872 100644 --- a/tests/auto/testlib/selftests/README +++ b/tests/auto/testlib/selftests/README @@ -50,6 +50,13 @@ You can choose a specific subtest by passing the -c option: -c "Given: The QTestLog::Plain logger" \ -c 'And given: The "skip" subtest' +Note that on Windows, when using cmd.exe, you cannot use single +quotes, so the command above becomes: + + ❯ ./tst_selftests "Scenario: Test output of the loggers is as expected" \ + -c "Given: The QTestLog::Plain logger" \ + -c "And given: The ""skip"" subtest" + It's possible to pass only the first -c options, to e.g. run all tests with the Plain logger, but it's unfortunately not possible to pass only the last -c option, to run the 'skip' subtest with diff --git a/tests/auto/testlib/selftests/assert/CMakeLists.txt b/tests/auto/testlib/selftests/assert/CMakeLists.txt index 4ed5aa5e3a..947c056d02 100644 --- a/tests/auto/testlib/selftests/assert/CMakeLists.txt +++ b/tests/auto/testlib/selftests/assert/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(assert NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_assert.cpp diff --git a/tests/auto/testlib/selftests/assert/tst_assert.cpp b/tests/auto/testlib/selftests/assert/tst_assert.cpp index 1fb7fbc2d8..abba0f388e 100644 --- a/tests/auto/testlib/selftests/assert/tst_assert.cpp +++ b/tests/auto/testlib/selftests/assert/tst_assert.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only // Make sure we get a real Q_ASSERT even in release builds #ifdef QT_NO_DEBUG diff --git a/tests/auto/testlib/selftests/badxml/CMakeLists.txt b/tests/auto/testlib/selftests/badxml/CMakeLists.txt index 799a8ee6bf..21544707d7 100644 --- a/tests/auto/testlib/selftests/badxml/CMakeLists.txt +++ b/tests/auto/testlib/selftests/badxml/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(badxml NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_badxml.cpp diff --git a/tests/auto/testlib/selftests/badxml/tst_badxml.cpp b/tests/auto/testlib/selftests/badxml/tst_badxml.cpp index ec54f786d9..a928a24d8a 100644 --- a/tests/auto/testlib/selftests/badxml/tst_badxml.cpp +++ b/tests/auto/testlib/selftests/badxml/tst_badxml.cpp @@ -1,6 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> #include <QtCore/QStringList> @@ -80,9 +79,9 @@ void tst_BadXml::badDataTag_data() const { QTest::addColumn<bool>("shouldFail"); - foreach (char const* str, badStrings()) { - QTest::newRow(qPrintable(QString("fail %1").arg(str))) << true; - QTest::newRow(qPrintable(QString("pass %1").arg(str))) << false; + for (const QByteArray &ba: badStrings()) { + QTest::addRow("fail %s", ba.constData()) << true; + QTest::addRow("pass %s", ba.constData()) << false; } } @@ -123,9 +122,8 @@ void tst_BadXml::badMessage_data() const QTest::addColumn<QByteArray>("message"); int i = 0; - foreach (QByteArray const& str, badStrings()) { + for (const QByteArray &str : badStrings()) QTest::newRow(qPrintable(QString::fromLatin1("string %1").arg(i++))) << str; - } } /* @@ -133,13 +131,12 @@ void tst_BadXml::badMessage_data() const */ QList<QByteArray> const& tst_BadXml::badStrings() { - static QList<QByteArray> out; - if (out.isEmpty()) { - out << "end cdata ]]> text ]]> more text"; - out << "quotes \" text\" more text"; - out << "xml close > open < tags < text"; - out << "all > \" mixed ]]> up > \" in < the ]]> hopes < of triggering \"< ]]> bugs"; - } + static const QList<QByteArray> out = { + "end cdata ]]> text ]]> more text", + "quotes \" text\" more text", + "xml close > open < tags < text", + "all > \" mixed ]]> up > \" in < the ]]> hopes < of triggering \"< ]]> bugs", + }; return out; } diff --git a/tests/auto/testlib/selftests/benchlibcallgrind/CMakeLists.txt b/tests/auto/testlib/selftests/benchlibcallgrind/CMakeLists.txt index bd46cb145f..033724406c 100644 --- a/tests/auto/testlib/selftests/benchlibcallgrind/CMakeLists.txt +++ b/tests/auto/testlib/selftests/benchlibcallgrind/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(benchlibcallgrind NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_benchlibcallgrind.cpp diff --git a/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp b/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp index b175998e44..fc7f0b013b 100644 --- a/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp +++ b/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/benchlibcounting/CMakeLists.txt b/tests/auto/testlib/selftests/benchlibcounting/CMakeLists.txt index c30f885ff3..76a1c96a44 100644 --- a/tests/auto/testlib/selftests/benchlibcounting/CMakeLists.txt +++ b/tests/auto/testlib/selftests/benchlibcounting/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(benchlibcounting NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_benchlibcounting.cpp diff --git a/tests/auto/testlib/selftests/benchlibcounting/tst_benchlibcounting.cpp b/tests/auto/testlib/selftests/benchlibcounting/tst_benchlibcounting.cpp index 2ccd374cc0..8ac99a1f4e 100644 --- a/tests/auto/testlib/selftests/benchlibcounting/tst_benchlibcounting.cpp +++ b/tests/auto/testlib/selftests/benchlibcounting/tst_benchlibcounting.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> #include <QTest> diff --git a/tests/auto/testlib/selftests/benchlibeventcounter/CMakeLists.txt b/tests/auto/testlib/selftests/benchlibeventcounter/CMakeLists.txt index f04b204794..e91340512b 100644 --- a/tests/auto/testlib/selftests/benchlibeventcounter/CMakeLists.txt +++ b/tests/auto/testlib/selftests/benchlibeventcounter/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(benchlibeventcounter NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_benchlibeventcounter.cpp diff --git a/tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp b/tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp index 8397081abc..53c8f50ff2 100644 --- a/tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp +++ b/tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/benchliboptions/CMakeLists.txt b/tests/auto/testlib/selftests/benchliboptions/CMakeLists.txt index 9c48372bff..1f6bfa9374 100644 --- a/tests/auto/testlib/selftests/benchliboptions/CMakeLists.txt +++ b/tests/auto/testlib/selftests/benchliboptions/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(benchliboptions NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_benchliboptions.cpp diff --git a/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp b/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp index b81796e30f..35ba5e5309 100644 --- a/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp +++ b/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> @@ -10,23 +10,20 @@ #include <QAbstractEventDispatcher> /* Custom event dispatcher to ensure we don't receive any spontaneous events */ -class TestEventDispatcher : public QAbstractEventDispatcher +class TestEventDispatcher : public QAbstractEventDispatcherV2 { Q_OBJECT public: - TestEventDispatcher(QObject* parent =0) - : QAbstractEventDispatcher(parent) - {} void interrupt() override {} bool processEvents(QEventLoop::ProcessEventsFlags) override { return false; } void registerSocketNotifier(QSocketNotifier*) override {} - void registerTimer(int,qint64,Qt::TimerType,QObject*) override {} - QList<TimerInfo> registeredTimers(QObject*) const override { return QList<TimerInfo>(); } + void registerTimer(Qt::TimerId,Duration,Qt::TimerType,QObject*) override {} + QList<TimerInfoV2> timersForObject(QObject*) const override { return {}; } void unregisterSocketNotifier(QSocketNotifier*) override {} - bool unregisterTimer(int) override { return false; } + bool unregisterTimer(Qt::TimerId) override { return false; } bool unregisterTimers(QObject*) override { return false; } - int remainingTime(int) override { return 0; } + Duration remainingTime(Qt::TimerId) const override { return {}; } void wakeUp() override {} #ifdef Q_OS_WIN diff --git a/tests/auto/testlib/selftests/benchlibtickcounter/CMakeLists.txt b/tests/auto/testlib/selftests/benchlibtickcounter/CMakeLists.txt index 71229d524f..639e75c8bb 100644 --- a/tests/auto/testlib/selftests/benchlibtickcounter/CMakeLists.txt +++ b/tests/auto/testlib/selftests/benchlibtickcounter/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(benchlibtickcounter NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_benchlibtickcounter.cpp diff --git a/tests/auto/testlib/selftests/benchlibtickcounter/tst_benchlibtickcounter.cpp b/tests/auto/testlib/selftests/benchlibtickcounter/tst_benchlibtickcounter.cpp index 55fe68f295..204a28599e 100644 --- a/tests/auto/testlib/selftests/benchlibtickcounter/tst_benchlibtickcounter.cpp +++ b/tests/auto/testlib/selftests/benchlibtickcounter/tst_benchlibtickcounter.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/benchlibwalltime/CMakeLists.txt b/tests/auto/testlib/selftests/benchlibwalltime/CMakeLists.txt index c8d8345410..b4119726b3 100644 --- a/tests/auto/testlib/selftests/benchlibwalltime/CMakeLists.txt +++ b/tests/auto/testlib/selftests/benchlibwalltime/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(benchlibwalltime NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_benchlibwalltime.cpp diff --git a/tests/auto/testlib/selftests/benchlibwalltime/tst_benchlibwalltime.cpp b/tests/auto/testlib/selftests/benchlibwalltime/tst_benchlibwalltime.cpp index 1095253def..ebe3de4585 100644 --- a/tests/auto/testlib/selftests/benchlibwalltime/tst_benchlibwalltime.cpp +++ b/tests/auto/testlib/selftests/benchlibwalltime/tst_benchlibwalltime.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/blacklisted/CMakeLists.txt b/tests/auto/testlib/selftests/blacklisted/CMakeLists.txt index 2c01e6b6ea..8e84038002 100644 --- a/tests/auto/testlib/selftests/blacklisted/CMakeLists.txt +++ b/tests/auto/testlib/selftests/blacklisted/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(blacklisted NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_blacklisted.cpp diff --git a/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp b/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp index 1a2f8e93af..d59b6244c1 100644 --- a/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp +++ b/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp @@ -1,5 +1,8 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#undef QTEST_THROW_ON_FAILURE // fails ### investigate +#undef QTEST_THROW_ON_SKIP // fails ### investigate #include <QtCore/QCoreApplication> #include <QTest> @@ -65,6 +68,7 @@ void tst_Blacklisted::fail() void tst_Blacklisted::multiFail() // cf. ../subtest/'s similar tests { + const QTest::ThrowOnFailDisabler nothrow; // tests repeated QFAILs ++blacklisted; for (int i = 0; i < 10; ++i) []() { QFAIL("This failure message should be repeated ten times"); }(); @@ -73,6 +77,7 @@ void tst_Blacklisted::multiFail() // cf. ../subtest/'s similar tests void tst_Blacklisted::multiSkip() { + const QTest::ThrowOnSkipDisabler nothrow; // tests repeated QSKIPs // Similar to multiFail() ++skipped; for (int i = 0; i < 10; ++i) diff --git a/tests/auto/testlib/selftests/catch.cpp b/tests/auto/testlib/selftests/catch.cpp index 367a4c8123..37457fcca5 100644 --- a/tests/auto/testlib/selftests/catch.cpp +++ b/tests/auto/testlib/selftests/catch.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2020 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #define CATCH_CONFIG_RUNNER #define CATCH_CLARA_CONFIG_CONSOLE_WIDTH 1000 diff --git a/tests/auto/testlib/selftests/catch_p.h b/tests/auto/testlib/selftests/catch_p.h index 9b3060ae4c..2c217922a8 100644 --- a/tests/auto/testlib/selftests/catch_p.h +++ b/tests/auto/testlib/selftests/catch_p.h @@ -1,5 +1,5 @@ // Copyright (C) 2020 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef QCATCH_P_H #define QCATCH_P_H diff --git a/tests/auto/testlib/selftests/cmptest/CMakeLists.txt b/tests/auto/testlib/selftests/cmptest/CMakeLists.txt index 770b66c477..67700db36e 100644 --- a/tests/auto/testlib/selftests/cmptest/CMakeLists.txt +++ b/tests/auto/testlib/selftests/cmptest/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(cmptest NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_cmptest.cpp diff --git a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp index 7a3817c63d..36e355c614 100644 --- a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp +++ b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <QtCore/QCoreApplication> @@ -7,11 +7,14 @@ #ifdef QT_GUI_LIB #include <QtGui/QColor> #include <QtGui/QImage> +#include <QtGui/QPalette> #include <QtGui/QPixmap> #include <QtGui/QVector2D> #include <QtGui/QVector3D> #include <QtGui/QVector4D> #endif +#include <QSet> +#include <vector> using namespace Qt::StringLiterals; /* XPM test data for QPixmap, QImage tests (use drag cursors as example) */ @@ -127,6 +130,7 @@ private slots: void compareQListIntToInitializerList_data(); void compareQListIntToInitializerList(); void compareQListDouble(); + void compareContainerToInitializerList(); #ifdef QT_GUI_LIB void compareQColor_data(); void compareQColor(); @@ -139,6 +143,8 @@ private slots: void compareQVector2D(); void compareQVector3D(); void compareQVector4D(); + void compareQPalettes_data(); + void compareQPalettes(); #endif void tryCompare(); void verify(); @@ -506,6 +512,24 @@ void tst_Cmptest::compareQListDouble() QCOMPARE(double1, double2); } +void tst_Cmptest::compareContainerToInitializerList() +{ + // Protect ',' in the list +#define ARG(...) __VA_ARGS__ + QSet<int> set{1, 2, 3}; + QCOMPARE(set, ARG({1, 2, 3})); + + std::vector<int> vec{1, 2, 3}; + QCOMPARE(vec, ARG({1, 2, 3})); + + vec.clear(); + QCOMPARE(vec, {}); + + vec.push_back(42); + QCOMPARE(vec, {42}); +#undef ARG +} + #ifdef QT_GUI_LIB void tst_Cmptest::compareQColor_data() { @@ -632,6 +656,54 @@ void tst_Cmptest::compareQVector4D() v4b.setY(3); QCOMPARE(v4a, v4b); } + +void tst_Cmptest::compareQPalettes_data() +{ + QTest::addColumn<QPalette>("actualPalette"); + QTest::addColumn<QPalette>("expectedPalette"); + + // Initialize both to black, as the default palette values change + // depending on whether the test is run directly from a shell + // vs through generate_expected_output.py. We're not testing + // the defaults, we're testing that the full output is printed + // (QTBUG-5903 and QTBUG-87039). + QPalette actualPalette; + for (int i = 0; i < QPalette::NColorRoles; ++i) { + const auto role = QPalette::ColorRole(i); + actualPalette.setColor(QPalette::All, role, QColorConstants::Black); + } + QPalette expectedPalette; + for (int i = 0; i < QPalette::NColorRoles; ++i) { + const auto role = QPalette::ColorRole(i); + expectedPalette.setColor(QPalette::All, role, QColorConstants::Black); + } + + for (int i = 0; i < QPalette::NColorRoles; ++i) { + const auto role = QPalette::ColorRole(i); + const auto color = QColor::fromRgb(i); + actualPalette.setColor(role, color); + } + QTest::newRow("all roles are different") << actualPalette << expectedPalette; + + for (int i = 0; i < QPalette::NColorRoles - 1; ++i) { + const auto role = QPalette::ColorRole(i); + const auto color = QColor::fromRgb(i); + expectedPalette.setColor(role, color); + } + QTest::newRow("one role is different") << actualPalette << expectedPalette; + + const auto lastRole = QPalette::ColorRole(QPalette::NColorRoles - 1); + expectedPalette.setColor(lastRole, QColor::fromRgb(lastRole)); + QTest::newRow("all roles are the same") << actualPalette << expectedPalette; +} + +void tst_Cmptest::compareQPalettes() +{ + QFETCH(QPalette, actualPalette); + QFETCH(QPalette, expectedPalette); + + QCOMPARE(actualPalette, expectedPalette); +} #endif // QT_GUI_LIB static int opaqueFunc() @@ -699,9 +771,9 @@ void tst_Cmptest::tryCompare() } { DeferredFlag c; - QTRY_COMPARE_WITH_TIMEOUT(c, DeferredFlag(), 300); + QTRY_COMPARE_WITH_TIMEOUT(c, DeferredFlag(), 300ms); QVERIFY(!c); // Instantly equal, so succeeded without delay. - QTRY_COMPARE_WITH_TIMEOUT(c, trueAlready, 200); + QTRY_COMPARE_WITH_TIMEOUT(c, trueAlready, 1s); qInfo("Should now time out and fail"); QTRY_COMPARE_WITH_TIMEOUT(c, DeferredFlag(), 200); } @@ -716,7 +788,7 @@ void tst_Cmptest::tryVerify() } { DeferredFlag c; - QTRY_VERIFY_WITH_TIMEOUT(!c, 300); + QTRY_VERIFY_WITH_TIMEOUT(!c, 300ms); QTRY_VERIFY_WITH_TIMEOUT(c, 200); qInfo("Should now time out and fail"); QTRY_VERIFY_WITH_TIMEOUT(!c, 200); @@ -732,7 +804,7 @@ void tst_Cmptest::tryVerify2() } { DeferredFlag c; - QTRY_VERIFY2_WITH_TIMEOUT(!c, "Failed to check before looping", 300); + QTRY_VERIFY2_WITH_TIMEOUT(!c, "Failed to check before looping", 300ms); QTRY_VERIFY2_WITH_TIMEOUT(c, "Failed to trigger single-shot", 200); QTRY_VERIFY2_WITH_TIMEOUT(!c, "Should time out and fail", 200); } diff --git a/tests/auto/testlib/selftests/commandlinedata/CMakeLists.txt b/tests/auto/testlib/selftests/commandlinedata/CMakeLists.txt index 165ffa627d..c563f9919a 100644 --- a/tests/auto/testlib/selftests/commandlinedata/CMakeLists.txt +++ b/tests/auto/testlib/selftests/commandlinedata/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(commandlinedata NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_commandlinedata.cpp diff --git a/tests/auto/testlib/selftests/commandlinedata/tst_commandlinedata.cpp b/tests/auto/testlib/selftests/commandlinedata/tst_commandlinedata.cpp index a24b6fdbc3..c895ae4ed8 100644 --- a/tests/auto/testlib/selftests/commandlinedata/tst_commandlinedata.cpp +++ b/tests/auto/testlib/selftests/commandlinedata/tst_commandlinedata.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/counting/CMakeLists.txt b/tests/auto/testlib/selftests/counting/CMakeLists.txt index 3ed3e5af03..58fa751477 100644 --- a/tests/auto/testlib/selftests/counting/CMakeLists.txt +++ b/tests/auto/testlib/selftests/counting/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(counting NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_counting.cpp diff --git a/tests/auto/testlib/selftests/counting/tst_counting.cpp b/tests/auto/testlib/selftests/counting/tst_counting.cpp index d9b5a8d654..d521ea0238 100644 --- a/tests/auto/testlib/selftests/counting/tst_counting.cpp +++ b/tests/auto/testlib/selftests/counting/tst_counting.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> #include <QTest> diff --git a/tests/auto/testlib/selftests/crashes/CMakeLists.txt b/tests/auto/testlib/selftests/crashes/CMakeLists.txt index fd7f33b76f..c11bab90d0 100644 --- a/tests/auto/testlib/selftests/crashes/CMakeLists.txt +++ b/tests/auto/testlib/selftests/crashes/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(crashes NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_crashes.cpp diff --git a/tests/auto/testlib/selftests/crashes/tst_crashes.cpp b/tests/auto/testlib/selftests/crashes/tst_crashes.cpp index 38ed27d331..4ba8a426e6 100644 --- a/tests/auto/testlib/selftests/crashes/tst_crashes.cpp +++ b/tests/auto/testlib/selftests/crashes/tst_crashes.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> @@ -38,7 +38,11 @@ void tst_Crashes::crash() rather than SIGSEGV). */ int *i = 0; + +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Warray-bounds") i[1] = 1; +QT_WARNING_POP } QTEST_MAIN(tst_Crashes) diff --git a/tests/auto/testlib/selftests/datatable/CMakeLists.txt b/tests/auto/testlib/selftests/datatable/CMakeLists.txt index 4fced83a19..7bac0d2a63 100644 --- a/tests/auto/testlib/selftests/datatable/CMakeLists.txt +++ b/tests/auto/testlib/selftests/datatable/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(datatable NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_datatable.cpp diff --git a/tests/auto/testlib/selftests/datatable/tst_datatable.cpp b/tests/auto/testlib/selftests/datatable/tst_datatable.cpp index 6fa70c3072..598908ac0e 100644 --- a/tests/auto/testlib/selftests/datatable/tst_datatable.cpp +++ b/tests/auto/testlib/selftests/datatable/tst_datatable.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/datetime/CMakeLists.txt b/tests/auto/testlib/selftests/datetime/CMakeLists.txt index 6c8b3335be..e644d7200a 100644 --- a/tests/auto/testlib/selftests/datetime/CMakeLists.txt +++ b/tests/auto/testlib/selftests/datetime/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(datetime NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_datetime.cpp diff --git a/tests/auto/testlib/selftests/datetime/tst_datetime.cpp b/tests/auto/testlib/selftests/datetime/tst_datetime.cpp index abe912550d..68e47d0868 100644 --- a/tests/auto/testlib/selftests/datetime/tst_datetime.cpp +++ b/tests/auto/testlib/selftests/datetime/tst_datetime.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/deleteLater/CMakeLists.txt b/tests/auto/testlib/selftests/deleteLater/CMakeLists.txt index 628d26c6a6..ededc5bf7d 100644 --- a/tests/auto/testlib/selftests/deleteLater/CMakeLists.txt +++ b/tests/auto/testlib/selftests/deleteLater/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(deleteLater NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_deleteLater.cpp diff --git a/tests/auto/testlib/selftests/deleteLater/tst_deleteLater.cpp b/tests/auto/testlib/selftests/deleteLater/tst_deleteLater.cpp index 2f3023148d..871a46afc3 100644 --- a/tests/auto/testlib/selftests/deleteLater/tst_deleteLater.cpp +++ b/tests/auto/testlib/selftests/deleteLater/tst_deleteLater.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2017 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/deleteLater_noApp/CMakeLists.txt b/tests/auto/testlib/selftests/deleteLater_noApp/CMakeLists.txt index 5b2a273dfe..feebd9f00e 100644 --- a/tests/auto/testlib/selftests/deleteLater_noApp/CMakeLists.txt +++ b/tests/auto/testlib/selftests/deleteLater_noApp/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(deleteLater_noApp NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_deleteLater_noApp.cpp diff --git a/tests/auto/testlib/selftests/deleteLater_noApp/tst_deleteLater_noApp.cpp b/tests/auto/testlib/selftests/deleteLater_noApp/tst_deleteLater_noApp.cpp index 10ddfaa75e..eecc67dd36 100644 --- a/tests/auto/testlib/selftests/deleteLater_noApp/tst_deleteLater_noApp.cpp +++ b/tests/auto/testlib/selftests/deleteLater_noApp/tst_deleteLater_noApp.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2017 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/differentexec/CMakeLists.txt b/tests/auto/testlib/selftests/differentexec/CMakeLists.txt index 6fef35a28e..b92814742e 100644 --- a/tests/auto/testlib/selftests/differentexec/CMakeLists.txt +++ b/tests/auto/testlib/selftests/differentexec/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(differentexec NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_differentexec.cpp diff --git a/tests/auto/testlib/selftests/differentexec/tst_differentexec.cpp b/tests/auto/testlib/selftests/differentexec/tst_differentexec.cpp index 7229a4306d..92233a0147 100644 --- a/tests/auto/testlib/selftests/differentexec/tst_differentexec.cpp +++ b/tests/auto/testlib/selftests/differentexec/tst_differentexec.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/selftests/eventloop/CMakeLists.txt b/tests/auto/testlib/selftests/eventloop/CMakeLists.txt index 94636d40f8..afaf766f69 100644 --- a/tests/auto/testlib/selftests/eventloop/CMakeLists.txt +++ b/tests/auto/testlib/selftests/eventloop/CMakeLists.txt @@ -1,9 +1,12 @@ +# Copyright (C) 2024 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## eventloop Binary: ##################################################################### qt_internal_add_executable(eventloop NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_eventloop.cpp diff --git a/tests/auto/testlib/selftests/eventloop/tst_eventloop.cpp b/tests/auto/testlib/selftests/eventloop/tst_eventloop.cpp index 39cd1d1a57..3f3a7e303e 100644 --- a/tests/auto/testlib/selftests/eventloop/tst_eventloop.cpp +++ b/tests/auto/testlib/selftests/eventloop/tst_eventloop.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2022 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <QTestEventLoop> diff --git a/tests/auto/testlib/selftests/exceptionthrow/tst_exceptionthrow.cpp b/tests/auto/testlib/selftests/exceptionthrow/tst_exceptionthrow.cpp index 4fd22e3048..ea5c6afc13 100644 --- a/tests/auto/testlib/selftests/exceptionthrow/tst_exceptionthrow.cpp +++ b/tests/auto/testlib/selftests/exceptionthrow/tst_exceptionthrow.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/selftests/expected_cmptest.junitxml b/tests/auto/testlib/selftests/expected_cmptest.junitxml index 7ec9e2e05f..134a188753 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.junitxml +++ b/tests/auto/testlib/selftests/expected_cmptest.junitxml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<testsuite name="tst_Cmptest" timestamp="@TEST_START_TIME@" hostname="@HOSTNAME@" tests="70" failures="49" errors="0" skipped="0" time="@TEST_DURATION@"> +<testsuite name="tst_Cmptest" timestamp="@TEST_START_TIME@" hostname="@HOSTNAME@" tests="74" failures="51" errors="0" skipped="0" time="@TEST_DURATION@"> <properties> <property name="QTestVersion" value="@INSERT_QT_VERSION_HERE@"/> <property name="QtVersion" value="@INSERT_QT_VERSION_HERE@"/> @@ -173,6 +173,7 @@ Expected (double2): 1]]> </failure> </testcase> + <testcase name="compareContainerToInitializerList" classname="tst_Cmptest" time="@TEST_DURATION@"/> <testcase name="compareQColor(Qt::yellow vs "yellow")" classname="tst_Cmptest" time="@TEST_DURATION@"/> <testcase name="compareQColor(Qt::yellow vs Qt::green)" classname="tst_Cmptest" time="@TEST_DURATION@"> <failure type="fail" message="Compared values are not the same"> @@ -282,6 +283,19 @@ Expected (v4b): QVector4D(1, 3, 3, 4)]]> </failure> </testcase> + <testcase name="compareQPalettes(all roles are different)" classname="tst_Cmptest" time="@TEST_DURATION@"> + <failure type="fail" message="Compared values are not the same"> + <![CDATA[ Actual (actualPalette) : QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000015,Disabled:#ff000015,Inactive:#ff000015]") + Expected (expectedPalette): QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Light:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Midlight:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Dark:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Mid:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Text:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],BrightText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ButtonText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Base:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Window:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Shadow:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Highlight:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],HighlightedText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Link:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],LinkVisited:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],AlternateBase:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ToolTipBase:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ToolTipText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],PlaceholderText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Accent:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000]")]]> + </failure> + </testcase> + <testcase name="compareQPalettes(one role is different)" classname="tst_Cmptest" time="@TEST_DURATION@"> + <failure type="fail" message="Compared values are not the same"> + <![CDATA[ Actual (actualPalette) : QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000015,Disabled:#ff000015,Inactive:#ff000015]") + Expected (expectedPalette): QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000]")]]> + </failure> + </testcase> + <testcase name="compareQPalettes(all roles are the same)" classname="tst_Cmptest" time="@TEST_DURATION@"/> <testcase name="tryCompare" classname="tst_Cmptest" time="@TEST_DURATION@"> <failure type="fail" message="Compared values are not the same"> <![CDATA[ Actual (c) : DeferredFlag(true) diff --git a/tests/auto/testlib/selftests/expected_cmptest.lightxml b/tests/auto/testlib/selftests/expected_cmptest.lightxml index 6328632c69..9c54d20650 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.lightxml +++ b/tests/auto/testlib/selftests/expected_cmptest.lightxml @@ -234,6 +234,10 @@ </Incident> <Duration msecs="0"/> </TestFunction> + <TestFunction name="compareContainerToInitializerList"> + <Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> + </TestFunction> <TestFunction name="compareQColor"> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[Qt::yellow vs "yellow"]]></DataTag> @@ -377,6 +381,24 @@ </Incident> <Duration msecs="0"/> </TestFunction> + <TestFunction name="compareQPalettes"> + <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0"> + <DataTag><![CDATA[all roles are different]]></DataTag> + <Description><![CDATA[Compared values are not the same + Actual (actualPalette) : QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000015,Disabled:#ff000015,Inactive:#ff000015]") + Expected (expectedPalette): QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Light:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Midlight:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Dark:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Mid:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Text:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],BrightText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ButtonText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Base:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Window:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Shadow:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Highlight:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],HighlightedText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Link:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],LinkVisited:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],AlternateBase:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ToolTipBase:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ToolTipText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],PlaceholderText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Accent:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000]")]]></Description> + </Incident> + <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0"> + <DataTag><![CDATA[one role is different]]></DataTag> + <Description><![CDATA[Compared values are not the same + Actual (actualPalette) : QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000015,Disabled:#ff000015,Inactive:#ff000015]") + Expected (expectedPalette): QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000]")]]></Description> + </Incident> + <Incident type="pass" file="" line="0"> + <DataTag><![CDATA[all roles are the same]]></DataTag> + </Incident> + <Duration msecs="0"/> + </TestFunction> <TestFunction name="tryCompare"> <Message type="qinfo" file="" line="0"> <Description><![CDATA[Should now time out and fail]]></Description> diff --git a/tests/auto/testlib/selftests/expected_cmptest.tap b/tests/auto/testlib/selftests/expected_cmptest.tap index 368d3aafb4..a5f5c3c8a2 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.tap +++ b/tests/auto/testlib/selftests/expected_cmptest.tap @@ -303,8 +303,9 @@ not ok 38 - compareQListDouble() file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -ok 39 - compareQColor(Qt::yellow vs "yellow") -not ok 40 - compareQColor(Qt::yellow vs Qt::green) +ok 39 - compareContainerToInitializerList() +ok 40 - compareQColor(Qt::yellow vs "yellow") +not ok 41 - compareQColor(Qt::yellow vs Qt::green) --- type: QCOMPARE message: Compared values are not the same @@ -316,7 +317,7 @@ not ok 40 - compareQColor(Qt::yellow vs Qt::green) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -not ok 41 - compareQColor(0x88ff0000 vs 0xffff0000) +not ok 42 - compareQColor(0x88ff0000 vs 0xffff0000) --- type: QCOMPARE message: Compared values are not the same @@ -328,8 +329,8 @@ not ok 41 - compareQColor(0x88ff0000 vs 0xffff0000) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -ok 42 - compareQPixmaps(both null) -not ok 43 - compareQPixmaps(one null) +ok 43 - compareQPixmaps(both null) +not ok 44 - compareQPixmaps(one null) --- type: QCOMPARE message: Compared QPixmaps differ. @@ -341,7 +342,7 @@ not ok 43 - compareQPixmaps(one null) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -not ok 44 - compareQPixmaps(other null) +not ok 45 - compareQPixmaps(other null) --- type: QCOMPARE message: Compared QPixmaps differ. @@ -353,8 +354,8 @@ not ok 44 - compareQPixmaps(other null) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -ok 45 - compareQPixmaps(equal) -not ok 46 - compareQPixmaps(different size) +ok 46 - compareQPixmaps(equal) +not ok 47 - compareQPixmaps(different size) --- type: QCOMPARE message: Compared QPixmaps differ in size. @@ -366,14 +367,14 @@ not ok 46 - compareQPixmaps(different size) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -not ok 47 - compareQPixmaps(different pixels) +not ok 48 - compareQPixmaps(different pixels) --- # Compared values are not the same at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:0) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -not ok 48 - compareQPixmaps(different dpr) +not ok 49 - compareQPixmaps(different dpr) --- type: QCOMPARE message: Compared QPixmaps differ in device pixel ratio. @@ -385,8 +386,8 @@ not ok 48 - compareQPixmaps(different dpr) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -ok 49 - compareQImages(both null) -not ok 50 - compareQImages(one null) +ok 50 - compareQImages(both null) +not ok 51 - compareQImages(one null) --- type: QCOMPARE message: Compared QImages differ. @@ -398,7 +399,7 @@ not ok 50 - compareQImages(one null) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -not ok 51 - compareQImages(other null) +not ok 52 - compareQImages(other null) --- type: QCOMPARE message: Compared QImages differ. @@ -410,8 +411,8 @@ not ok 51 - compareQImages(other null) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -ok 52 - compareQImages(equal) -not ok 53 - compareQImages(different size) +ok 53 - compareQImages(equal) +not ok 54 - compareQImages(different size) --- type: QCOMPARE message: Compared QImages differ in size. @@ -423,7 +424,7 @@ not ok 53 - compareQImages(different size) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -not ok 54 - compareQImages(different format) +not ok 55 - compareQImages(different format) --- type: QCOMPARE message: Compared QImages differ in format. @@ -435,14 +436,14 @@ not ok 54 - compareQImages(different format) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -not ok 55 - compareQImages(different pixels) +not ok 56 - compareQImages(different pixels) --- # Compared values are not the same at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:0) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -not ok 56 - compareQImages(different dpr) +not ok 57 - compareQImages(different dpr) --- type: QCOMPARE message: Compared QImages differ in device pixel ratio. @@ -454,8 +455,8 @@ not ok 56 - compareQImages(different dpr) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -ok 57 - compareQRegion(equal-empty) -not ok 58 - compareQRegion(1-empty) +ok 58 - compareQRegion(equal-empty) +not ok 59 - compareQRegion(1-empty) --- type: QCOMPARE message: Compared values are not the same @@ -467,8 +468,8 @@ not ok 58 - compareQRegion(1-empty) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -ok 59 - compareQRegion(equal) -not ok 60 - compareQRegion(different lists) +ok 60 - compareQRegion(equal) +not ok 61 - compareQRegion(different lists) --- type: QCOMPARE message: Compared values are not the same @@ -480,7 +481,7 @@ not ok 60 - compareQRegion(different lists) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -not ok 61 - compareQVector2D() +not ok 62 - compareQVector2D() --- type: QCOMPARE message: Compared values are not the same @@ -492,7 +493,7 @@ not ok 61 - compareQVector2D() file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -not ok 62 - compareQVector3D() +not ok 63 - compareQVector3D() --- type: QCOMPARE message: Compared values are not the same @@ -504,7 +505,7 @@ not ok 62 - compareQVector3D() file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -not ok 63 - compareQVector4D() +not ok 64 - compareQVector4D() --- type: QCOMPARE message: Compared values are not the same @@ -516,7 +517,32 @@ not ok 63 - compareQVector4D() file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -not ok 64 - tryCompare() +not ok 65 - compareQPalettes(all roles are different) + --- + type: QCOMPARE + message: Compared values are not the same + wanted: QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Light:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Midlight:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Dark:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Mid:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Text:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],BrightText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ButtonText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Base:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Window:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Shadow:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Highlight:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],HighlightedText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Link:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],LinkVisited:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],AlternateBase:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ToolTipBase:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ToolTipText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],PlaceholderText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Accent:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000]") (expectedPalette) + found: QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000015,Disabled:#ff000015,Inactive:#ff000015]") (actualPalette) + expected: QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Light:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Midlight:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Dark:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Mid:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Text:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],BrightText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ButtonText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Base:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Window:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Shadow:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Highlight:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],HighlightedText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Link:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],LinkVisited:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],AlternateBase:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ToolTipBase:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ToolTipText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],PlaceholderText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Accent:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000]") (expectedPalette) + actual: QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000015,Disabled:#ff000015,Inactive:#ff000015]") (actualPalette) + at: tst_Cmptest::compareQPalettes() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:0) + file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp + line: 0 + ... +not ok 66 - compareQPalettes(one role is different) + --- + type: QCOMPARE + message: Compared values are not the same + wanted: QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000]") (expectedPalette) + found: QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000015,Disabled:#ff000015,Inactive:#ff000015]") (actualPalette) + expected: QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000]") (expectedPalette) + actual: QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000015,Disabled:#ff000015,Inactive:#ff000015]") (actualPalette) + at: tst_Cmptest::compareQPalettes() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:0) + file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp + line: 0 + ... +ok 67 - compareQPalettes(all roles are the same) +not ok 68 - tryCompare() --- type: QCOMPARE message: Compared values are not the same @@ -532,7 +558,7 @@ not ok 64 - tryCompare() - severity: info message: Should now time out and fail ... -not ok 65 - verify() +not ok 69 - verify() --- type: QVERIFY message: Verification failed @@ -544,7 +570,7 @@ not ok 65 - verify() file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -not ok 66 - verify2() +not ok 70 - verify2() --- type: QVERIFY message: 42 >= 2 (as expected, in fact) @@ -556,7 +582,7 @@ not ok 66 - verify2() file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -not ok 67 - tryVerify() +not ok 71 - tryVerify() --- type: QVERIFY message: Verification failed @@ -572,7 +598,7 @@ not ok 67 - tryVerify() - severity: info message: Should now time out and fail ... -not ok 68 - tryVerify2() +not ok 72 - tryVerify2() --- type: QVERIFY message: Should time out and fail @@ -584,9 +610,9 @@ not ok 68 - tryVerify2() file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp line: 0 ... -ok 69 - verifyExplicitOperatorBool() -ok 70 - cleanupTestCase() -1..70 -# tests 70 -# pass 21 -# fail 49 +ok 73 - verifyExplicitOperatorBool() +ok 74 - cleanupTestCase() +1..74 +# tests 74 +# pass 23 +# fail 51 diff --git a/tests/auto/testlib/selftests/expected_cmptest.teamcity b/tests/auto/testlib/selftests/expected_cmptest.teamcity index dfc8cdb2ce..b5ff675465 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.teamcity +++ b/tests/auto/testlib/selftests/expected_cmptest.teamcity @@ -101,6 +101,8 @@ ##teamcity[testStarted name='compareQListDouble()' flowId='tst_Cmptest'] ##teamcity[testFailed name='compareQListDouble()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared lists differ at index 0.|n Actual (double1): 1.5|n Expected (double2): 1' flowId='tst_Cmptest'] ##teamcity[testFinished name='compareQListDouble()' flowId='tst_Cmptest'] +##teamcity[testStarted name='compareContainerToInitializerList()' flowId='tst_Cmptest'] +##teamcity[testFinished name='compareContainerToInitializerList()' flowId='tst_Cmptest'] ##teamcity[testStarted name='compareQColor(Qt::yellow vs "yellow")' flowId='tst_Cmptest'] ##teamcity[testFinished name='compareQColor(Qt::yellow vs "yellow")' flowId='tst_Cmptest'] ##teamcity[testStarted name='compareQColor(Qt::yellow vs Qt::green)' flowId='tst_Cmptest'] @@ -169,6 +171,14 @@ ##teamcity[testStarted name='compareQVector4D()' flowId='tst_Cmptest'] ##teamcity[testFailed name='compareQVector4D()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (v4a): QVector4D(1, 2, 3, 4)|n Expected (v4b): QVector4D(1, 3, 3, 4)' flowId='tst_Cmptest'] ##teamcity[testFinished name='compareQVector4D()' flowId='tst_Cmptest'] +##teamcity[testStarted name='compareQPalettes(all roles are different)' flowId='tst_Cmptest'] +##teamcity[testFailed name='compareQPalettes(all roles are different)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (actualPalette) : QPalette(resolve=0x7fffffffffffffff,"WindowText:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],Button:|[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001|],Light:|[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002|],Midlight:|[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003|],Dark:|[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004|],Mid:|[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005|],Text:|[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006|],BrightText:|[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007|],ButtonText:|[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008|],Base:|[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009|],Window:|[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a|],Shadow:|[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b|],Highlight:|[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c|],HighlightedText:|[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d|],Link:|[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e|],LinkVisited:|[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f|],AlternateBase:|[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010|],ToolTipBase:|[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012|],ToolTipText:|[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013|],PlaceholderText:|[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014|],Accent:|[Active:#ff000015,Disabled:#ff000015,Inactive:#ff000015|]")|n Expected (expectedPalette): QPalette(resolve=0x7fffffffffffffff,"WindowText:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],Button:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],Light:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],Midlight:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],Dark:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],Mid:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],Text:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],BrightText:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],ButtonText:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],Base:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],Window:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],Shadow:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],Highlight:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],HighlightedText:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],Link:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],LinkVisited:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],AlternateBase:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],ToolTipBase:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],ToolTipText:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],PlaceholderText:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],Accent:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|]")' flowId='tst_Cmptest'] +##teamcity[testFinished name='compareQPalettes(all roles are different)' flowId='tst_Cmptest'] +##teamcity[testStarted name='compareQPalettes(one role is different)' flowId='tst_Cmptest'] +##teamcity[testFailed name='compareQPalettes(one role is different)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (actualPalette) : QPalette(resolve=0x7fffffffffffffff,"WindowText:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],Button:|[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001|],Light:|[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002|],Midlight:|[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003|],Dark:|[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004|],Mid:|[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005|],Text:|[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006|],BrightText:|[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007|],ButtonText:|[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008|],Base:|[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009|],Window:|[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a|],Shadow:|[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b|],Highlight:|[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c|],HighlightedText:|[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d|],Link:|[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e|],LinkVisited:|[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f|],AlternateBase:|[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010|],ToolTipBase:|[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012|],ToolTipText:|[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013|],PlaceholderText:|[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014|],Accent:|[Active:#ff000015,Disabled:#ff000015,Inactive:#ff000015|]")|n Expected (expectedPalette): QPalette(resolve=0x7fffffffffffffff,"WindowText:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|],Button:|[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001|],Light:|[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002|],Midlight:|[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003|],Dark:|[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004|],Mid:|[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005|],Text:|[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006|],BrightText:|[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007|],ButtonText:|[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008|],Base:|[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009|],Window:|[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a|],Shadow:|[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b|],Highlight:|[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c|],HighlightedText:|[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d|],Link:|[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e|],LinkVisited:|[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f|],AlternateBase:|[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010|],ToolTipBase:|[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012|],ToolTipText:|[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013|],PlaceholderText:|[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014|],Accent:|[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000|]")' flowId='tst_Cmptest'] +##teamcity[testFinished name='compareQPalettes(one role is different)' flowId='tst_Cmptest'] +##teamcity[testStarted name='compareQPalettes(all roles are the same)' flowId='tst_Cmptest'] +##teamcity[testFinished name='compareQPalettes(all roles are the same)' flowId='tst_Cmptest'] ##teamcity[testStarted name='tryCompare()' flowId='tst_Cmptest'] ##teamcity[testFailed name='tryCompare()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (c) : DeferredFlag(true)|n Expected (DeferredFlag()): DeferredFlag(false)' flowId='tst_Cmptest'] ##teamcity[testStdOut name='tryCompare()' out='QINFO: Should now time out and fail' flowId='tst_Cmptest'] diff --git a/tests/auto/testlib/selftests/expected_cmptest.txt b/tests/auto/testlib/selftests/expected_cmptest.txt index 602202bafc..ff81a46397 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.txt +++ b/tests/auto/testlib/selftests/expected_cmptest.txt @@ -116,6 +116,7 @@ FAIL! : tst_Cmptest::compareQListDouble() Compared lists differ at index 0. Actual (double1): 1.5 Expected (double2): 1 Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] +PASS : tst_Cmptest::compareContainerToInitializerList() PASS : tst_Cmptest::compareQColor(Qt::yellow vs "yellow") FAIL! : tst_Cmptest::compareQColor(Qt::yellow vs Qt::green) Compared values are not the same Actual (colorA): #ffffff00 @@ -191,6 +192,15 @@ FAIL! : tst_Cmptest::compareQVector4D() Compared values are not the same Actual (v4a): QVector4D(1, 2, 3, 4) Expected (v4b): QVector4D(1, 3, 3, 4) Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] +FAIL! : tst_Cmptest::compareQPalettes(all roles are different) Compared values are not the same + Actual (actualPalette) : QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000015,Disabled:#ff000015,Inactive:#ff000015]") + Expected (expectedPalette): QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Light:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Midlight:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Dark:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Mid:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Text:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],BrightText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ButtonText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Base:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Window:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Shadow:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Highlight:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],HighlightedText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Link:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],LinkVisited:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],AlternateBase:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ToolTipBase:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ToolTipText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],PlaceholderText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Accent:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000]") + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] +FAIL! : tst_Cmptest::compareQPalettes(one role is different) Compared values are not the same + Actual (actualPalette) : QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000015,Disabled:#ff000015,Inactive:#ff000015]") + Expected (expectedPalette): QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000]") + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] +PASS : tst_Cmptest::compareQPalettes(all roles are the same) QINFO : tst_Cmptest::tryCompare() Should now time out and fail FAIL! : tst_Cmptest::tryCompare() Compared values are not the same Actual (c) : DeferredFlag(true) @@ -207,5 +217,5 @@ FAIL! : tst_Cmptest::tryVerify2() '!c' returned FALSE. (Should time out and fai Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] PASS : tst_Cmptest::verifyExplicitOperatorBool() PASS : tst_Cmptest::cleanupTestCase() -Totals: 21 passed, 49 failed, 0 skipped, 0 blacklisted, 0ms +Totals: 23 passed, 51 failed, 0 skipped, 0 blacklisted, 0ms ********* Finished testing of tst_Cmptest ********* diff --git a/tests/auto/testlib/selftests/expected_cmptest.xml b/tests/auto/testlib/selftests/expected_cmptest.xml index a0e8e76179..df4d8b28be 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.xml +++ b/tests/auto/testlib/selftests/expected_cmptest.xml @@ -236,6 +236,10 @@ </Incident> <Duration msecs="0"/> </TestFunction> + <TestFunction name="compareContainerToInitializerList"> + <Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> + </TestFunction> <TestFunction name="compareQColor"> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[Qt::yellow vs "yellow"]]></DataTag> @@ -379,6 +383,24 @@ </Incident> <Duration msecs="0"/> </TestFunction> + <TestFunction name="compareQPalettes"> + <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0"> + <DataTag><![CDATA[all roles are different]]></DataTag> + <Description><![CDATA[Compared values are not the same + Actual (actualPalette) : QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000015,Disabled:#ff000015,Inactive:#ff000015]") + Expected (expectedPalette): QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Light:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Midlight:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Dark:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Mid:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Text:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],BrightText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ButtonText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Base:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Window:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Shadow:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Highlight:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],HighlightedText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Link:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],LinkVisited:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],AlternateBase:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ToolTipBase:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],ToolTipText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],PlaceholderText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Accent:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000]")]]></Description> + </Incident> + <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0"> + <DataTag><![CDATA[one role is different]]></DataTag> + <Description><![CDATA[Compared values are not the same + Actual (actualPalette) : QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000015,Disabled:#ff000015,Inactive:#ff000015]") + Expected (expectedPalette): QPalette(resolve=0x7fffffffffffffff,"WindowText:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000],Button:[Active:#ff000001,Disabled:#ff000001,Inactive:#ff000001],Light:[Active:#ff000002,Disabled:#ff000002,Inactive:#ff000002],Midlight:[Active:#ff000003,Disabled:#ff000003,Inactive:#ff000003],Dark:[Active:#ff000004,Disabled:#ff000004,Inactive:#ff000004],Mid:[Active:#ff000005,Disabled:#ff000005,Inactive:#ff000005],Text:[Active:#ff000006,Disabled:#ff000006,Inactive:#ff000006],BrightText:[Active:#ff000007,Disabled:#ff000007,Inactive:#ff000007],ButtonText:[Active:#ff000008,Disabled:#ff000008,Inactive:#ff000008],Base:[Active:#ff000009,Disabled:#ff000009,Inactive:#ff000009],Window:[Active:#ff00000a,Disabled:#ff00000a,Inactive:#ff00000a],Shadow:[Active:#ff00000b,Disabled:#ff00000b,Inactive:#ff00000b],Highlight:[Active:#ff00000c,Disabled:#ff00000c,Inactive:#ff00000c],HighlightedText:[Active:#ff00000d,Disabled:#ff00000d,Inactive:#ff00000d],Link:[Active:#ff00000e,Disabled:#ff00000e,Inactive:#ff00000e],LinkVisited:[Active:#ff00000f,Disabled:#ff00000f,Inactive:#ff00000f],AlternateBase:[Active:#ff000010,Disabled:#ff000010,Inactive:#ff000010],ToolTipBase:[Active:#ff000012,Disabled:#ff000012,Inactive:#ff000012],ToolTipText:[Active:#ff000013,Disabled:#ff000013,Inactive:#ff000013],PlaceholderText:[Active:#ff000014,Disabled:#ff000014,Inactive:#ff000014],Accent:[Active:#ff000000,Disabled:#ff000000,Inactive:#ff000000]")]]></Description> + </Incident> + <Incident type="pass" file="" line="0"> + <DataTag><![CDATA[all roles are the same]]></DataTag> + </Incident> + <Duration msecs="0"/> + </TestFunction> <TestFunction name="tryCompare"> <Message type="qinfo" file="" line="0"> <Description><![CDATA[Should now time out and fail]]></Description> diff --git a/tests/auto/testlib/selftests/expected_silent.txt b/tests/auto/testlib/selftests/expected_silent.txt index 127e39a6c1..6c9b71a835 100644 --- a/tests/auto/testlib/selftests/expected_silent.txt +++ b/tests/auto/testlib/selftests/expected_silent.txt @@ -5,7 +5,4 @@ FAIL! : tst_Silent::fail() 'false' returned FALSE. (This test should fail) Loc: [qtbase/tests/auto/testlib/selftests/silent/tst_silent.cpp(0)] XPASS : tst_Silent::xpass() 'true' returned TRUE unexpectedly. (This test should XPASS) Loc: [qtbase/tests/auto/testlib/selftests/silent/tst_silent.cpp(0)] -QFATAL : tst_Silent::messages() This is a fatal error message that should still appear in silent test output -FAIL! : tst_Silent::messages() Received a fatal error. - Loc: [qtbase/tests/auto/testlib/selftests/silent/tst_silent.cpp(0)] -Totals: 3 passed, 3 failed, 1 skipped, 0 blacklisted, 0ms +Totals: 5 passed, 2 failed, 1 skipped, 0 blacklisted, 0ms diff --git a/tests/auto/testlib/selftests/expected_silent_fatal.txt b/tests/auto/testlib/selftests/expected_silent_fatal.txt new file mode 100644 index 0000000000..fb00066c13 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_silent_fatal.txt @@ -0,0 +1,5 @@ +Testing tst_SilentFatal +QFATAL : tst_SilentFatal::fatalmessages() This is a fatal error message that should still appear in silent test output +FAIL! : tst_SilentFatal::fatalmessages() Received a fatal error. + Loc: [qtbase/tests/auto/testlib/selftests/silent_fatal/tst_silent_fatal.cpp(0)] +Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted, 0ms diff --git a/tests/auto/testlib/selftests/expected_skipblacklisted.junitxml b/tests/auto/testlib/selftests/expected_skipblacklisted.junitxml new file mode 100644 index 0000000000..308a4ea999 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_skipblacklisted.junitxml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<testsuite name="tst_SkipBlacklisted" timestamp="@TEST_START_TIME@" hostname="@HOSTNAME@" tests="5" failures="0" errors="0" skipped="3" time="@TEST_DURATION@"> + <properties> + <property name="QTestVersion" value="@INSERT_QT_VERSION_HERE@"/> + <property name="QtVersion" value="@INSERT_QT_VERSION_HERE@"/> + <property name="QtBuild" value=""/> + </properties> + <testcase name="initTestCase" classname="tst_SkipBlacklisted" time="@TEST_DURATION@"/> + <testcase name="pass" classname="tst_SkipBlacklisted" time="@TEST_DURATION@"/> + <testcase name="blacklisted" classname="tst_SkipBlacklisted" time="@TEST_DURATION@"> + <skipped message="Skipping blacklisted test since -skipblacklisted option is set."/> + </testcase> + <testcase name="blacklistedData(should pass)" classname="tst_SkipBlacklisted" time="@TEST_DURATION@"> + <skipped message="Skipping blacklisted test since -skipblacklisted option is set."/> + <skipped message="Skipping blacklisted test since -skipblacklisted option is set."/> + </testcase> + <testcase name="cleanupTestCase" classname="tst_SkipBlacklisted" time="@TEST_DURATION@"/> +</testsuite> diff --git a/tests/auto/testlib/selftests/expected_skipblacklisted.lightxml b/tests/auto/testlib/selftests/expected_skipblacklisted.lightxml new file mode 100644 index 0000000000..45d3476d6a --- /dev/null +++ b/tests/auto/testlib/selftests/expected_skipblacklisted.lightxml @@ -0,0 +1,36 @@ + <Environment> + <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> + <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> + </Environment> + <TestFunction name="initTestCase"> + <Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> + </TestFunction> + <TestFunction name="pass"> + <Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> + </TestFunction> + <TestFunction name="blacklisted"> + <Incident type="skip" file="" line="0"> + <Description><![CDATA[Skipping blacklisted test since -skipblacklisted option is set.]]></Description> + </Incident> + <Duration msecs="0"/> + </TestFunction> + <TestFunction name="blacklistedData"> + <Incident type="skip" file="" line="0"> + <Description><![CDATA[Skipping blacklisted test since -skipblacklisted option is set.]]></Description> + </Incident> + <Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should pass]]></DataTag> + </Incident> + <Incident type="skip" file="" line="0"> + <Description><![CDATA[Skipping blacklisted test since -skipblacklisted option is set.]]></Description> + </Incident> + <Duration msecs="0"/> + </TestFunction> + <TestFunction name="cleanupTestCase"> + <Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> + </TestFunction> + <Duration msecs="0"/> diff --git a/tests/auto/testlib/selftests/expected_skipblacklisted.tap b/tests/auto/testlib/selftests/expected_skipblacklisted.tap new file mode 100644 index 0000000000..f71524d85f --- /dev/null +++ b/tests/auto/testlib/selftests/expected_skipblacklisted.tap @@ -0,0 +1,13 @@ +TAP version 13 +# tst_SkipBlacklisted +ok 1 - initTestCase() +ok 2 - pass() +ok 3 - blacklisted() # SKIP Skipping blacklisted test since -skipblacklisted option is set. +ok 4 - blacklistedData() # SKIP Skipping blacklisted test since -skipblacklisted option is set. +ok 5 - blacklistedData(should pass) +ok 6 - blacklistedData() # SKIP Skipping blacklisted test since -skipblacklisted option is set. +ok 7 - cleanupTestCase() +1..7 +# tests 7 +# pass 4 +# fail 0 diff --git a/tests/auto/testlib/selftests/expected_skipblacklisted.teamcity b/tests/auto/testlib/selftests/expected_skipblacklisted.teamcity new file mode 100644 index 0000000000..67a788901a --- /dev/null +++ b/tests/auto/testlib/selftests/expected_skipblacklisted.teamcity @@ -0,0 +1,19 @@ +##teamcity[testSuiteStarted name='tst_SkipBlacklisted' flowId='tst_SkipBlacklisted'] +##teamcity[testStarted name='initTestCase()' flowId='tst_SkipBlacklisted'] +##teamcity[testFinished name='initTestCase()' flowId='tst_SkipBlacklisted'] +##teamcity[testStarted name='pass()' flowId='tst_SkipBlacklisted'] +##teamcity[testFinished name='pass()' flowId='tst_SkipBlacklisted'] +##teamcity[testStarted name='blacklisted()' flowId='tst_SkipBlacklisted'] +##teamcity[testIgnored name='blacklisted()' message='Skipping blacklisted test since -skipblacklisted option is set.' flowId='tst_SkipBlacklisted'] +##teamcity[testFinished name='blacklisted()' flowId='tst_SkipBlacklisted'] +##teamcity[testStarted name='blacklistedData()' flowId='tst_SkipBlacklisted'] +##teamcity[testIgnored name='blacklistedData()' message='Skipping blacklisted test since -skipblacklisted option is set.' flowId='tst_SkipBlacklisted'] +##teamcity[testFinished name='blacklistedData()' flowId='tst_SkipBlacklisted'] +##teamcity[testStarted name='blacklistedData(should pass)' flowId='tst_SkipBlacklisted'] +##teamcity[testFinished name='blacklistedData(should pass)' flowId='tst_SkipBlacklisted'] +##teamcity[testStarted name='blacklistedData()' flowId='tst_SkipBlacklisted'] +##teamcity[testIgnored name='blacklistedData()' message='Skipping blacklisted test since -skipblacklisted option is set.' flowId='tst_SkipBlacklisted'] +##teamcity[testFinished name='blacklistedData()' flowId='tst_SkipBlacklisted'] +##teamcity[testStarted name='cleanupTestCase()' flowId='tst_SkipBlacklisted'] +##teamcity[testFinished name='cleanupTestCase()' flowId='tst_SkipBlacklisted'] +##teamcity[testSuiteFinished name='tst_SkipBlacklisted' flowId='tst_SkipBlacklisted'] diff --git a/tests/auto/testlib/selftests/expected_skipblacklisted.txt b/tests/auto/testlib/selftests/expected_skipblacklisted.txt new file mode 100644 index 0000000000..0e3dfa04e8 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_skipblacklisted.txt @@ -0,0 +1,11 @@ +********* Start testing of tst_SkipBlacklisted ********* +Config: Using QtTest library +PASS : tst_SkipBlacklisted::initTestCase() +PASS : tst_SkipBlacklisted::pass() +SKIP : tst_SkipBlacklisted::blacklisted() Skipping blacklisted test since -skipblacklisted option is set. +SKIP : tst_SkipBlacklisted::blacklistedData() Skipping blacklisted test since -skipblacklisted option is set. +PASS : tst_SkipBlacklisted::blacklistedData(should pass) +SKIP : tst_SkipBlacklisted::blacklistedData() Skipping blacklisted test since -skipblacklisted option is set. +PASS : tst_SkipBlacklisted::cleanupTestCase() +Totals: 4 passed, 0 failed, 3 skipped, 0 blacklisted, 0ms +********* Finished testing of tst_SkipBlacklisted ********* diff --git a/tests/auto/testlib/selftests/expected_skipblacklisted.xml b/tests/auto/testlib/selftests/expected_skipblacklisted.xml new file mode 100644 index 0000000000..100fededb3 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_skipblacklisted.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<TestCase name="tst_SkipBlacklisted"> + <Environment> + <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> + <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> + </Environment> + <TestFunction name="initTestCase"> + <Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> + </TestFunction> + <TestFunction name="pass"> + <Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> + </TestFunction> + <TestFunction name="blacklisted"> + <Incident type="skip" file="" line="0"> + <Description><![CDATA[Skipping blacklisted test since -skipblacklisted option is set.]]></Description> + </Incident> + <Duration msecs="0"/> + </TestFunction> + <TestFunction name="blacklistedData"> + <Incident type="skip" file="" line="0"> + <Description><![CDATA[Skipping blacklisted test since -skipblacklisted option is set.]]></Description> + </Incident> + <Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should pass]]></DataTag> + </Incident> + <Incident type="skip" file="" line="0"> + <Description><![CDATA[Skipping blacklisted test since -skipblacklisted option is set.]]></Description> + </Incident> + <Duration msecs="0"/> + </TestFunction> + <TestFunction name="cleanupTestCase"> + <Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> + </TestFunction> + <Duration msecs="0"/> +</TestCase> diff --git a/tests/auto/testlib/selftests/expected_testlib.junitxml b/tests/auto/testlib/selftests/expected_testlib.junitxml index f5d3a94126..33c8bfe403 100644 --- a/tests/auto/testlib/selftests/expected_testlib.junitxml +++ b/tests/auto/testlib/selftests/expected_testlib.junitxml @@ -9,7 +9,7 @@ <testcase name="basics" classname="tst_TestLib" time="@TEST_DURATION@"> <failure type="fail" message="Compared QObject pointers are not the same"> <![CDATA[ Actual (QTest::testObject()): tst_TestLib/"TestObject" - Expected (nullptr) : (nullptr)]]> + Expected (nullptr) : "nullptr"]]> </failure> </testcase> <testcase name="delays" classname="tst_TestLib" time="@TEST_DURATION@"/> diff --git a/tests/auto/testlib/selftests/expected_testlib.lightxml b/tests/auto/testlib/selftests/expected_testlib.lightxml index cd0f96d6d4..76435eb9f0 100644 --- a/tests/auto/testlib/selftests/expected_testlib.lightxml +++ b/tests/auto/testlib/selftests/expected_testlib.lightxml @@ -11,7 +11,7 @@ <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp" line="0"> <Description><![CDATA[Compared QObject pointers are not the same Actual (QTest::testObject()): tst_TestLib/"TestObject" - Expected (nullptr) : (nullptr)]]></Description> + Expected (nullptr) : "nullptr"]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_testlib.tap b/tests/auto/testlib/selftests/expected_testlib.tap index 4a6056bc77..1fa7dc77c4 100644 --- a/tests/auto/testlib/selftests/expected_testlib.tap +++ b/tests/auto/testlib/selftests/expected_testlib.tap @@ -5,9 +5,9 @@ not ok 2 - basics() --- type: QCOMPARE message: Compared QObject pointers are not the same - wanted: (nullptr) (nullptr) + wanted: "nullptr" (nullptr) found: tst_TestLib/"TestObject" (QTest::testObject()) - expected: (nullptr) (nullptr) + expected: "nullptr" (nullptr) actual: tst_TestLib/"TestObject" (QTest::testObject()) at: tst_TestLib::basics() (qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp:0) file: qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp diff --git a/tests/auto/testlib/selftests/expected_testlib.teamcity b/tests/auto/testlib/selftests/expected_testlib.teamcity index 279ef03f3f..52f7fa244c 100644 --- a/tests/auto/testlib/selftests/expected_testlib.teamcity +++ b/tests/auto/testlib/selftests/expected_testlib.teamcity @@ -2,7 +2,7 @@ ##teamcity[testStarted name='initTestCase()' flowId='tst_TestLib'] ##teamcity[testFinished name='initTestCase()' flowId='tst_TestLib'] ##teamcity[testStarted name='basics()' flowId='tst_TestLib'] -##teamcity[testFailed name='basics()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp(0)|]' details='Compared QObject pointers are not the same|n Actual (QTest::testObject()): tst_TestLib/"TestObject"|n Expected (nullptr) : (nullptr)' flowId='tst_TestLib'] +##teamcity[testFailed name='basics()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp(0)|]' details='Compared QObject pointers are not the same|n Actual (QTest::testObject()): tst_TestLib/"TestObject"|n Expected (nullptr) : "nullptr"' flowId='tst_TestLib'] ##teamcity[testFinished name='basics()' flowId='tst_TestLib'] ##teamcity[testStarted name='delays()' flowId='tst_TestLib'] ##teamcity[testFinished name='delays()' flowId='tst_TestLib'] diff --git a/tests/auto/testlib/selftests/expected_testlib.txt b/tests/auto/testlib/selftests/expected_testlib.txt index a0b8a275d0..4d652626e9 100644 --- a/tests/auto/testlib/selftests/expected_testlib.txt +++ b/tests/auto/testlib/selftests/expected_testlib.txt @@ -3,7 +3,7 @@ Config: Using QtTest library PASS : tst_TestLib::initTestCase() FAIL! : tst_TestLib::basics() Compared QObject pointers are not the same Actual (QTest::testObject()): tst_TestLib/"TestObject" - Expected (nullptr) : (nullptr) + Expected (nullptr) : "nullptr" Loc: [qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp(0)] PASS : tst_TestLib::delays() PASS : tst_TestLib::reals(zero) diff --git a/tests/auto/testlib/selftests/expected_testlib.xml b/tests/auto/testlib/selftests/expected_testlib.xml index 241fd3f8d1..8b66b003d0 100644 --- a/tests/auto/testlib/selftests/expected_testlib.xml +++ b/tests/auto/testlib/selftests/expected_testlib.xml @@ -13,7 +13,7 @@ <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp" line="0"> <Description><![CDATA[Compared QObject pointers are not the same Actual (QTest::testObject()): tst_TestLib/"TestObject" - Expected (nullptr) : (nullptr)]]></Description> + Expected (nullptr) : "nullptr"]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_warnings.junitxml b/tests/auto/testlib/selftests/expected_warnings.junitxml index 1799be8279..4fa8c88622 100644 --- a/tests/auto/testlib/selftests/expected_warnings.junitxml +++ b/tests/auto/testlib/selftests/expected_warnings.junitxml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<testsuite name="tst_Warnings" timestamp="@TEST_START_TIME@" hostname="@HOSTNAME@" tests="15" failures="10" errors="0" skipped="0" time="@TEST_DURATION@"> +<testsuite name="tst_Warnings" timestamp="@TEST_START_TIME@" hostname="@HOSTNAME@" tests="16" failures="11" errors="0" skipped="0" time="@TEST_DURATION@"> <properties> <property name="QTestVersion" value="@INSERT_QT_VERSION_HERE@"/> <property name="QtVersion" value="@INSERT_QT_VERSION_HERE@"/> @@ -107,5 +107,10 @@ <skipped message="My cabbage! :("/> </testcase> <testcase name="testFailOnWarningsAndIgnoreWarnings" classname="tst_Warnings" time="@TEST_DURATION@"/> + <testcase name="testFailOnTemporaryObjectDestruction" classname="tst_Warnings" time="@TEST_DURATION@"> + <failure type="fail" message="Received a warning that resulted in a failure:"> + <![CDATA[Running low on toothpaste!]]> + </failure> + </testcase> <testcase name="cleanupTestCase" classname="tst_Warnings" time="@TEST_DURATION@"/> </testsuite> diff --git a/tests/auto/testlib/selftests/expected_warnings.lightxml b/tests/auto/testlib/selftests/expected_warnings.lightxml index 37070cad00..50b6c4bdb6 100644 --- a/tests/auto/testlib/selftests/expected_warnings.lightxml +++ b/tests/auto/testlib/selftests/expected_warnings.lightxml @@ -201,6 +201,13 @@ Ran out of cabbage!]]></Description> <Incident type="pass" file="" line="0" /> <Duration msecs="0"/> </TestFunction> + <TestFunction name="testFailOnTemporaryObjectDestruction"> + <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp" line="0"> + <Description><![CDATA[Received a warning that resulted in a failure: +Running low on toothpaste!]]></Description> + </Incident> + <Duration msecs="0"/> + </TestFunction> <TestFunction name="cleanupTestCase"> <Incident type="pass" file="" line="0" /> <Duration msecs="0"/> diff --git a/tests/auto/testlib/selftests/expected_warnings.tap b/tests/auto/testlib/selftests/expected_warnings.tap index 9ea9b46bcb..2667574064 100644 --- a/tests/auto/testlib/selftests/expected_warnings.tap +++ b/tests/auto/testlib/selftests/expected_warnings.tap @@ -159,8 +159,16 @@ Ran out of cabbage! ... ok 13 - testFailOnWarningsThenSkip() # SKIP My cabbage! :( ok 14 - testFailOnWarningsAndIgnoreWarnings() -ok 15 - cleanupTestCase() -1..15 -# tests 15 +not ok 15 - testFailOnTemporaryObjectDestruction() + --- + # Received a warning that resulted in a failure: +Running low on toothpaste! + at: tst_Warnings::testFailOnTemporaryObjectDestruction() (qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp:0) + file: qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp + line: 0 + ... +ok 16 - cleanupTestCase() +1..16 +# tests 16 # pass 5 -# fail 10 +# fail 11 diff --git a/tests/auto/testlib/selftests/expected_warnings.teamcity b/tests/auto/testlib/selftests/expected_warnings.teamcity index 67dd039ebf..a4bd7139a6 100644 --- a/tests/auto/testlib/selftests/expected_warnings.teamcity +++ b/tests/auto/testlib/selftests/expected_warnings.teamcity @@ -57,6 +57,9 @@ ##teamcity[testFinished name='testFailOnWarningsThenSkip()' flowId='tst_Warnings'] ##teamcity[testStarted name='testFailOnWarningsAndIgnoreWarnings()' flowId='tst_Warnings'] ##teamcity[testFinished name='testFailOnWarningsAndIgnoreWarnings()' flowId='tst_Warnings'] +##teamcity[testStarted name='testFailOnTemporaryObjectDestruction()' flowId='tst_Warnings'] +##teamcity[testFailed name='testFailOnTemporaryObjectDestruction()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp(0)|]' details='Received a warning that resulted in a failure:|nRunning low on toothpaste!' flowId='tst_Warnings'] +##teamcity[testFinished name='testFailOnTemporaryObjectDestruction()' flowId='tst_Warnings'] ##teamcity[testStarted name='cleanupTestCase()' flowId='tst_Warnings'] ##teamcity[testFinished name='cleanupTestCase()' flowId='tst_Warnings'] ##teamcity[testSuiteFinished name='tst_Warnings' flowId='tst_Warnings'] diff --git a/tests/auto/testlib/selftests/expected_warnings.txt b/tests/auto/testlib/selftests/expected_warnings.txt index 5037eb87df..72e2201f38 100644 --- a/tests/auto/testlib/selftests/expected_warnings.txt +++ b/tests/auto/testlib/selftests/expected_warnings.txt @@ -69,6 +69,9 @@ Ran out of cabbage! SKIP : tst_Warnings::testFailOnWarningsThenSkip() My cabbage! :( Loc: [qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp(0)] PASS : tst_Warnings::testFailOnWarningsAndIgnoreWarnings() +FAIL! : tst_Warnings::testFailOnTemporaryObjectDestruction() Received a warning that resulted in a failure: +Running low on toothpaste! + Loc: [qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp(0)] PASS : tst_Warnings::cleanupTestCase() -Totals: 5 passed, 10 failed, 0 skipped, 0 blacklisted, 0ms +Totals: 5 passed, 11 failed, 0 skipped, 0 blacklisted, 0ms ********* Finished testing of tst_Warnings ********* diff --git a/tests/auto/testlib/selftests/expected_warnings.xml b/tests/auto/testlib/selftests/expected_warnings.xml index 8da8404a16..808f59768c 100644 --- a/tests/auto/testlib/selftests/expected_warnings.xml +++ b/tests/auto/testlib/selftests/expected_warnings.xml @@ -203,6 +203,13 @@ Ran out of cabbage!]]></Description> <Incident type="pass" file="" line="0" /> <Duration msecs="0"/> </TestFunction> + <TestFunction name="testFailOnTemporaryObjectDestruction"> + <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp" line="0"> + <Description><![CDATA[Received a warning that resulted in a failure: +Running low on toothpaste!]]></Description> + </Incident> + <Duration msecs="0"/> + </TestFunction> <TestFunction name="cleanupTestCase"> <Incident type="pass" file="" line="0" /> <Duration msecs="0"/> diff --git a/tests/auto/testlib/selftests/expectfail/CMakeLists.txt b/tests/auto/testlib/selftests/expectfail/CMakeLists.txt index dcb074c67e..d89e03ebef 100644 --- a/tests/auto/testlib/selftests/expectfail/CMakeLists.txt +++ b/tests/auto/testlib/selftests/expectfail/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(expectfail NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_expectfail.cpp diff --git a/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp b/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp index 147568b566..2e67012cc8 100644 --- a/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp +++ b/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/extendedcompare/CMakeLists.txt b/tests/auto/testlib/selftests/extendedcompare/CMakeLists.txt index 2975521060..3b2fbb84ec 100644 --- a/tests/auto/testlib/selftests/extendedcompare/CMakeLists.txt +++ b/tests/auto/testlib/selftests/extendedcompare/CMakeLists.txt @@ -3,6 +3,7 @@ qt_internal_add_executable(extendedcompare NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_extendedcompare.cpp diff --git a/tests/auto/testlib/selftests/extendedcompare/tst_extendedcompare.cpp b/tests/auto/testlib/selftests/extendedcompare/tst_extendedcompare.cpp index b6eb5c870c..70a7798667 100644 --- a/tests/auto/testlib/selftests/extendedcompare/tst_extendedcompare.cpp +++ b/tests/auto/testlib/selftests/extendedcompare/tst_extendedcompare.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2022 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <QtCore/qtimer.h> @@ -93,11 +93,13 @@ static ClassWithPointerGetter getClassForValue(int val) // various toString() overloads namespace QTest { -char *toString(const int *val) +template <> char *toString(const int *const &val) { return val ? toString(*val) : toString(nullptr); } +} // namespace QTest + char *toString(const MyClass &val) { char *msg = new char[128]; @@ -117,8 +119,6 @@ char *toString(const MyClass *val) return toString(nullptr); } -} // namespace QTest - enum MyUnregisteredEnum { MyUnregisteredEnumValue1, MyUnregisteredEnumValue2 }; class tst_ExtendedCompare : public QObject @@ -293,8 +293,6 @@ public: } }; -namespace QTest { - char *toString(const ClassWithDeferredSetter &val) { char *msg = new char[128]; @@ -302,8 +300,6 @@ char *toString(const ClassWithDeferredSetter &val) return msg; } -} // namespace QTest - void tst_ExtendedCompare::checkComparisonWithTimeout() { QFETCH_GLOBAL(QTest::ComparisonOperation, operation); diff --git a/tests/auto/testlib/selftests/failcleanup/CMakeLists.txt b/tests/auto/testlib/selftests/failcleanup/CMakeLists.txt index 0eda65abad..10805ba6f7 100644 --- a/tests/auto/testlib/selftests/failcleanup/CMakeLists.txt +++ b/tests/auto/testlib/selftests/failcleanup/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2022 The Qt Company Ltd. +# Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause ##################################################################### @@ -7,6 +7,7 @@ qt_internal_add_executable(failcleanup NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_failcleanup.cpp diff --git a/tests/auto/testlib/selftests/failcleanup/tst_failcleanup.cpp b/tests/auto/testlib/selftests/failcleanup/tst_failcleanup.cpp index a93c57ccda..2e519e0f91 100644 --- a/tests/auto/testlib/selftests/failcleanup/tst_failcleanup.cpp +++ b/tests/auto/testlib/selftests/failcleanup/tst_failcleanup.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/selftests/failcleanuptestcase/CMakeLists.txt b/tests/auto/testlib/selftests/failcleanuptestcase/CMakeLists.txt index 19b954f31c..cb11a577f6 100644 --- a/tests/auto/testlib/selftests/failcleanuptestcase/CMakeLists.txt +++ b/tests/auto/testlib/selftests/failcleanuptestcase/CMakeLists.txt @@ -1,9 +1,12 @@ +# Copyright (C) 2024 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## failcleanuptestcase Binary: ##################################################################### qt_internal_add_executable(failcleanuptestcase NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_failcleanuptestcase.cpp diff --git a/tests/auto/testlib/selftests/failcleanuptestcase/tst_failcleanuptestcase.cpp b/tests/auto/testlib/selftests/failcleanuptestcase/tst_failcleanuptestcase.cpp index 0375122565..e90f6759db 100644 --- a/tests/auto/testlib/selftests/failcleanuptestcase/tst_failcleanuptestcase.cpp +++ b/tests/auto/testlib/selftests/failcleanuptestcase/tst_failcleanuptestcase.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/selftests/faildatatype/CMakeLists.txt b/tests/auto/testlib/selftests/faildatatype/CMakeLists.txt index a4a8725c03..a0af051f74 100644 --- a/tests/auto/testlib/selftests/faildatatype/CMakeLists.txt +++ b/tests/auto/testlib/selftests/faildatatype/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(faildatatype NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_faildatatype.cpp diff --git a/tests/auto/testlib/selftests/faildatatype/tst_faildatatype.cpp b/tests/auto/testlib/selftests/faildatatype/tst_faildatatype.cpp index 4f63e8c995..4605933636 100644 --- a/tests/auto/testlib/selftests/faildatatype/tst_faildatatype.cpp +++ b/tests/auto/testlib/selftests/faildatatype/tst_faildatatype.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/selftests/failfetchtype/CMakeLists.txt b/tests/auto/testlib/selftests/failfetchtype/CMakeLists.txt index 545af55d7e..503d2b33db 100644 --- a/tests/auto/testlib/selftests/failfetchtype/CMakeLists.txt +++ b/tests/auto/testlib/selftests/failfetchtype/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(failfetchtype NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_failfetchtype.cpp diff --git a/tests/auto/testlib/selftests/failfetchtype/tst_failfetchtype.cpp b/tests/auto/testlib/selftests/failfetchtype/tst_failfetchtype.cpp index 8fdc184a85..4516b76461 100644 --- a/tests/auto/testlib/selftests/failfetchtype/tst_failfetchtype.cpp +++ b/tests/auto/testlib/selftests/failfetchtype/tst_failfetchtype.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/selftests/failinit/CMakeLists.txt b/tests/auto/testlib/selftests/failinit/CMakeLists.txt index 7ef3269f36..9d13c2baf6 100644 --- a/tests/auto/testlib/selftests/failinit/CMakeLists.txt +++ b/tests/auto/testlib/selftests/failinit/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(failinit NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_failinit.cpp diff --git a/tests/auto/testlib/selftests/failinit/tst_failinit.cpp b/tests/auto/testlib/selftests/failinit/tst_failinit.cpp index 7e71c3a47c..dbf91101eb 100644 --- a/tests/auto/testlib/selftests/failinit/tst_failinit.cpp +++ b/tests/auto/testlib/selftests/failinit/tst_failinit.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/selftests/failinitdata/CMakeLists.txt b/tests/auto/testlib/selftests/failinitdata/CMakeLists.txt index 8a2e08c2d3..0bb210fbc3 100644 --- a/tests/auto/testlib/selftests/failinitdata/CMakeLists.txt +++ b/tests/auto/testlib/selftests/failinitdata/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(failinitdata NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_failinitdata.cpp diff --git a/tests/auto/testlib/selftests/failinitdata/tst_failinitdata.cpp b/tests/auto/testlib/selftests/failinitdata/tst_failinitdata.cpp index a464516513..df7b4de981 100644 --- a/tests/auto/testlib/selftests/failinitdata/tst_failinitdata.cpp +++ b/tests/auto/testlib/selftests/failinitdata/tst_failinitdata.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/selftests/fetchbogus/CMakeLists.txt b/tests/auto/testlib/selftests/fetchbogus/CMakeLists.txt index a8a6ce23c5..a47a1fbf19 100644 --- a/tests/auto/testlib/selftests/fetchbogus/CMakeLists.txt +++ b/tests/auto/testlib/selftests/fetchbogus/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(fetchbogus NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_fetchbogus.cpp diff --git a/tests/auto/testlib/selftests/fetchbogus/tst_fetchbogus.cpp b/tests/auto/testlib/selftests/fetchbogus/tst_fetchbogus.cpp index a9b2d3c937..72eacadb3d 100644 --- a/tests/auto/testlib/selftests/fetchbogus/tst_fetchbogus.cpp +++ b/tests/auto/testlib/selftests/fetchbogus/tst_fetchbogus.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/findtestdata/CMakeLists.txt b/tests/auto/testlib/selftests/findtestdata/CMakeLists.txt index 3211170f28..9422861e22 100644 --- a/tests/auto/testlib/selftests/findtestdata/CMakeLists.txt +++ b/tests/auto/testlib/selftests/findtestdata/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(findtestdata NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES findtestdata.cpp diff --git a/tests/auto/testlib/selftests/findtestdata/findtestdata.cpp b/tests/auto/testlib/selftests/findtestdata/findtestdata.cpp index 8e48c03074..9b74ffd3a6 100644 --- a/tests/auto/testlib/selftests/findtestdata/findtestdata.cpp +++ b/tests/auto/testlib/selftests/findtestdata/findtestdata.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/float/CMakeLists.txt b/tests/auto/testlib/selftests/float/CMakeLists.txt index 1809249cb5..448c3e962e 100644 --- a/tests/auto/testlib/selftests/float/CMakeLists.txt +++ b/tests/auto/testlib/selftests/float/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(float NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_float.cpp diff --git a/tests/auto/testlib/selftests/float/tst_float.cpp b/tests/auto/testlib/selftests/float/tst_float.cpp index db6f9896ab..9af14f1e89 100644 --- a/tests/auto/testlib/selftests/float/tst_float.cpp +++ b/tests/auto/testlib/selftests/float/tst_float.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2020 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> #include <QtCore/qfloat16.h> diff --git a/tests/auto/testlib/selftests/generate_expected_output.py b/tests/auto/testlib/selftests/generate_expected_output.py index 8f6134725b..350d20fa27 100755 --- a/tests/auto/testlib/selftests/generate_expected_output.py +++ b/tests/auto/testlib/selftests/generate_expected_output.py @@ -37,10 +37,11 @@ TESTS = ['assert', 'badxml', 'benchlibcallgrind', 'benchlibcounting', 'fetchbogus', 'findtestdata', 'float', 'globaldata', 'longstring', 'maxwarnings', 'mouse', 'multiexec', 'pairdiagnostics', 'pass', 'printdatatags', 'printdatatagswithglobaltags', 'qexecstringlist', - 'signaldumper', 'silent', 'singleskip', 'skip', 'skipcleanup', - 'skipcleanuptestcase', 'skipinit', 'skipinitdata', 'sleep', 'strcmp', - 'subtest', 'testlib', 'tuplediagnostics', 'verbose1', 'verbose2', - 'verifyexceptionthrown', 'warnings', 'watchdog', 'junit', 'keyboard'] + 'signaldumper', 'silent', 'silent_fatal', 'singleskip', 'skip', + 'skipblacklisted', 'skipcleanup', 'skipcleanuptestcase', 'skipinit', + 'skipinitdata', 'sleep', 'strcmp', 'subtest', 'testlib', 'tuplediagnostics', + 'verbose1', 'verbose2', 'verifyexceptionthrown', 'warnings', 'watchdog', + 'junit', 'keyboard'] class Fail (Exception): pass @@ -201,9 +202,9 @@ class Scanner (object): del re -# Keep in sync with tst_selftests.cpp's processEnvironment(): +# Keep in sync with tst_selftests.cpp's testEnvironment(): def baseEnv(platname=None, - keep=('PATH', 'QT_QPA_PLATFORM'), + keep=('PATH', 'QT_QPA_PLATFORM', 'QTEST_THROW_ON_FAIL', 'QTEST_THROW_ON_SKIP', 'ASAN_OPTIONS'), posix=('HOME', 'USER', 'QEMU_SET_ENV', 'QEMU_LD_PREFIX'), nonapple=('DISPLAY', 'XAUTHORITY', 'XAUTHLOCALHOSTNAME'), # and XDG_* # Don't actually know how to test for QNX, so this is ignored: @@ -252,9 +253,9 @@ def testEnv(testname, "watchdog": { "QTEST_FUNCTION_TIMEOUT": "100" }, }, # Must match tst_Selftests::runSubTest_data(): - crashers = ("assert", "blacklisted", "crashes", "crashedterminate", + crashers = ("assert", "crashes", "crashedterminate", "exceptionthrow", "faildatatype", "failfetchtype", - "fetchbogus", "silent", "watchdog")): + "fetchbogus", "silent_fatal", "watchdog")): """Determine the environment in which to run a test.""" data = baseEnv() if testname in crashers: @@ -281,6 +282,7 @@ def shouldIgnoreTest(testname, format): "printdatatags", "printdatatagswithglobaltags", "silent", + "silent_fatal", "crashes", "benchlibcallgrind", "float", diff --git a/tests/auto/testlib/selftests/globaldata/CMakeLists.txt b/tests/auto/testlib/selftests/globaldata/CMakeLists.txt index 2a6aa480bc..2bb7d94e51 100644 --- a/tests/auto/testlib/selftests/globaldata/CMakeLists.txt +++ b/tests/auto/testlib/selftests/globaldata/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(globaldata NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_globaldata.cpp diff --git a/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp b/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp index a9a31c9830..3b589a9962 100644 --- a/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp +++ b/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/junit/CMakeLists.txt b/tests/auto/testlib/selftests/junit/CMakeLists.txt index b7d90f479b..a736d2a15c 100644 --- a/tests/auto/testlib/selftests/junit/CMakeLists.txt +++ b/tests/auto/testlib/selftests/junit/CMakeLists.txt @@ -3,6 +3,7 @@ qt_internal_add_executable(junit NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_junit.cpp diff --git a/tests/auto/testlib/selftests/junit/tst_junit.cpp b/tests/auto/testlib/selftests/junit/tst_junit.cpp index f9d1edd92a..dfc55cc40d 100644 --- a/tests/auto/testlib/selftests/junit/tst_junit.cpp +++ b/tests/auto/testlib/selftests/junit/tst_junit.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/selftests/keyboard/CMakeLists.txt b/tests/auto/testlib/selftests/keyboard/CMakeLists.txt index 1e041e76b3..a1c1482e04 100644 --- a/tests/auto/testlib/selftests/keyboard/CMakeLists.txt +++ b/tests/auto/testlib/selftests/keyboard/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(keyboard NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_keyboard.cpp diff --git a/tests/auto/testlib/selftests/keyboard/tst_keyboard.cpp b/tests/auto/testlib/selftests/keyboard/tst_keyboard.cpp index 8ce15042db..1d6b8bb962 100644 --- a/tests/auto/testlib/selftests/keyboard/tst_keyboard.cpp +++ b/tests/auto/testlib/selftests/keyboard/tst_keyboard.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/qtest.h> #include <QtGui/qwindow.h> diff --git a/tests/auto/testlib/selftests/longstring/CMakeLists.txt b/tests/auto/testlib/selftests/longstring/CMakeLists.txt index 53debfee98..0528ef0255 100644 --- a/tests/auto/testlib/selftests/longstring/CMakeLists.txt +++ b/tests/auto/testlib/selftests/longstring/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(longstring NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_longstring.cpp diff --git a/tests/auto/testlib/selftests/longstring/tst_longstring.cpp b/tests/auto/testlib/selftests/longstring/tst_longstring.cpp index 7855c5c279..ce9d428831 100644 --- a/tests/auto/testlib/selftests/longstring/tst_longstring.cpp +++ b/tests/auto/testlib/selftests/longstring/tst_longstring.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/maxwarnings/CMakeLists.txt b/tests/auto/testlib/selftests/maxwarnings/CMakeLists.txt index b235cee398..e5f0070b79 100644 --- a/tests/auto/testlib/selftests/maxwarnings/CMakeLists.txt +++ b/tests/auto/testlib/selftests/maxwarnings/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(maxwarnings NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES maxwarnings.cpp diff --git a/tests/auto/testlib/selftests/maxwarnings/maxwarnings.cpp b/tests/auto/testlib/selftests/maxwarnings/maxwarnings.cpp index ff0fd2a196..5d47b058a7 100644 --- a/tests/auto/testlib/selftests/maxwarnings/maxwarnings.cpp +++ b/tests/auto/testlib/selftests/maxwarnings/maxwarnings.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/mouse/CMakeLists.txt b/tests/auto/testlib/selftests/mouse/CMakeLists.txt index 9c302a6868..9eb4aec2ce 100644 --- a/tests/auto/testlib/selftests/mouse/CMakeLists.txt +++ b/tests/auto/testlib/selftests/mouse/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(mouse NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_mouse.cpp diff --git a/tests/auto/testlib/selftests/mouse/tst_mouse.cpp b/tests/auto/testlib/selftests/mouse/tst_mouse.cpp index c9793da553..dd79add5f3 100644 --- a/tests/auto/testlib/selftests/mouse/tst_mouse.cpp +++ b/tests/auto/testlib/selftests/mouse/tst_mouse.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <QtGui/QWindow> diff --git a/tests/auto/testlib/selftests/multiexec/CMakeLists.txt b/tests/auto/testlib/selftests/multiexec/CMakeLists.txt index ccb68adfe0..ece9279856 100644 --- a/tests/auto/testlib/selftests/multiexec/CMakeLists.txt +++ b/tests/auto/testlib/selftests/multiexec/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(multiexec NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_multiexec.cpp diff --git a/tests/auto/testlib/selftests/multiexec/tst_multiexec.cpp b/tests/auto/testlib/selftests/multiexec/tst_multiexec.cpp index afcc62d8aa..be7c151d34 100644 --- a/tests/auto/testlib/selftests/multiexec/tst_multiexec.cpp +++ b/tests/auto/testlib/selftests/multiexec/tst_multiexec.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/selftests/pairdiagnostics/CMakeLists.txt b/tests/auto/testlib/selftests/pairdiagnostics/CMakeLists.txt index 7c364bc334..d0c9e6309a 100644 --- a/tests/auto/testlib/selftests/pairdiagnostics/CMakeLists.txt +++ b/tests/auto/testlib/selftests/pairdiagnostics/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(pairdiagnostics NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_pairdiagnostics.cpp diff --git a/tests/auto/testlib/selftests/pairdiagnostics/tst_pairdiagnostics.cpp b/tests/auto/testlib/selftests/pairdiagnostics/tst_pairdiagnostics.cpp index cd129ed86f..72cc4ab1f2 100644 --- a/tests/auto/testlib/selftests/pairdiagnostics/tst_pairdiagnostics.cpp +++ b/tests/auto/testlib/selftests/pairdiagnostics/tst_pairdiagnostics.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only // Make sure we get a real Q_ASSERT even in release builds #ifdef QT_NO_DEBUG diff --git a/tests/auto/testlib/selftests/pass/CMakeLists.txt b/tests/auto/testlib/selftests/pass/CMakeLists.txt index 74243ac54c..de3bfbc32a 100644 --- a/tests/auto/testlib/selftests/pass/CMakeLists.txt +++ b/tests/auto/testlib/selftests/pass/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(pass NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" SOURCES tst_pass.cpp diff --git a/tests/auto/testlib/selftests/pass/tst_pass.cpp b/tests/auto/testlib/selftests/pass/tst_pass.cpp index 48b75b2b17..760c5a236d 100644 --- a/tests/auto/testlib/selftests/pass/tst_pass.cpp +++ b/tests/auto/testlib/selftests/pass/tst_pass.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2020 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> #include <QTest> diff --git a/tests/auto/testlib/selftests/printdatatags/CMakeLists.txt b/tests/auto/testlib/selftests/printdatatags/CMakeLists.txt index 799620a6b2..4e2d58c35a 100644 --- a/tests/auto/testlib/selftests/printdatatags/CMakeLists.txt +++ b/tests/auto/testlib/selftests/printdatatags/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(printdatatags NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_printdatatags.cpp diff --git a/tests/auto/testlib/selftests/printdatatags/tst_printdatatags.cpp b/tests/auto/testlib/selftests/printdatatags/tst_printdatatags.cpp index c8f13dfca8..31cf97347e 100644 --- a/tests/auto/testlib/selftests/printdatatags/tst_printdatatags.cpp +++ b/tests/auto/testlib/selftests/printdatatags/tst_printdatatags.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/selftests/printdatatagswithglobaltags/CMakeLists.txt b/tests/auto/testlib/selftests/printdatatagswithglobaltags/CMakeLists.txt index 26b0a9ebc9..80d08a9d2d 100644 --- a/tests/auto/testlib/selftests/printdatatagswithglobaltags/CMakeLists.txt +++ b/tests/auto/testlib/selftests/printdatatagswithglobaltags/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(printdatatagswithglobaltags NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_printdatatagswithglobaltags.cpp diff --git a/tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp b/tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp index bb13f119fc..21e057cbb1 100644 --- a/tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp +++ b/tests/auto/testlib/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/selftests/qexecstringlist/CMakeLists.txt b/tests/auto/testlib/selftests/qexecstringlist/CMakeLists.txt index 09151063a0..91244ca25a 100644 --- a/tests/auto/testlib/selftests/qexecstringlist/CMakeLists.txt +++ b/tests/auto/testlib/selftests/qexecstringlist/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(qexecstringlist NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_qexecstringlist.cpp diff --git a/tests/auto/testlib/selftests/qexecstringlist/tst_qexecstringlist.cpp b/tests/auto/testlib/selftests/qexecstringlist/tst_qexecstringlist.cpp index 148ec593b1..fefb643041 100644 --- a/tests/auto/testlib/selftests/qexecstringlist/tst_qexecstringlist.cpp +++ b/tests/auto/testlib/selftests/qexecstringlist/tst_qexecstringlist.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/signaldumper/CMakeLists.txt b/tests/auto/testlib/selftests/signaldumper/CMakeLists.txt index 6d00fe8758..79ab8f8f86 100644 --- a/tests/auto/testlib/selftests/signaldumper/CMakeLists.txt +++ b/tests/auto/testlib/selftests/signaldumper/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(signaldumper NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_signaldumper.cpp diff --git a/tests/auto/testlib/selftests/signaldumper/tst_signaldumper.cpp b/tests/auto/testlib/selftests/signaldumper/tst_signaldumper.cpp index ee484b5c96..8b233abc1e 100644 --- a/tests/auto/testlib/selftests/signaldumper/tst_signaldumper.cpp +++ b/tests/auto/testlib/selftests/signaldumper/tst_signaldumper.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> #include <QTest> diff --git a/tests/auto/testlib/selftests/silent/CMakeLists.txt b/tests/auto/testlib/selftests/silent/CMakeLists.txt index e66d488363..76bb0d0110 100644 --- a/tests/auto/testlib/selftests/silent/CMakeLists.txt +++ b/tests/auto/testlib/selftests/silent/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(silent NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_silent.cpp diff --git a/tests/auto/testlib/selftests/silent/tst_silent.cpp b/tests/auto/testlib/selftests/silent/tst_silent.cpp index 3b2caf8c24..a1e7f7af57 100644 --- a/tests/auto/testlib/selftests/silent/tst_silent.cpp +++ b/tests/auto/testlib/selftests/silent/tst_silent.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> #include <QTest> @@ -15,8 +15,6 @@ private slots: void fail(); void xfail(); void xpass(); - - // This test function must be last, as it calls qFatal(). void messages(); }; @@ -47,17 +45,6 @@ void tst_Silent::xpass() QVERIFY2(true, "This test should XPASS"); } -#ifndef Q_OS_WIN -#include <signal.h> -#include <setjmp.h> - -static jmp_buf state; -static void abort_handler(int) -{ - longjmp(state, 1); -} -#endif - void tst_Silent::messages() { qWarning("This is a warning that should not appear in silent test output"); @@ -66,15 +53,6 @@ void tst_Silent::messages() qCritical("This is a critical message that should not appear in silent test output"); qInfo("This is an info message that should not appear in silent test output"); QTestLog::info("This is an internal testlib info message that should not appear in silent test output", __FILE__, __LINE__); - -#ifndef Q_OS_WIN - // We're testing qFatal, but we don't want to actually std::abort() ! - auto prior = signal(SIGABRT, abort_handler); - if (setjmp(state)) - signal(SIGABRT, prior); - else -#endif - qFatal("This is a fatal error message that should still appear in silent test output"); } QTEST_MAIN_WRAPPER(tst_Silent, diff --git a/tests/auto/testlib/selftests/silent_fatal/CMakeLists.txt b/tests/auto/testlib/selftests/silent_fatal/CMakeLists.txt new file mode 100644 index 0000000000..e4b59e399f --- /dev/null +++ b/tests/auto/testlib/selftests/silent_fatal/CMakeLists.txt @@ -0,0 +1,15 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_executable(silent_fatal + NO_INSTALL + EXCEPTIONS + OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + SOURCES + tst_silent_fatal.cpp + LIBRARIES + Qt::TestPrivate +) + +# No coverage because this crashes, making data collection difficult, if not +# impossible. diff --git a/tests/auto/testlib/selftests/silent_fatal/tst_silent_fatal.cpp b/tests/auto/testlib/selftests/silent_fatal/tst_silent_fatal.cpp new file mode 100644 index 0000000000..57aa1f702c --- /dev/null +++ b/tests/auto/testlib/selftests/silent_fatal/tst_silent_fatal.cpp @@ -0,0 +1,28 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QtCore/QCoreApplication> +#include <QTest> +#include <private/qtestlog_p.h> + +class tst_SilentFatal : public QObject +{ + Q_OBJECT + +private slots: + void fatalmessages(); +}; +void tst_SilentFatal::fatalmessages() +{ + qFatal("This is a fatal error message that should still appear in silent test output"); +} + +QTEST_MAIN_WRAPPER(tst_SilentFatal, + std::vector<const char*> args(argv, argv + argc); + args.push_back("-silent"); + args.push_back("-nocrashhandler"); + argc = int(args.size()); + argv = const_cast<char**>(&args[0]); + QTEST_MAIN_SETUP()) + +#include "tst_silent_fatal.moc" diff --git a/tests/auto/testlib/selftests/singleskip/CMakeLists.txt b/tests/auto/testlib/selftests/singleskip/CMakeLists.txt index 8973a47c8d..b37cc5fcc0 100644 --- a/tests/auto/testlib/selftests/singleskip/CMakeLists.txt +++ b/tests/auto/testlib/selftests/singleskip/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(singleskip NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_singleskip.cpp diff --git a/tests/auto/testlib/selftests/singleskip/tst_singleskip.cpp b/tests/auto/testlib/selftests/singleskip/tst_singleskip.cpp index a3ff4dd22c..c5307fed70 100644 --- a/tests/auto/testlib/selftests/singleskip/tst_singleskip.cpp +++ b/tests/auto/testlib/selftests/singleskip/tst_singleskip.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/skip/CMakeLists.txt b/tests/auto/testlib/selftests/skip/CMakeLists.txt index c6d0e23761..6fb38cc976 100644 --- a/tests/auto/testlib/selftests/skip/CMakeLists.txt +++ b/tests/auto/testlib/selftests/skip/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(skip NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_skip.cpp diff --git a/tests/auto/testlib/selftests/skip/tst_skip.cpp b/tests/auto/testlib/selftests/skip/tst_skip.cpp index 5ee014b0a4..709080049a 100644 --- a/tests/auto/testlib/selftests/skip/tst_skip.cpp +++ b/tests/auto/testlib/selftests/skip/tst_skip.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/skipblacklisted/BLACKLIST b/tests/auto/testlib/selftests/skipblacklisted/BLACKLIST new file mode 100644 index 0000000000..77c13250cd --- /dev/null +++ b/tests/auto/testlib/selftests/skipblacklisted/BLACKLIST @@ -0,0 +1,6 @@ +[blacklisted] +* +[blacklistedData:blacklisted 1] +* +[blacklistedData:blacklisted 2] +* diff --git a/tests/auto/testlib/selftests/skipblacklisted/CMakeLists.txt b/tests/auto/testlib/selftests/skipblacklisted/CMakeLists.txt new file mode 100644 index 0000000000..0cdcf2c063 --- /dev/null +++ b/tests/auto/testlib/selftests/skipblacklisted/CMakeLists.txt @@ -0,0 +1,20 @@ +# Copyright (C) 2024 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause +##################################################################### +## skipblacklisted Binary: +##################################################################### + +qt_internal_add_executable(skipblacklisted + NO_INSTALL + EXCEPTIONS + OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + SOURCES + tst_skipblacklisted.cpp + LIBRARIES + Qt::Test +) + +## Scopes: +##################################################################### + +qt_internal_apply_testlib_coverage_options(skipblacklisted) diff --git a/tests/auto/testlib/selftests/skipblacklisted/tst_skipblacklisted.cpp b/tests/auto/testlib/selftests/skipblacklisted/tst_skipblacklisted.cpp new file mode 100644 index 0000000000..4ebff3ee4b --- /dev/null +++ b/tests/auto/testlib/selftests/skipblacklisted/tst_skipblacklisted.cpp @@ -0,0 +1,51 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QTest> + +class tst_SkipBlacklisted : public QObject +{ + Q_OBJECT + +private slots: + void pass(); + void blacklisted(); + void blacklistedData(); + void blacklistedData_data(); +}; + +void tst_SkipBlacklisted::pass() +{ + QVERIFY(true); +} + +// This test have been blacklisted in skipblacklisted/BLACKLIST +void tst_SkipBlacklisted::blacklisted() +{ + QFAIL("this line should never be reached, since we skip all blacklisted test functions"); +} + +// blacklisted 1 and blacklisted 2 have been blacklisted in skipblacklisted/BLACKLIST +void tst_SkipBlacklisted::blacklistedData() +{ + QFETCH(int, testdata); + QCOMPARE(testdata, 2); +} + +void tst_SkipBlacklisted::blacklistedData_data() +{ + QTest::addColumn<int>("testdata"); + + QTest::newRow("blacklisted 1") << 1; + QTest::newRow("should pass") << 2; + QTest::newRow("blacklisted 2") << 3; +} + +QTEST_MAIN_WRAPPER(tst_SkipBlacklisted, + std::vector<const char*> args(argv, argv + argc); + args.push_back("-skipblacklisted"); + argc = int(args.size()); + argv = const_cast<char**>(&args[0]); + QTEST_MAIN_SETUP()) + +#include "tst_skipblacklisted.moc" diff --git a/tests/auto/testlib/selftests/skipcleanup/CMakeLists.txt b/tests/auto/testlib/selftests/skipcleanup/CMakeLists.txt index 28e2017f97..36a643bf4d 100644 --- a/tests/auto/testlib/selftests/skipcleanup/CMakeLists.txt +++ b/tests/auto/testlib/selftests/skipcleanup/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(skipcleanup NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_skipcleanup.cpp diff --git a/tests/auto/testlib/selftests/skipcleanup/tst_skipcleanup.cpp b/tests/auto/testlib/selftests/skipcleanup/tst_skipcleanup.cpp index 568609663a..68053e4431 100644 --- a/tests/auto/testlib/selftests/skipcleanup/tst_skipcleanup.cpp +++ b/tests/auto/testlib/selftests/skipcleanup/tst_skipcleanup.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/selftests/skipcleanuptestcase/CMakeLists.txt b/tests/auto/testlib/selftests/skipcleanuptestcase/CMakeLists.txt index 99c9699c1f..5c531b46b5 100644 --- a/tests/auto/testlib/selftests/skipcleanuptestcase/CMakeLists.txt +++ b/tests/auto/testlib/selftests/skipcleanuptestcase/CMakeLists.txt @@ -1,9 +1,12 @@ +# Copyright (C) 2024 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## skipcleanuptestcase Binary: ##################################################################### qt_internal_add_executable(skipcleanuptestcase NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_skipcleanuptestcase.cpp diff --git a/tests/auto/testlib/selftests/skipcleanuptestcase/tst_skipcleanuptestcase.cpp b/tests/auto/testlib/selftests/skipcleanuptestcase/tst_skipcleanuptestcase.cpp index 89be7ac8bf..72ff91590d 100644 --- a/tests/auto/testlib/selftests/skipcleanuptestcase/tst_skipcleanuptestcase.cpp +++ b/tests/auto/testlib/selftests/skipcleanuptestcase/tst_skipcleanuptestcase.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/selftests/skipinit/CMakeLists.txt b/tests/auto/testlib/selftests/skipinit/CMakeLists.txt index ce60b86117..69fa7e3d42 100644 --- a/tests/auto/testlib/selftests/skipinit/CMakeLists.txt +++ b/tests/auto/testlib/selftests/skipinit/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(skipinit NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_skipinit.cpp diff --git a/tests/auto/testlib/selftests/skipinit/tst_skipinit.cpp b/tests/auto/testlib/selftests/skipinit/tst_skipinit.cpp index 2781d52685..4975f1f029 100644 --- a/tests/auto/testlib/selftests/skipinit/tst_skipinit.cpp +++ b/tests/auto/testlib/selftests/skipinit/tst_skipinit.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/selftests/skipinitdata/CMakeLists.txt b/tests/auto/testlib/selftests/skipinitdata/CMakeLists.txt index 536681f682..482564c51f 100644 --- a/tests/auto/testlib/selftests/skipinitdata/CMakeLists.txt +++ b/tests/auto/testlib/selftests/skipinitdata/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(skipinitdata NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_skipinitdata.cpp diff --git a/tests/auto/testlib/selftests/skipinitdata/tst_skipinitdata.cpp b/tests/auto/testlib/selftests/skipinitdata/tst_skipinitdata.cpp index 95df690dc6..26725814db 100644 --- a/tests/auto/testlib/selftests/skipinitdata/tst_skipinitdata.cpp +++ b/tests/auto/testlib/selftests/skipinitdata/tst_skipinitdata.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/selftests/sleep/CMakeLists.txt b/tests/auto/testlib/selftests/sleep/CMakeLists.txt index c7d04abc89..2e789b59d7 100644 --- a/tests/auto/testlib/selftests/sleep/CMakeLists.txt +++ b/tests/auto/testlib/selftests/sleep/CMakeLists.txt @@ -7,11 +7,13 @@ qt_internal_add_executable(sleep NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_sleep.cpp LIBRARIES Qt::Test + Qt::CorePrivate ) ## Scopes: diff --git a/tests/auto/testlib/selftests/sleep/tst_sleep.cpp b/tests/auto/testlib/selftests/sleep/tst_sleep.cpp index ebefbf44d6..d9cd6959e5 100644 --- a/tests/auto/testlib/selftests/sleep/tst_sleep.cpp +++ b/tests/auto/testlib/selftests/sleep/tst_sleep.cpp @@ -1,11 +1,20 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> #include <QtCore/QElapsedTimer> #include <QTest> +#ifdef Q_OS_UNIX +#include <QtCore/private/qcore_unix_p.h> +#include <QtCore/qsystemdetection.h> + +#include <time.h> +#endif + +using namespace std::chrono_literals; + class tst_Sleep: public QObject { Q_OBJECT @@ -17,17 +26,21 @@ private slots: void tst_Sleep::sleep() { + // Subtracting 10ms as a margin for error + static constexpr auto MarginForError = 10ms; + QElapsedTimer t; t.start(); + // Test qSleep(int) overload, too QTest::qSleep(100); - QVERIFY(t.elapsed() > 90); + QCOMPARE_GT(t.durationElapsed(), 100ms - MarginForError); - QTest::qSleep(1000); - QVERIFY(t.elapsed() > 1000); + QTest::qSleep(1s); + QCOMPARE_GT(t.durationElapsed(), 1s - MarginForError); - QTest::qSleep(1000 * 10); // 10 seconds - QVERIFY(t.elapsed() > 1000 * 10); + QTest::qSleep(10s); + QCOMPARE_GT(t.durationElapsed(), 10s - MarginForError); } void tst_Sleep::wait() @@ -36,16 +49,16 @@ void tst_Sleep::wait() t.start(); QTest::qWait(1); - QVERIFY(t.elapsed() >= 1); + QCOMPARE_GE(t.durationElapsed(), 1ms); QTest::qWait(10); - QVERIFY(t.elapsed() >= 11); + QCOMPARE_GE(t.durationElapsed(), 11ms); QTest::qWait(100); - QVERIFY(t.elapsed() >= 111); + QCOMPARE_GE(t.durationElapsed(), 111ms); QTest::qWait(1000); - QVERIFY(t.elapsed() >= 1111); + QCOMPARE_GE(t.durationElapsed(), 1111ms); } QTEST_MAIN(tst_Sleep) diff --git a/tests/auto/testlib/selftests/strcmp/CMakeLists.txt b/tests/auto/testlib/selftests/strcmp/CMakeLists.txt index e6f7af6b94..8baaf92fa9 100644 --- a/tests/auto/testlib/selftests/strcmp/CMakeLists.txt +++ b/tests/auto/testlib/selftests/strcmp/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(strcmp NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_strcmp.cpp diff --git a/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp b/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp index 97e391b3fe..aefd9e08b9 100644 --- a/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp +++ b/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> diff --git a/tests/auto/testlib/selftests/subtest/CMakeLists.txt b/tests/auto/testlib/selftests/subtest/CMakeLists.txt index f43383c86a..3dad026cf3 100644 --- a/tests/auto/testlib/selftests/subtest/CMakeLists.txt +++ b/tests/auto/testlib/selftests/subtest/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(subtest NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_subtest.cpp diff --git a/tests/auto/testlib/selftests/subtest/tst_subtest.cpp b/tests/auto/testlib/selftests/subtest/tst_subtest.cpp index 86969bc590..023c43e2af 100644 --- a/tests/auto/testlib/selftests/subtest/tst_subtest.cpp +++ b/tests/auto/testlib/selftests/subtest/tst_subtest.cpp @@ -1,6 +1,8 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#undef QTEST_THROW_ON_FAILURE // code expects old behavior +#undef QTEST_THROW_ON_SKIP // code expects old behavior #include <QtCore/QCoreApplication> #include <QtCore/QDebug> @@ -111,6 +113,7 @@ void tst_Subtest::test3() void tst_Subtest::multiFail() { + const QTest::ThrowOnFailDisabler nothrow; // tests repeated QFAILs // Simulates tests which call a shared function that does common checks, or // that do checks in code run asynchronously from a message loop. for (int i = 0; i < 10; ++i) @@ -120,6 +123,7 @@ void tst_Subtest::multiFail() void tst_Subtest::multiSkip() { + const QTest::ThrowOnSkipDisabler nothrow; // tests repeated QSKIPs // Similar to multiFail() for (int i = 0; i < 10; ++i) []() { QSKIP("This skip should be repeated ten times"); }(); diff --git a/tests/auto/testlib/selftests/testlib/CMakeLists.txt b/tests/auto/testlib/selftests/testlib/CMakeLists.txt index d21d37605d..f60ddb8865 100644 --- a/tests/auto/testlib/selftests/testlib/CMakeLists.txt +++ b/tests/auto/testlib/selftests/testlib/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(testlib NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_testlib.cpp diff --git a/tests/auto/testlib/selftests/testlib/tst_testlib.cpp b/tests/auto/testlib/selftests/testlib/tst_testlib.cpp index 435c72d7ff..58e3e7ad33 100644 --- a/tests/auto/testlib/selftests/testlib/tst_testlib.cpp +++ b/tests/auto/testlib/selftests/testlib/tst_testlib.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <QtCore/QtMath> diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 2265fe3147..04185e95cd 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2021 The Qt Company Ltd. // Copyright (C) 2016 Intel Corporation. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtCore/QCoreApplication> @@ -699,7 +699,8 @@ bool TestLogger::shouldIgnoreTest(const QString &test) const || test == "benchliboptions" || test == "printdatatags" || test == "printdatatagswithglobaltags" - || test == "silent") + || test == "silent" + || test == "silent_fatal") return true; // These tests produce variable output (callgrind because of #if-ery, @@ -764,29 +765,30 @@ void checkErrorOutput(const QString &test, const QByteArray &errorOutput) || test == "benchlibcallgrind") return; -#ifdef Q_CC_MINGW - if (test == "blacklisted" // calls qFatal() - || test == "silent") // calls qFatal() -#endif - return; - #ifdef Q_OS_WIN if (test == "crashes") return; // Complains about uncaught exception #endif -#ifdef Q_OS_LINUX - // QEMU outputs to stderr about uncaught signals - if (QTestPrivate::isRunningArmOnX86() && - (test == "assert" - || test == "blacklisted" - || test == "crashes" - || test == "faildatatype" - || test == "failfetchtype" - || test == "silent" - )) +#ifdef Q_OS_UNIX + if (test == "assert" + || test == "crashes" + || test == "failfetchtype" + || test == "faildatatype") + return; // Outputs "Received signal 6 (SIGABRT)" +#endif + + if (test == "silent_fatal") { +#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer) + // Under ASan, this test is not silent + return; +#elif defined(Q_CC_MINGW) + // Originally QTBUG-29014 (I can't reproduce this -Thiago) return; #endif + if (QTestPrivate::isRunningArmOnX86()) + return; // QEMU outputs to stderr about uncaught signals + } INFO(errorOutput.toStdString()); REQUIRE(errorOutput.isEmpty()); @@ -926,8 +928,11 @@ static QProcessEnvironment testEnvironment() if (environment.isEmpty()) { const QProcessEnvironment systemEnvironment = QProcessEnvironment::systemEnvironment(); const bool preserveLibPath = qEnvironmentVariableIsSet("QT_PRESERVE_TESTLIB_PATH"); - foreach (const QString &key, systemEnvironment.keys()) { + const auto envKeys = systemEnvironment.keys(); + for (const QString &key : envKeys) { const bool useVariable = key == "PATH" || key == "QT_QPA_PLATFORM" + || key == "QTEST_THROW_ON_FAIL"_L1 || key == "QTEST_THROW_ON_SKIP"_L1 + || key == "ASAN_OPTIONS" #if defined(Q_OS_QNX) || key == "GRAPHICS_ROOT" || key == "TZ" #elif defined(Q_OS_UNIX) @@ -972,8 +977,7 @@ TestProcessResult runTestProcess(const QString &test, const QStringList &argumen const bool expectedCrash = test == "assert" || test == "exceptionthrow" || test == "fetchbogus" || test == "crashedterminate" || test == "faildatatype" || test == "failfetchtype" - || test == "crashes" || test == "silent" - || test == "blacklisted" || test == "watchdog"; + || test == "crashes" || test == "silent_fatal" || test == "watchdog"; if (expectedCrash) { environment.insert("QTEST_DISABLE_CORE_DUMP", "1"); @@ -1010,10 +1014,12 @@ TestProcessResult runTestProcess(const QString &test, const QStringList &argumen return { process.exitCode(), standardOutput, standardError }; } +enum class Throw { OnFail = 1 }; + /* Runs a single test and verifies the output against the expected results. */ -void runTest(const QString &test, const TestLoggers &requestedLoggers) +void runTest(const QString &test, const TestLoggers &requestedLoggers, Throw throwing = {}) { TestLoggers loggers; for (auto logger : requestedLoggers) { @@ -1027,6 +1033,10 @@ void runTest(const QString &test, const TestLoggers &requestedLoggers) QStringList arguments; for (auto logger : loggers) arguments += logger.arguments(test); + if (throwing == Throw::OnFail) // don't distinguish between throwonfail/throwonskip + arguments += {"-throwonfail", "-throwonskip"}; + else + arguments += {"-nothrowonfail", "-nothrowonskip"}; CAPTURE(test); CAPTURE(arguments); @@ -1053,9 +1063,9 @@ void runTest(const QString &test, const TestLoggers &requestedLoggers) /* Runs a single test and verifies the output against the expected result. */ -void runTest(const QString &test, const TestLogger &logger) +void runTest(const QString &test, const TestLogger &logger, Throw t = {}) { - runTest(test, TestLoggers{logger}); + runTest(test, TestLoggers{logger}, t); } // ----------------------- Catch helpers ----------------------- @@ -1190,13 +1200,20 @@ TEST_CASE("All loggers can be enabled at the same time") SCENARIO("Test output of the loggers is as expected") { static QStringList tests = QString(QT_STRINGIFY(SUBPROGRAMS)).split(' '); + if (QString override = qEnvironmentVariable("TST_SELFTEST_SUBPROGRAMS"); !override.isEmpty()) + tests = override.split(' ', Qt::SkipEmptyParts); auto logger = GENERATE(filter(isGenericCommandLineLogger, enums<QTestLog::LogMode>())); GIVEN("The " << logger << " logger") { for (QString test : tests) { AND_GIVEN("The " << test << " subtest") { - runTest(test, TestLogger(logger, StdoutOutput)); + WHEN("Throwing on failure or skip") { + runTest(test, TestLogger(logger, StdoutOutput), Throw::OnFail); + } + WHEN("Returning on failure or skip") { + runTest(test, TestLogger(logger, StdoutOutput)); + } } } } @@ -1228,6 +1245,7 @@ SCENARIO("Exit code is as expected") { 0, "globaldata testGlobal:global=true" }, { 0, "globaldata testGlobal:local=true" }, { 0, "globaldata testGlobal:global=true:local=true" }, + { 0, "globaldata testGlobal -repeat 2" }, { 1, "globaldata testGlobal:local=true:global=true" }, { 1, "globaldata testGlobal:global=true:blah" }, { 1, "globaldata testGlobal:blah:local=true" }, @@ -1239,6 +1257,15 @@ SCENARIO("Exit code is as expected") { 1, "globaldata testGlobal:blah skipSingle:global=true:local=true" }, { 1, "globaldata testGlobal:global=true skipSingle:blah" }, { 2, "globaldata testGlobal:blah skipSingle:blue" }, + // Passing -repeat argument + { 1, "pass testNumber1 -repeat" }, + { 0, "pass testNumber1 -repeat 1" }, + { 0, "pass testNumber1 -repeat 1 -o out.xml,xml" }, + { 0, "pass testNumber1 -repeat 2" }, + { 0, "pass testNumber1 -repeat 2 -o -,txt" }, + { 0, "pass testNumber1 -repeat 2 -o -,txt -o log.txt,txt" }, + { 1, "pass testNumber1 -repeat 2 -o log.xml,xml" }, + { 1, "pass testNumber1 -repeat 2 -o -,txt -o -,xml" }, }; size_t n_testCases = sizeof(testCases) / sizeof(*testCases); diff --git a/tests/auto/testlib/selftests/tuplediagnostics/CMakeLists.txt b/tests/auto/testlib/selftests/tuplediagnostics/CMakeLists.txt index fef8bfddfe..b79e2407b8 100644 --- a/tests/auto/testlib/selftests/tuplediagnostics/CMakeLists.txt +++ b/tests/auto/testlib/selftests/tuplediagnostics/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(tuplediagnostics NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_tuplediagnostics.cpp diff --git a/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp b/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp index b30b54848a..065fe6c603 100644 --- a/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp +++ b/tests/auto/testlib/selftests/tuplediagnostics/tst_tuplediagnostics.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2017 Samuel Gaist <samuel.gaist@edeltech.ch> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only // Make sure we get a real Q_ASSERT even in release builds #ifdef QT_NO_DEBUG diff --git a/tests/auto/testlib/selftests/verbose1/CMakeLists.txt b/tests/auto/testlib/selftests/verbose1/CMakeLists.txt index 872f28ddc7..2c644dff92 100644 --- a/tests/auto/testlib/selftests/verbose1/CMakeLists.txt +++ b/tests/auto/testlib/selftests/verbose1/CMakeLists.txt @@ -7,11 +7,12 @@ qt_internal_add_executable(verbose1 NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES ../counting/tst_counting.cpp DEFINES - TESTLIB_VERBOSITY_ARG=-v1 # special case remove quotes + TESTLIB_VERBOSITY_ARG=-v1 LIBRARIES Qt::Test ) diff --git a/tests/auto/testlib/selftests/verbose2/CMakeLists.txt b/tests/auto/testlib/selftests/verbose2/CMakeLists.txt index 56ec453695..b78c5a42d0 100644 --- a/tests/auto/testlib/selftests/verbose2/CMakeLists.txt +++ b/tests/auto/testlib/selftests/verbose2/CMakeLists.txt @@ -7,11 +7,12 @@ qt_internal_add_executable(verbose2 NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES ../counting/tst_counting.cpp DEFINES - TESTLIB_VERBOSITY_ARG=-v2 # special case remove quotes + TESTLIB_VERBOSITY_ARG=-v2 LIBRARIES Qt::Test ) diff --git a/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp b/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp index 60ac6a16a9..a7b45f30f9 100644 --- a/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp +++ b/tests/auto/testlib/selftests/verifyexceptionthrown/tst_verifyexceptionthrown.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/testlib/selftests/warnings/CMakeLists.txt b/tests/auto/testlib/selftests/warnings/CMakeLists.txt index 12ccea5f5b..553a023a90 100644 --- a/tests/auto/testlib/selftests/warnings/CMakeLists.txt +++ b/tests/auto/testlib/selftests/warnings/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(warnings NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_warnings.cpp diff --git a/tests/auto/testlib/selftests/warnings/tst_warnings.cpp b/tests/auto/testlib/selftests/warnings/tst_warnings.cpp index c113fdaf25..5add39ac88 100644 --- a/tests/auto/testlib/selftests/warnings/tst_warnings.cpp +++ b/tests/auto/testlib/selftests/warnings/tst_warnings.cpp @@ -1,6 +1,7 @@ // Copyright (C) 2020 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#undef QTEST_THROW_ON_FAILURE // fails ### investigate #include <QtCore/QCoreApplication> #include <QtCore/QRegularExpression> @@ -27,6 +28,7 @@ private slots: void testFailOnWarningsThenSkip(); #endif void testFailOnWarningsAndIgnoreWarnings(); + void testFailOnTemporaryObjectDestruction(); }; void tst_Warnings::testWarnings() @@ -182,6 +184,7 @@ void tst_Warnings::testFailOnWarningsWithData() void tst_Warnings::testFailOnWarningsFailInHelper() { + const QTest::ThrowOnFailDisabler nothrow; // tests repeated QFAILs [](){ QFAIL("This failure message should be printed but not cause the test to abort"); }(); // So we've already failed, but we get more messages - that don't increment counters. const auto warnRegex = QRegularExpression("Ran out of .*!"); @@ -208,6 +211,27 @@ void tst_Warnings::testFailOnWarningsAndIgnoreWarnings() qWarning(warningStr); } +void tst_Warnings::testFailOnTemporaryObjectDestruction() +{ + QTest::failOnWarning("Running low on toothpaste!"); + QTest::ignoreMessage(QtWarningMsg, "Ran out of cabbage!"); + + class TestObject : public QObject + { + public: + ~TestObject() + { + // Shouldn't fail - ignored + qWarning("Ran out of cabbage!"); + // Should fail + qWarning("Running low on toothpaste!"); + } + }; + + QScopedPointer<TestObject, QScopedPointerDeleteLater> testObject(new TestObject); + QVERIFY(testObject); +} + QTEST_MAIN(tst_Warnings) #include "tst_warnings.moc" diff --git a/tests/auto/testlib/selftests/watchdog/CMakeLists.txt b/tests/auto/testlib/selftests/watchdog/CMakeLists.txt index 44332c52ae..21beab6454 100644 --- a/tests/auto/testlib/selftests/watchdog/CMakeLists.txt +++ b/tests/auto/testlib/selftests/watchdog/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(watchdog NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_watchdog.cpp diff --git a/tests/auto/testlib/selftests/watchdog/tst_watchdog.cpp b/tests/auto/testlib/selftests/watchdog/tst_watchdog.cpp index dc5cde236b..2bc8853e00 100644 --- a/tests/auto/testlib/selftests/watchdog/tst_watchdog.cpp +++ b/tests/auto/testlib/selftests/watchdog/tst_watchdog.cpp @@ -1,8 +1,10 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> +using namespace std::chrono_literals; + class tst_Watchdog : public QObject { Q_OBJECT @@ -13,10 +15,9 @@ private slots: void tst_Watchdog::delay() const { bool ok = false; - const int fiveMinutes = 5 * 60 * 1000; // Use the same env.var as the watch-dog and add a little to it: const int timeout = qEnvironmentVariableIntValue("QTEST_FUNCTION_TIMEOUT", &ok); - QTest::qSleep(5000 + (ok && timeout > 0 ? timeout : fiveMinutes)); + QTest::qSleep(5s + (ok && timeout > 0 ? timeout * 1ms : 5min)); // The watchdog timer should have interrupted us by now. QFAIL("ERROR: this function should be interrupted."); } diff --git a/tests/auto/testlib/tostring/CMakeLists.txt b/tests/auto/testlib/tostring/CMakeLists.txt new file mode 100644 index 0000000000..cb0bdff847 --- /dev/null +++ b/tests/auto/testlib/tostring/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (C) 2023 Intel Corporation. +# SPDX-License-Identifier: BSD-3-Clause + +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_tostring LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + +qt_internal_add_test(tst_tostring + SOURCES + tst_tostring.cpp +) diff --git a/tests/auto/testlib/tostring/tst_tostring.cpp b/tests/auto/testlib/tostring/tst_tostring.cpp new file mode 100644 index 0000000000..8d3c59f257 --- /dev/null +++ b/tests/auto/testlib/tostring/tst_tostring.cpp @@ -0,0 +1,215 @@ +// Copyright (C) 2023 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QTest> + +#include <QtCore/qtypes.h> + +#include <memory> + +#include <q20chrono.h> + +using ToStringFunction = std::function<char *()>; +class tst_toString : public QObject +{ + Q_OBJECT +private: + void addColumns(); + void testRows(); +private slots: + void int128(); + + void chrono_duration_data(); + void chrono_duration() { testRows(); } +}; + +void tst_toString::addColumns() +{ + QTest::addColumn<ToStringFunction>("fn"); + QTest::addColumn<QByteArray>("expected"); + QTest::addColumn<QByteArrayView>("expr"); + QTest::addColumn<QByteArrayView>("file"); + QTest::addColumn<int>("line"); +} + +void tst_toString::testRows() +{ + QFETCH(ToStringFunction, fn); + QFETCH(const QByteArray, expected); + QFETCH(QByteArrayView, expr); + QFETCH(QByteArrayView, file); + QFETCH(int, line); + + std::unique_ptr<char []> ptr{fn()}; + const auto len = qstrlen(ptr.get()); + QTest::qCompare(ptr.get(), expected, expr.data(), expected.data(), file.data(), line); + if (QTest::currentTestFailed()) { + qDebug("tail diff:\n" + " actual:%s\n" + " expected:%s", + ptr.get() + len - std::min(size_t{40}, len), + expected.data() + expected.size() - std::min(qsizetype{40}, expected.size())); + } +} + +template <typename T> void addRow(QByteArrayView name, T &&value, QByteArrayView expression, + const QByteArray &expected, QByteArrayView file, int line) +{ + ToStringFunction fn = [v = std::move(value)]() { return QTest::toString(v); }; + QTest::newRow(name.data()) << fn << expected << expression << file << line; +} + +#define ADD_ROW(name, expr, expected) \ + ::addRow(name, expr, #expr, expected, __FILE__, __LINE__) + +void tst_toString::int128() +{ +#ifndef QT_SUPPORTS_INT128 + QSKIP("This test requires int128 support enabled in the compiler."); +#else + // ### port to data-driven once QVariant has support for qint128/quint128 + std::unique_ptr<char[]> s; + + { + // build Q_INT128_MIN without using Q_INT128_ macros, + // because we use Q_INT128_MIN in the impl + qint128 accu = 1701411834604692317LL; + accu *= 1000000000000000000LL; + accu += 316873037158841057LL; + accu *= -100; + accu -= 28; + QCOMPARE_EQ(accu, Q_INT128_MIN); + s.reset(QTest::toString(accu)); + QCOMPARE(s.get(), "-170141183460469231731687303715884105728"); + } + + // now test with the macro, too: + s.reset(QTest::toString(Q_INT128_MIN)); + QCOMPARE(s.get(), "-170141183460469231731687303715884105728"); + + s.reset(QTest::toString(Q_INT128_MIN + 1)); + QCOMPARE(s.get(), "-170141183460469231731687303715884105727"); + + s.reset(QTest::toString(Q_INT128_MAX)); + QCOMPARE(s.get(), "170141183460469231731687303715884105727"); + + s.reset(QTest::toString(Q_INT128_MAX - 1)); + QCOMPARE(s.get(), "170141183460469231731687303715884105726"); + + s.reset(QTest::toString(Q_UINT128_MAX)); + QCOMPARE(s.get(), "340282366920938463463374607431768211455"); + + s.reset(QTest::toString(Q_UINT128_MAX - 1)); + QCOMPARE(s.get(), "340282366920938463463374607431768211454"); + + s.reset(QTest::toString(quint128{0})); + QCOMPARE(s.get(), "0"); + + s.reset(QTest::toString(qint128{0})); + QCOMPARE(s.get(), "0"); + + s.reset(QTest::toString(qint128{-1})); + QCOMPARE(s.get(), "-1"); +#endif // QT_SUPPORTS_INT128 +} + +void tst_toString::chrono_duration_data() +{ + addColumns(); + + using namespace std::chrono; + using namespace q20::chrono; + + using attoseconds = duration<int64_t, std::atto>; + using femtoseconds = duration<int64_t, std::femto>; + using picoseconds = duration<int64_t, std::pico>; + using centiseconds = duration<int64_t, std::centi>; + using deciseconds = duration<int64_t, std::deci>; + using kiloseconds = duration<int64_t, std::kilo>; + using decades = duration<int, std::ratio_multiply<years::period, std::deca>>; // decayears + using centuries = duration<int16_t, std::ratio_multiply<years::period, std::hecto>>; // hectoyears + using millennia = duration<int16_t, std::ratio_multiply<years::period, std::kilo>>; // kiloyears + using gigayears [[maybe_unused]] = duration<int8_t, std::ratio_multiply<years::period, std::giga>>; + using fortnights = duration<int, std::ratio_multiply<days::period, std::ratio<14>>>; + using microfortnights = duration<int64_t, std::ratio_multiply<fortnights::period, std::micro>>; + using meter_per_light = duration<int64_t, std::ratio<1, 299'792'458>>; + using kilometer_per_light = duration<int64_t, std::ratio<1000, 299'792'458>>; + using AU_per_light = duration<int64_t, std::ratio<149'597'871'800, 299'792'458>>; + using pstn_rate = duration<int64_t, std::ratio<1, 8000>>; // PSTN sampling rate (8 kHz) + using hyperfine = duration<int64_t, std::ratio<1, 9'192'631'770>>; // definition of second + + ADD_ROW("1as", attoseconds{1}, "1as (1e-18s)"); // from Norwegian "atten" (18) + ADD_ROW("1fs", femtoseconds{1}, "1fs (1e-15s)"); // from Norwegian "femten" (15) + ADD_ROW("1ps", picoseconds{1}, "1ps (1e-12s)"); // from Italian piccolo? + ADD_ROW("0ns", 0ns, "0ns (0s)"); + ADD_ROW("1000ns", 1000ns, "1000ns (1e-06s)"); + ADD_ROW("1us", 1us, "1us (1e-06s)"); + ADD_ROW("125us", 125us, "125us (0.000125s)"); + ADD_ROW("0ms", 0ms, "0ms (0s)"); + ADD_ROW("-1s", -1s, "-1s"); + ADD_ROW("0s", 0s, "0s"); + ADD_ROW("1cs", centiseconds{1}, "1cs (0.01s)"); + ADD_ROW("2ds", deciseconds{2}, "2ds (0.2s)"); + ADD_ROW("1s", 1s, "1s"); + ADD_ROW("60s", 60s, "60s"); + ADD_ROW("1min", 1min, "1min (60s)"); + ADD_ROW("1h", 1h, "1h (3600s)"); + ADD_ROW("1days", days{1}, "1d (86400s)"); + ADD_ROW("7days", days{7}, "7d (604800s)"); + ADD_ROW("1weeks", weeks{1}, "1wk (604800s)"); + ADD_ROW("365days", days{365}, "365d (31536000s)"); + ADD_ROW("1years", years{1}, "1yr (31556952s)"); // 365.2425 days + + ADD_ROW("2ks", kiloseconds{2}, "2[1000]s (2000s)"); + ADD_ROW("1fortnights", fortnights{1}, "1[2]wk (1209600s)"); + ADD_ROW("1decades", decades{1}, "1[10]yr (315569520s)"); + ADD_ROW("1centuries", centuries{1}, "1[100]yr (3.1556952e+09s)"); + ADD_ROW("1millennia", millennia{1}, "1[1000]yr (3.1556952e+10s)"); +#if defined(Q_OS_LINUX) || defined(Q_OS_DARWIN) + // some OSes print the exponent differently + ADD_ROW("13gigayears", gigayears{13}, "13[1e+09]yr (4.10240376e+17s)"); +#endif + + // months are one twelfth of a Gregorian year, not 30 days + ADD_ROW("1months", months{1}, "1[2629746]s (2629746s)"); + ADD_ROW("12months", months{12}, "12[2629746]s (31556952s)"); + + // weird units + ADD_ROW("2microfortnights", microfortnights{2}, "2[756/625]s (2.4192s)"); + ADD_ROW("1pstn_rate", pstn_rate{1}, "1[1/8000]s (0.000125s)"); // 125µs + ADD_ROW("10m/c", meter_per_light{10}, "10[1/299792458]s (3.33564095e-08s)"); + ADD_ROW("10km/c", kilometer_per_light{10}, "10[500/149896229]s (3.33564095e-05s)"); + ADD_ROW("1AU/c", AU_per_light{1}, "1[74798935900/149896229]s (499.004788s)"); + ADD_ROW("Cs133-hyperfine", hyperfine{1}, "1[1/9192631770]s (1.08782776e-10s)"); + ADD_ROW("1sec-definition", hyperfine{9'192'631'770}, "9192631770[1/9192631770]s (1s)"); + ADD_ROW("8000pstn_rate", pstn_rate{8000}, "8000[1/8000]s (1s)"); + + // real floting point + // current (2023) best estimate is 13.813 ± 0.038 billion years (Plank Collaboration) + using universe [[maybe_unused]] = duration<double, std::ratio_multiply<std::ratio<13'813'000'000>, years::period>>; + using fpksec = duration<double, std::kilo>; + using fpsec = duration<double>; + using fpmsec = duration<double, std::milli>; + using fpnsec = duration<double, std::nano>; + using fpGyr [[maybe_unused]] = duration<double, std::ratio_multiply<years::period, std::giga>>; + + ADD_ROW("1.0s", fpsec{1}, "1s"); + ADD_ROW("1.5s", fpsec{1.5}, "1.5s"); + ADD_ROW("-1.0ms", fpmsec{-1}, "-1ms (-0.001s)"); + ADD_ROW("1.5ms", fpmsec{1.5}, "1.5ms (0.0015s)"); + ADD_ROW("1.0ns", fpnsec{1}, "1ns (1e-09s)"); + ADD_ROW("-1.5ns", fpnsec{-1.5}, "-1.5ns (-1.5e-09s)"); + ADD_ROW("1.0ks", fpksec{1}, "1[1000]s (1000s)"); + ADD_ROW("-1.5ks", fpksec{-1.5}, "-1.5[1000]s (-1500s)"); + ADD_ROW("1.0zs", fpsec{1e-21}, "1e-21s"); // zeptosecond + ADD_ROW("1.0ys", fpsec{1e-24}, "1e-24s"); // yoctosecond + ADD_ROW("planck-time", fpsec(5.39124760e-44), "5.3912476e-44s"); +#if defined(Q_OS_LINUX) || defined(Q_OS_DARWIN) + // some OSes print the exponent differently + ADD_ROW("13.813Gyr", fpGyr(13.813), "13.813[1e+09]yr (4.35896178e+17s)"); + ADD_ROW("1universe", universe{1}, "1[1.3813e+10]yr (4.35896178e+17s)"); +#endif +} + +QTEST_APPLESS_MAIN(tst_toString) +#include "tst_tostring.moc" |