diff options
Diffstat (limited to 'tests/auto/dbus/qdbusservicewatcher')
-rw-r--r-- | tests/auto/dbus/qdbusservicewatcher/CMakeLists.txt | 10 | ||||
-rw-r--r-- | tests/auto/dbus/qdbusservicewatcher/tst_qdbusservicewatcher.cpp | 58 |
2 files changed, 36 insertions, 32 deletions
diff --git a/tests/auto/dbus/qdbusservicewatcher/CMakeLists.txt b/tests/auto/dbus/qdbusservicewatcher/CMakeLists.txt index 9abfb76d3b..48144cd353 100644 --- a/tests/auto/dbus/qdbusservicewatcher/CMakeLists.txt +++ b/tests/auto/dbus/qdbusservicewatcher/CMakeLists.txt @@ -1,12 +1,16 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -# Generated from qdbusservicewatcher.pro. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## tst_qdbusservicewatcher Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qdbusservicewatcher LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qdbusservicewatcher SOURCES tst_qdbusservicewatcher.cpp diff --git a/tests/auto/dbus/qdbusservicewatcher/tst_qdbusservicewatcher.cpp b/tests/auto/dbus/qdbusservicewatcher/tst_qdbusservicewatcher.cpp index 6c80334a5c..741c50217f 100644 --- a/tests/auto/dbus/qdbusservicewatcher/tst_qdbusservicewatcher.cpp +++ b/tests/auto/dbus/qdbusservicewatcher/tst_qdbusservicewatcher.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2016 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 <QTest> #include <QtTest/private/qpropertytesthelper_p.h> @@ -99,12 +99,12 @@ void tst_QDBusServiceWatcher::watchForCreation() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.size(), 1); QCOMPARE(spyR.at(0).at(0).toString(), registeredName); - QCOMPARE(spyU.count(), 0); + QCOMPARE(spyU.size(), 0); - QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.size(), 1); QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QVERIFY(spyO.at(0).at(1).toString().isEmpty()); QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); @@ -122,12 +122,12 @@ void tst_QDBusServiceWatcher::watchForCreation() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.size(), 1); QCOMPARE(spyR.at(0).at(0).toString(), registeredName); - QCOMPARE(spyU.count(), 0); + QCOMPARE(spyU.size(), 0); - QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.size(), 1); QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QVERIFY(spyO.at(0).at(1).toString().isEmpty()); QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); @@ -163,12 +163,12 @@ void tst_QDBusServiceWatcher::watchForDisappearance() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 0); + QCOMPARE(spyR.size(), 0); - QCOMPARE(spyU.count(), 1); + QCOMPARE(spyU.size(), 1); QCOMPARE(spyU.at(0).at(0).toString(), registeredName); - QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.size(), 1); QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QCOMPARE(spyO.at(0).at(1).toString(), con.baseService()); QVERIFY(spyO.at(0).at(2).toString().isEmpty()); @@ -197,12 +197,12 @@ void tst_QDBusServiceWatcher::watchForDisappearanceUniqueConnection() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 0); + QCOMPARE(spyR.size(), 0); - QCOMPARE(spyU.count(), 1); + QCOMPARE(spyU.size(), 1); QCOMPARE(spyU.at(0).at(0).toString(), watchedName); - QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.size(), 1); QCOMPARE(spyO.at(0).at(0).toString(), watchedName); QCOMPARE(spyO.at(0).at(1).toString(), watchedName); QVERIFY(spyO.at(0).at(2).toString().isEmpty()); @@ -234,12 +234,12 @@ void tst_QDBusServiceWatcher::watchForOwnerChange() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.size(), 1); QCOMPARE(spyR.at(0).at(0).toString(), registeredName); - QCOMPARE(spyU.count(), 0); + QCOMPARE(spyU.size(), 0); - QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.size(), 1); QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QVERIFY(spyO.at(0).at(1).toString().isEmpty()); QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); @@ -257,13 +257,13 @@ void tst_QDBusServiceWatcher::watchForOwnerChange() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.size(), 1); QCOMPARE(spyR.at(0).at(0).toString(), registeredName); - QCOMPARE(spyU.count(), 1); + QCOMPARE(spyU.size(), 1); QCOMPARE(spyU.at(0).at(0).toString(), registeredName); - QCOMPARE(spyO.count(), 2); + QCOMPARE(spyO.size(), 2); QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QCOMPARE(spyO.at(0).at(1).toString(), con.baseService()); QVERIFY(spyO.at(0).at(2).toString().isEmpty()); @@ -298,12 +298,12 @@ void tst_QDBusServiceWatcher::modeChange() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.size(), 1); QCOMPARE(spyR.at(0).at(0).toString(), registeredName); - QCOMPARE(spyU.count(), 0); + QCOMPARE(spyU.size(), 0); - QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.size(), 1); QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QVERIFY(spyO.at(0).at(1).toString().isEmpty()); QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); @@ -321,12 +321,12 @@ void tst_QDBusServiceWatcher::modeChange() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 0); + QCOMPARE(spyR.size(), 0); - QCOMPARE(spyU.count(), 1); + QCOMPARE(spyU.size(), 1); QCOMPARE(spyU.at(0).at(0).toString(), registeredName); - QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.size(), 1); QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QCOMPARE(spyO.at(0).at(1).toString(), con.baseService()); QVERIFY(spyO.at(0).at(2).toString().isEmpty()); @@ -377,9 +377,9 @@ void tst_QDBusServiceWatcher::setConnection() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.size(), 1); QCOMPARE(spyR.at(0).at(0).toString(), serviceName); - QCOMPARE(spyU.count(), 0); + QCOMPARE(spyU.size(), 0); // is the system bus available? if (!QDBusConnection::systemBus().isConnected()) @@ -400,9 +400,9 @@ void tst_QDBusServiceWatcher::setConnection() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 0); + QCOMPARE(spyR.size(), 0); - QCOMPARE(spyU.count(), 1); + QCOMPARE(spyU.size(), 1); QCOMPARE(spyU.at(0).at(0).toString(), watchedName); } |