diff options
Diffstat (limited to 'tests/auto/dbus/qdbusabstractinterface')
14 files changed, 57 insertions, 207 deletions
diff --git a/tests/auto/dbus/qdbusabstractinterface/.prev_CMakeLists.txt b/tests/auto/dbus/qdbusabstractinterface/.prev_CMakeLists.txt deleted file mode 100644 index 111012aba9..0000000000 --- a/tests/auto/dbus/qdbusabstractinterface/.prev_CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Generated from qdbusabstractinterface.pro. - -add_subdirectory(qpinger) -add_subdirectory(qdbusabstractinterface) diff --git a/tests/auto/dbus/qdbusabstractinterface/CMakeLists.txt b/tests/auto/dbus/qdbusabstractinterface/CMakeLists.txt index ec49268777..4010ae5682 100644 --- a/tests/auto/dbus/qdbusabstractinterface/CMakeLists.txt +++ b/tests/auto/dbus/qdbusabstractinterface/CMakeLists.txt @@ -1,9 +1,13 @@ -# Generated from qdbusabstractinterface.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause -add_subdirectory(qpinger) +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qdbusabstractinterface LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() -# special case begin -qt_add_test(tst_qdbusabstractinterface +qt_internal_add_test(tst_qdbusabstractinterface SOURCES interface.cpp tst_qdbusabstractinterface.cpp @@ -12,7 +16,7 @@ qt_add_test(tst_qdbusabstractinterface Qt::DBus ) -qt_extend_target(tst_qdbusabstractinterface +qt_internal_extend_target(tst_qdbusabstractinterface DBUS_INTERFACE_SOURCES org.qtproject.QtDBus.Pinger.xml DBUS_INTERFACE_BASENAME @@ -21,4 +25,5 @@ qt_extend_target(tst_qdbusabstractinterface -i interface.h ) -# special case end +add_subdirectory(qpinger) +add_dependencies(tst_qdbusabstractinterface qpinger) diff --git a/tests/auto/dbus/qdbusabstractinterface/interface.cpp b/tests/auto/dbus/qdbusabstractinterface/interface.cpp index ef1ff74734..1226e5bb49 100644 --- a/tests/auto/dbus/qdbusabstractinterface/interface.cpp +++ b/tests/auto/dbus/qdbusabstractinterface/interface.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "interface.h" #include <QThread> @@ -33,16 +8,9 @@ Interface::Interface() { } -// Export the sleep function -// TODO QT5: remove this class, QThread::msleep is now public -class FriendlySleepyThread : public QThread { -public: - using QThread::msleep; -}; - int Interface::sleepMethod(int msec) { - FriendlySleepyThread::msleep(msec); + QThread::sleep(std::chrono::milliseconds{msec}); return 42; } diff --git a/tests/auto/dbus/qdbusabstractinterface/interface.h b/tests/auto/dbus/qdbusabstractinterface/interface.h index 209c7d359c..53744998d0 100644 --- a/tests/auto/dbus/qdbusabstractinterface/interface.h +++ b/tests/auto/dbus/qdbusabstractinterface/interface.h @@ -1,37 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef INTERFACE_H #define INTERFACE_H -#include <QtCore/QObject> -#include <QtCore/QHash> -#include <QtDBus/QDBusArgument> +#include <QObject> +#include <QHash> +#include <QDBusArgument> struct RegisteredType { diff --git a/tests/auto/dbus/qdbusabstractinterface/org.qtproject.QtDBus.Pinger.xml b/tests/auto/dbus/qdbusabstractinterface/org.qtproject.QtDBus.Pinger.xml index ad61351cb2..70d5a4e9c3 100644 --- a/tests/auto/dbus/qdbusabstractinterface/org.qtproject.QtDBus.Pinger.xml +++ b/tests/auto/dbus/qdbusabstractinterface/org.qtproject.QtDBus.Pinger.xml @@ -12,7 +12,7 @@ </signal> <signal name="complexSignal"> <arg name="" type="(s)"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="RegisteredType"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="RegisteredType"/> </signal> <method name="voidMethod" /> <method name="sleepMethod"> diff --git a/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface.pro b/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface.pro deleted file mode 100644 index 26991e2514..0000000000 --- a/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface.pro +++ /dev/null @@ -1,6 +0,0 @@ -CONFIG += testcase -TARGET = tst_qdbusabstractinterface -TEMPLATE = subdirs -qdbusabstractinterface.depends = qpinger -SUBDIRS = qpinger qdbusabstractinterface -OTHER_FILES += org.qtproject.QtDBus.Pinger.xml diff --git a/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/.prev_CMakeLists.txt b/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/.prev_CMakeLists.txt deleted file mode 100644 index 6db0362e59..0000000000 --- a/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/.prev_CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -# Generated from qdbusabstractinterface.pro. - -##################################################################### -## tst_qdbusabstractinterface Test: -##################################################################### - -qt_add_test(tst_qdbusabstractinterface - OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../" - SOURCES - ../interface.cpp ../interface.h - ../tst_qdbusabstractinterface.cpp - DBUS_INTERFACE_SOURCES - ../org.qtproject.QtDBus.Pinger.xml - DBUS_INTERFACE_FLAGS - "-i" "../interface.h" - PUBLIC_LIBRARIES - Qt::DBus -) diff --git a/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/CMakeLists.txt b/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/CMakeLists.txt index 3df1ff8177..55634f0677 100644 --- a/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/CMakeLists.txt +++ b/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/CMakeLists.txt @@ -1,9 +1,8 @@ -# Generated from qdbusabstractinterface.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## tst_qdbusabstractinterface Test: ##################################################################### -# special case begin # this test can not be generated here. It needs to be set up in the # parent directory -# special case end diff --git a/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/qdbusabstractinterface.pro b/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/qdbusabstractinterface.pro deleted file mode 100644 index 702c81ff54..0000000000 --- a/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/qdbusabstractinterface.pro +++ /dev/null @@ -1,12 +0,0 @@ -CONFIG += testcase -SOURCES += ../tst_qdbusabstractinterface.cpp ../interface.cpp -HEADERS += ../interface.h - -TARGET = ../tst_qdbusabstractinterface -DESTDIR = ./ - -QT = core testlib -QT += dbus - -DBUS_INTERFACES = ../org.qtproject.QtDBus.Pinger.xml -QDBUSXML2CPP_INTERFACE_HEADER_FLAGS += -i ../interface.h diff --git a/tests/auto/dbus/qdbusabstractinterface/qpinger/.prev_CMakeLists.txt b/tests/auto/dbus/qdbusabstractinterface/qpinger/.prev_CMakeLists.txt deleted file mode 100644 index 7f65f85afb..0000000000 --- a/tests/auto/dbus/qdbusabstractinterface/qpinger/.prev_CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Generated from qpinger.pro. - -##################################################################### -## qpinger Binary: -##################################################################### - -qt_add_executable(qpinger - OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" - SOURCES - ../interface.cpp ../interface.h - qpinger.cpp - PUBLIC_LIBRARIES - Qt::DBus -) diff --git a/tests/auto/dbus/qdbusabstractinterface/qpinger/CMakeLists.txt b/tests/auto/dbus/qdbusabstractinterface/qpinger/CMakeLists.txt index 5ebb914c01..362928712d 100644 --- a/tests/auto/dbus/qdbusabstractinterface/qpinger/CMakeLists.txt +++ b/tests/auto/dbus/qdbusabstractinterface/qpinger/CMakeLists.txt @@ -1,15 +1,16 @@ -# Generated from qpinger.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## qpinger Binary: ##################################################################### -qt_add_executable(qpinger +qt_internal_add_executable(qpinger OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" - NO_INSTALL # special case + NO_INSTALL SOURCES ../interface.cpp ../interface.h qpinger.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::DBus ) diff --git a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp index e92f173fae..47e5becc15 100644 --- a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp +++ b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp @@ -1,33 +1,15 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Intel Corporation. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <QtCore/QtCore> -#include <QtDBus/QtDBus> +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QCoreApplication> + +#include <QDBusServer> +#include <QDBusContext> +#include <QDBusMetaType> +#include <QDBusConnection> +#include <QDBusMessage> + #include "../interface.h" static const char serviceName[] = "org.qtproject.autotests.qpinger"; @@ -39,7 +21,7 @@ class PingerServer : public QDBusServer, protected QDBusContext Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.qtproject.autotests.qpinger") public: - PingerServer(QObject* parent = 0) + PingerServer(QObject *parent = nullptr) : QDBusServer(parent), m_conn("none") { diff --git a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.pro b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.pro deleted file mode 100644 index a876cbfa33..0000000000 --- a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.pro +++ /dev/null @@ -1,6 +0,0 @@ -SOURCES = qpinger.cpp ../interface.cpp -HEADERS = ../interface.h -TARGET = qpinger -DESTDIR = ./ -CONFIG += cmdline -QT = core dbus diff --git a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp index 615b25e01a..ec585948d7 100644 --- a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp +++ b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp @@ -1,38 +1,18 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Intel Corporation. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <qcoreapplication.h> -#include <qdebug.h> -#include <qsharedpointer.h> - -#include <QtTest/QtTest> - -#include <QtDBus> +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QTest> +#include <QTestEventLoop> +#include <QDebug> +#include <QCoreApplication> +#include <QSharedPointer> +#include <QSignalSpy> +#include <QProcess> +#include <QSemaphore> +#include <QDBusMetaType> +#include <QDBusConnectionInterface> +#include <QDBusInterface> #include "interface.h" #include "pinger_interface.h" @@ -884,7 +864,7 @@ void tst_QDBusAbstractInterface::getStringSignal() QCOMPARE(s.size(), 1); QCOMPARE(s[0].size(), 1); - QCOMPARE(s[0][0].userType(), int(QVariant::String)); + QCOMPARE(s[0][0].userType(), int(QMetaType::QString)); QCOMPARE(s[0][0].toString(), expectedValue); } @@ -966,7 +946,7 @@ void tst_QDBusAbstractInterface::getStringSignalPeer() QCOMPARE(s.size(), 1); QCOMPARE(s[0].size(), 1); - QCOMPARE(s[0][0].userType(), int(QVariant::String)); + QCOMPARE(s[0][0].userType(), int(QMetaType::QString)); QCOMPARE(s[0][0].toString(), expectedValue); } |