diff options
Diffstat (limited to 'tests/auto/dbus/qdbusmetatype')
-rw-r--r-- | tests/auto/dbus/qdbusmetatype/CMakeLists.txt | 8 | ||||
-rw-r--r-- | tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.cpp | 27 |
2 files changed, 24 insertions, 11 deletions
diff --git a/tests/auto/dbus/qdbusmetatype/CMakeLists.txt b/tests/auto/dbus/qdbusmetatype/CMakeLists.txt index d9106ed0f3..5a1ba189fc 100644 --- a/tests/auto/dbus/qdbusmetatype/CMakeLists.txt +++ b/tests/auto/dbus/qdbusmetatype/CMakeLists.txt @@ -1,12 +1,16 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause -# Generated from qdbusmetatype.pro. - ##################################################################### ## tst_qdbusmetatype Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qdbusmetatype LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qdbusmetatype SOURCES tst_qdbusmetatype.cpp diff --git a/tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.cpp b/tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.cpp index c2df3bc678..be9a240fd5 100644 --- a/tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.cpp +++ b/tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.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 <QCoreApplication> @@ -245,7 +245,14 @@ void tst_QDBusMetaType::initTestCase() qDBusRegisterMetaType<QList<Struct3> >(); qDBusRegisterMetaType<QList<Struct4> >(); +#ifdef Q_CC_GNU_ONLY + // GCC has a defect/extension (depending on your point of view) that allows + // a template class with defaulted template parameters to match a Template + // Template Parameter (TTP) with fewer template arguments. The call below + // tries to use the template<template <typename> class Container, ...> + // template functions qdbusargument.h qDBusRegisterMetaType<std::vector<Struct1> >(); +#endif qDBusRegisterMetaType<Invalid0>(); qDBusRegisterMetaType<Invalid1>(); @@ -307,7 +314,9 @@ void tst_QDBusMetaType::dynamicTypes_data() QTest::newRow("Struct1") << qMetaTypeId<Struct1>() << "(s)"; QTest::newRow("QList<Struct1>") << qMetaTypeId<QList<Struct1> >() << "a(s)"; +#ifdef Q_CC_GNU_ONLY QTest::newRow("std::vector<Struct1>") << qMetaTypeId<std::vector<Struct1> >() << "a(s)"; +#endif QTest::newRow("Struct2") << qMetaTypeId<Struct2>() << "(sos)"; QTest::newRow("QList<Struct2>") << qMetaTypeId<QList<Struct2>>() << "a(sos)"; @@ -365,21 +374,21 @@ void tst_QDBusMetaType::invalidTypes() { // same test if (qstrcmp(QTest::currentDataTag(), "Invalid0") == 0) - QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type `Invalid0' produces invalid D-BUS signature `<empty>' (Did you forget to call beginStructure() ?)"); + QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type 'Invalid0' produces invalid D-Bus signature '<empty>' (Did you forget to call beginStructure() ?)"); else if (qstrcmp(QTest::currentDataTag(), "Invalid1") == 0) - QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type `Invalid1' attempts to redefine basic D-BUS type 's' (QString) (Did you forget to call beginStructure() ?)"); + QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type 'Invalid1' attempts to redefine basic D-Bus type 's' (QString) (Did you forget to call beginStructure() ?)"); else if (qstrcmp(QTest::currentDataTag(), "Invalid2") == 0) - QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type `Invalid2' attempts to redefine basic D-BUS type 'o' (QDBusObjectPath) (Did you forget to call beginStructure() ?)"); + QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type 'Invalid2' attempts to redefine basic D-Bus type 'o' (QDBusObjectPath) (Did you forget to call beginStructure() ?)"); else if (qstrcmp(QTest::currentDataTag(), "Invalid3") == 0) - QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type `Invalid3' attempts to redefine basic D-BUS type 'as' (QStringList) (Did you forget to call beginStructure() ?)"); + QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type 'Invalid3' attempts to redefine basic D-Bus type 'as' (QStringList) (Did you forget to call beginStructure() ?)"); else if (qstrcmp(QTest::currentDataTag(), "Invalid4") == 0) - QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type `Invalid4' attempts to redefine basic D-BUS type 'ay' (QByteArray) (Did you forget to call beginStructure() ?)"); + QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type 'Invalid4' attempts to redefine basic D-Bus type 'ay' (QByteArray) (Did you forget to call beginStructure() ?)"); else if (qstrcmp(QTest::currentDataTag(), "Invalid5") == 0) - QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type `Invalid5' produces invalid D-BUS signature `ii' (Did you forget to call beginStructure() ?)"); + QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type 'Invalid5' produces invalid D-Bus signature 'ii' (Did you forget to call beginStructure() ?)"); else if (qstrcmp(QTest::currentDataTag(), "Invalid7") == 0) - QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type `Invalid7' produces invalid D-BUS signature `()' (Did you forget to call beginStructure() ?)"); + QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type 'Invalid7' produces invalid D-Bus signature '()' (Did you forget to call beginStructure() ?)"); else if (qstrcmp(QTest::currentDataTag(), "QList<Invalid0>") == 0) - QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type `QList<Invalid0>' produces invalid D-BUS signature `a' (Did you forget to call beginStructure() ?)"); + QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type 'QList<Invalid0>' produces invalid D-Bus signature 'a' (Did you forget to call beginStructure() ?)"); staticTypes(); staticTypes(); // run twice: the error messages should be printed once only |