diff options
Diffstat (limited to 'tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.cpp')
-rw-r--r-- | tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.cpp | 68 |
1 files changed, 28 insertions, 40 deletions
diff --git a/tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.cpp b/tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.cpp index 4fd8b8103f..be9a240fd5 100644 --- a/tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.cpp +++ b/tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.cpp @@ -1,35 +1,11 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ -#include <qcoreapplication.h> -#include <qmetatype.h> -#include <QtTest/QtTest> - -#include <QtDBus/QtDBus> +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QTest> +#include <QCoreApplication> +#include <QMetaType> +#include <QDBusArgument> +#include <QDBusMetaType> class tst_QDBusMetaType: public QObject { @@ -269,6 +245,15 @@ 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>(); qDBusRegisterMetaType<Invalid2>(); @@ -329,6 +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)"; @@ -386,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 |