diff options
Diffstat (limited to 'tests/auto/corelib/kernel')
48 files changed, 793 insertions, 660 deletions
diff --git a/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro b/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro index 1039f2c08d..a49bb9ae1f 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro +++ b/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qcoreapplication QT = core testlib core-private SOURCES = tst_qcoreapplication.cpp diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp index 655719cffc..a8de5b7a9a 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2015 Intel Corporation. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -442,14 +437,14 @@ public slots: void threadProgress(int v) { ++count; - QVERIFY(v == count); + QCOMPARE(v, count); QCoreApplication::postEvent(this, new QEvent(QEvent::MaxUser), -1); } void threadFinished() { - QVERIFY(count == 7); + QCOMPARE(count, 7); count = 0; thread->deleteLater(); @@ -898,6 +893,7 @@ void tst_QCoreApplication::threadedEventDelivery() QCOMPARE(receiver.recordedEvents.contains(QEvent::User + 1), eventsReceived); } +#ifndef QT_NO_LIBRARY void tst_QCoreApplication::addRemoveLibPaths() { QStringList paths = QCoreApplication::libraryPaths(); @@ -922,8 +918,9 @@ void tst_QCoreApplication::addRemoveLibPaths() QStringList replace; replace << currentDir << paths[0]; QCoreApplication::setLibraryPaths(replace); - QVERIFY(QCoreApplication::libraryPaths() == replace); + QCOMPARE(QCoreApplication::libraryPaths(), replace); } +#endif static void createQObjectOnDestruction() { diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h index d9296b3846..7fb1bde459 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2015 Intel Corporation. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -63,7 +58,9 @@ private slots: void applicationEventFilters_auxThread(); void threadedEventDelivery_data(); void threadedEventDelivery(); +#ifndef QT_NO_LIBRARY void addRemoveLibPaths(); +#endif }; #endif // TST_QCOREAPPLICATION_H diff --git a/tests/auto/corelib/kernel/qeventdispatcher/qeventdispatcher.pro b/tests/auto/corelib/kernel/qeventdispatcher/qeventdispatcher.pro index c3019467ce..ff048d0429 100644 --- a/tests/auto/corelib/kernel/qeventdispatcher/qeventdispatcher.pro +++ b/tests/auto/corelib/kernel/qeventdispatcher/qeventdispatcher.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qeventdispatcher QT = core testlib SOURCES += tst_qeventdispatcher.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp index aaacfcae03..5784f0728c 100644 --- a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp +++ b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro index ea4792fc1c..5cd043b584 100644 --- a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro +++ b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro @@ -1,10 +1,8 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qeventloop QT = core network testlib core-private SOURCES = $$PWD/tst_qeventloop.cpp win32:!wince:!winrt: LIBS += -luser32 -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 contains(QT_CONFIG, glib): DEFINES += HAVE_GLIB diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp index c8bb4cda6e..aff04afe08 100644 --- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -430,11 +425,8 @@ public slots: dataSent = serverSocket->waitForBytesWritten(-1); if (dataSent) { - fd_set fdread; - int fd = socket->socketDescriptor(); - FD_ZERO(&fdread); - FD_SET(fd, &fdread); - dataReadable = (1 == qt_safe_select(fd + 1, &fdread, 0, 0, 0)); + pollfd pfd = qt_make_pollfd(socket->socketDescriptor(), POLLIN); + dataReadable = (1 == qt_safe_poll(&pfd, 1, nullptr)); } if (!dataReadable) { diff --git a/tests/auto/corelib/kernel/qmath/qmath.pro b/tests/auto/corelib/kernel/qmath/qmath.pro index 5b8cba4104..703c530e35 100644 --- a/tests/auto/corelib/kernel/qmath/qmath.pro +++ b/tests/auto/corelib/kernel/qmath/qmath.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qmath QT = core testlib SOURCES = tst_qmath.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qmath/tst_qmath.cpp b/tests/auto/corelib/kernel/qmath/tst_qmath.cpp index f709c29bc3..ad40b0140d 100644 --- a/tests/auto/corelib/kernel/qmath/tst_qmath.cpp +++ b/tests/auto/corelib/kernel/qmath/tst_qmath.cpp @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/corelib/kernel/qmetaenum/qmetaenum.pro b/tests/auto/corelib/kernel/qmetaenum/qmetaenum.pro index f045fc5d88..718f2b51de 100644 --- a/tests/auto/corelib/kernel/qmetaenum/qmetaenum.pro +++ b/tests/auto/corelib/kernel/qmetaenum/qmetaenum.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qmetaenum QT = core testlib SOURCES = tst_qmetaenum.cpp diff --git a/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp b/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp index 5a10cf51e6..e4aa8b80c0 100644 --- a/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp +++ b/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/corelib/kernel/qmetamethod/qmetamethod.pro b/tests/auto/corelib/kernel/qmetamethod/qmetamethod.pro index 8340bc06e3..a42cd60236 100644 --- a/tests/auto/corelib/kernel/qmetamethod/qmetamethod.pro +++ b/tests/auto/corelib/kernel/qmetamethod/qmetamethod.pro @@ -1,7 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qmetamethod QT = core testlib SOURCES = tst_qmetamethod.cpp mac:CONFIG -= app_bundle -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp index cf3ff04aa4..87196eaef1 100644 --- a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp +++ b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2014 Olivier Goffart <ogoffart@woboq.com> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -599,8 +594,8 @@ void tst_QMetaMethod::method() QFETCH(QMetaMethod::MethodType, methodType); QFETCH(QMetaMethod::Access, access); - QVERIFY(parameterTypes.size() == parameterTypeNames.size()); - QVERIFY(parameterTypes.size() == parameterNames.size()); + QCOMPARE(parameterTypes.size(), parameterTypeNames.size()); + QCOMPARE(parameterTypes.size(), parameterNames.size()); const QMetaObject *mo = &MethodTestObject::staticMetaObject; int index = (methodType == QMetaMethod::Constructor) diff --git a/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro b/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro index 509ade6e2a..e7e5a03a86 100644 --- a/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro +++ b/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qmetaobject QT = core-private testlib SOURCES = tst_qmetaobject.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp index 7c19bfb89c..fd32dc1ef8 100644 --- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -136,6 +131,22 @@ namespace MyNamespace { MyEnum m_enum; MyFlags m_flags; }; + + // Test inherits + class MyClassSubclass : public MyClass + { + Q_OBJECT + }; + + class MyClassSubclass2 : public MyClass2 + { + Q_OBJECT + }; + + class MyClass2Subclass : public MyClass + { + Q_OBJECT + }; } @@ -227,6 +238,9 @@ private slots: void signalIndex(); void enumDebugStream(); + void inherits_data(); + void inherits(); + signals: void value6Changed(); void value7Changed(const QString &); @@ -811,7 +825,7 @@ void tst_QMetaObject::invokeBlockingQueuedMetaMember() void tst_QMetaObject::qtMetaObjectInheritance() { - QVERIFY(QObject::staticMetaObject.superClass() == 0); + QVERIFY(!QObject::staticMetaObject.superClass()); QCOMPARE(QSortFilterProxyModel::staticMetaObject.indexOfEnumerator("Qt::CaseSensitivity"), -1); QCOMPARE(QSortFilterProxyModel::staticMetaObject.indexOfEnumerator("CaseSensitivity"), -1); int indexOfSortCaseSensitivity = QSortFilterProxyModel::staticMetaObject.indexOfProperty("sortCaseSensitivity"); @@ -878,7 +892,7 @@ void tst_QMetaObject::invokeMetaConstructor() const QMetaObject *mo = &QtTestObject::staticMetaObject; { QObject *obj = mo->newInstance(); - QVERIFY(obj == 0); + QVERIFY(!obj); } { QtTestObject obj; @@ -1430,5 +1444,34 @@ void tst_QMetaObject::enumDebugStream() qDebug() << f1 << f2; } +void tst_QMetaObject::inherits_data() +{ + QTest::addColumn<const QMetaObject *>("derivedMetaObject"); + QTest::addColumn<const QMetaObject *>("baseMetaObject"); + QTest::addColumn<bool>("inheritsResult"); + + QTest::newRow("MyClass inherits QObject") + << &MyNamespace::MyClass::staticMetaObject << &QObject::staticMetaObject << true; + QTest::newRow("QObject inherits MyClass") + << &QObject::staticMetaObject << &MyNamespace::MyClass::staticMetaObject << false; + QTest::newRow("MyClass inherits MyClass") + << &MyNamespace::MyClass::staticMetaObject << &MyNamespace::MyClass::staticMetaObject << true; + QTest::newRow("MyClassSubclass inherits QObject") + << &MyNamespace::MyClassSubclass::staticMetaObject << &QObject::staticMetaObject << true; + QTest::newRow("MyClassSubclass2 inherits QObject") + << &MyNamespace::MyClassSubclass2::staticMetaObject << &QObject::staticMetaObject << true; + QTest::newRow("MyClassSubclass2 inherits MyClass2") + << &MyNamespace::MyClassSubclass2::staticMetaObject << &MyNamespace::MyClass2Subclass::staticMetaObject << false; +} + +void tst_QMetaObject::inherits() +{ + QFETCH(const QMetaObject *, derivedMetaObject); + QFETCH(const QMetaObject *, baseMetaObject); + QFETCH(bool, inheritsResult); + + QCOMPARE(derivedMetaObject->inherits(baseMetaObject), inheritsResult); +} + QTEST_MAIN(tst_QMetaObject) #include "tst_qmetaobject.moc" diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro b/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro index 68d3b48086..f3153b3fd4 100644 --- a/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro +++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qmetaobjectbuilder QT = core-private testlib SOURCES = tst_qmetaobjectbuilder.cpp mac:CONFIG -= app_bundle -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp index 74fcde2e71..9ae39449f8 100644 --- a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp +++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -138,14 +133,14 @@ void tst_QMetaObjectBuilder::create() { QMetaObjectBuilder builder; QVERIFY(builder.className().isEmpty()); - QVERIFY(builder.superClass() == &QObject::staticMetaObject); + QCOMPARE(builder.superClass(), &QObject::staticMetaObject); QCOMPARE(builder.methodCount(), 0); QCOMPARE(builder.constructorCount(), 0); QCOMPARE(builder.propertyCount(), 0); QCOMPARE(builder.enumeratorCount(), 0); QCOMPARE(builder.classInfoCount(), 0); QCOMPARE(builder.relatedMetaObjectCount(), 0); - QVERIFY(builder.staticMetacallFunction() == 0); + QVERIFY(!builder.staticMetacallFunction()); } void tst_QMetaObjectBuilder::className() @@ -174,17 +169,17 @@ void tst_QMetaObjectBuilder::superClass() // Change the super class. builder.setSuperClass(&QObject::staticMetaObject); - QVERIFY(builder.superClass() == &QObject::staticMetaObject); + QCOMPARE(builder.superClass(), &QObject::staticMetaObject); // Change it again. builder.setSuperClass(&staticMetaObject); - QVERIFY(builder.superClass() == &staticMetaObject); + QCOMPARE(builder.superClass(), &staticMetaObject); // Clone the super class off a static QMetaObject. builder.addMetaObject(&QObject::staticMetaObject, QMetaObjectBuilder::SuperClass); - QVERIFY(builder.superClass() == 0); + QVERIFY(!builder.superClass()); builder.addMetaObject(&staticMetaObject, QMetaObjectBuilder::SuperClass); - QVERIFY(builder.superClass() == staticMetaObject.superClass()); + QCOMPARE(builder.superClass(), staticMetaObject.superClass()); // Check that nothing else changed. QVERIFY(checkForSideEffects(builder, QMetaObjectBuilder::SuperClass)); @@ -195,11 +190,11 @@ void tst_QMetaObjectBuilder::flags() QMetaObjectBuilder builder; // Check default - QVERIFY(builder.flags() == 0); + QCOMPARE(builder.flags(), 0); // Set flags builder.setFlags(QMetaObjectBuilder::DynamicMetaObject); - QVERIFY(builder.flags() == QMetaObjectBuilder::DynamicMetaObject); + QCOMPARE(builder.flags(), QMetaObjectBuilder::DynamicMetaObject); } void tst_QMetaObjectBuilder::method() @@ -209,12 +204,12 @@ void tst_QMetaObjectBuilder::method() // Check null method QMetaMethodBuilder nullMethod; QCOMPARE(nullMethod.signature(), QByteArray()); - QVERIFY(nullMethod.methodType() == QMetaMethod::Method); + QCOMPARE(nullMethod.methodType(), QMetaMethod::Method); QVERIFY(nullMethod.returnType().isEmpty()); QVERIFY(nullMethod.parameterTypes().isEmpty()); QVERIFY(nullMethod.parameterNames().isEmpty()); QVERIFY(nullMethod.tag().isEmpty()); - QVERIFY(nullMethod.access() == QMetaMethod::Public); + QCOMPARE(nullMethod.access(), QMetaMethod::Public); QCOMPARE(nullMethod.attributes(), 0); QCOMPARE(nullMethod.revision(), 0); QCOMPARE(nullMethod.index(), 0); @@ -222,12 +217,12 @@ void tst_QMetaObjectBuilder::method() // Add a method and check its attributes. QMetaMethodBuilder method1 = builder.addMethod("foo(const QString&, int)"); QCOMPARE(method1.signature(), QByteArray("foo(QString,int)")); - QVERIFY(method1.methodType() == QMetaMethod::Method); + QCOMPARE(method1.methodType(), QMetaMethod::Method); QCOMPARE(method1.returnType(), QByteArray("void")); QCOMPARE(method1.parameterTypes(), QList<QByteArray>() << "QString" << "int"); QVERIFY(method1.parameterNames().isEmpty()); QVERIFY(method1.tag().isEmpty()); - QVERIFY(method1.access() == QMetaMethod::Public); + QCOMPARE(method1.access(), QMetaMethod::Public); QCOMPARE(method1.attributes(), 0); QCOMPARE(method1.revision(), 0); QCOMPARE(method1.index(), 0); @@ -236,12 +231,12 @@ void tst_QMetaObjectBuilder::method() // Add another method and check again. QMetaMethodBuilder method2 = builder.addMethod("bar(QString)", "int"); QCOMPARE(method2.signature(), QByteArray("bar(QString)")); - QVERIFY(method2.methodType() == QMetaMethod::Method); + QCOMPARE(method2.methodType(), QMetaMethod::Method); QCOMPARE(method2.returnType(), QByteArray("int")); QCOMPARE(method2.parameterTypes(), QList<QByteArray>() << "QString"); QVERIFY(method2.parameterNames().isEmpty()); QVERIFY(method2.tag().isEmpty()); - QVERIFY(method2.access() == QMetaMethod::Public); + QCOMPARE(method2.access(), QMetaMethod::Public); QCOMPARE(method2.attributes(), 0); QCOMPARE(method2.revision(), 0); QCOMPARE(method2.index(), 1); @@ -262,22 +257,22 @@ void tst_QMetaObjectBuilder::method() // Check that method1 is changed, but method2 is not. QCOMPARE(method1.signature(), QByteArray("foo(QString,int)")); - QVERIFY(method1.methodType() == QMetaMethod::Method); + QCOMPARE(method1.methodType(), QMetaMethod::Method); QCOMPARE(method1.returnType(), QByteArray("int")); QCOMPARE(method1.parameterTypes(), QList<QByteArray>() << "QString" << "int"); QCOMPARE(method1.parameterNames(), QList<QByteArray>() << "a" << "b"); QCOMPARE(method1.tag(), QByteArray("tag")); - QVERIFY(method1.access() == QMetaMethod::Private); + QCOMPARE(method1.access(), QMetaMethod::Private); QCOMPARE(method1.attributes(), 42); QCOMPARE(method1.revision(), 123); QCOMPARE(method1.index(), 0); QCOMPARE(method2.signature(), QByteArray("bar(QString)")); - QVERIFY(method2.methodType() == QMetaMethod::Method); + QCOMPARE(method2.methodType(), QMetaMethod::Method); QCOMPARE(method2.returnType(), QByteArray("int")); QCOMPARE(method2.parameterTypes(), QList<QByteArray>() << "QString"); QVERIFY(method2.parameterNames().isEmpty()); QVERIFY(method2.tag().isEmpty()); - QVERIFY(method2.access() == QMetaMethod::Public); + QCOMPARE(method2.access(), QMetaMethod::Public); QCOMPARE(method2.attributes(), 0); QCOMPARE(method2.revision(), 0); QCOMPARE(method2.index(), 1); @@ -293,22 +288,22 @@ void tst_QMetaObjectBuilder::method() // This time check that only method2 changed. QCOMPARE(method1.signature(), QByteArray("foo(QString,int)")); - QVERIFY(method1.methodType() == QMetaMethod::Method); + QCOMPARE(method1.methodType(), QMetaMethod::Method); QCOMPARE(method1.returnType(), QByteArray("int")); QCOMPARE(method1.parameterTypes(), QList<QByteArray>() << "QString" << "int"); QCOMPARE(method1.parameterNames(), QList<QByteArray>() << "a" << "b"); QCOMPARE(method1.tag(), QByteArray("tag")); - QVERIFY(method1.access() == QMetaMethod::Private); + QCOMPARE(method1.access(), QMetaMethod::Private); QCOMPARE(method1.attributes(), 42); QCOMPARE(method1.revision(), 123); QCOMPARE(method1.index(), 0); QCOMPARE(method2.signature(), QByteArray("bar(QString)")); - QVERIFY(method2.methodType() == QMetaMethod::Method); + QCOMPARE(method2.methodType(), QMetaMethod::Method); QCOMPARE(method2.returnType(), QByteArray("QString")); QCOMPARE(method2.parameterTypes(), QList<QByteArray>() << "QString"); QCOMPARE(method2.parameterNames(), QList<QByteArray>() << "c"); QCOMPARE(method2.tag(), QByteArray("Q_FOO")); - QVERIFY(method2.access() == QMetaMethod::Protected); + QCOMPARE(method2.access(), QMetaMethod::Protected); QCOMPARE(method2.attributes(), 24); QCOMPARE(method2.revision(), 321); QCOMPARE(method2.index(), 1); @@ -319,12 +314,12 @@ void tst_QMetaObjectBuilder::method() QCOMPARE(builder.methodCount(), 1); method2 = builder.method(0); QCOMPARE(method2.signature(), QByteArray("bar(QString)")); - QVERIFY(method2.methodType() == QMetaMethod::Method); + QCOMPARE(method2.methodType(), QMetaMethod::Method); QCOMPARE(method2.returnType(), QByteArray("QString")); QCOMPARE(method2.parameterTypes(), QList<QByteArray>() << "QString"); QCOMPARE(method2.parameterNames(), QList<QByteArray>() << "c"); QCOMPARE(method2.tag(), QByteArray("Q_FOO")); - QVERIFY(method2.access() == QMetaMethod::Protected); + QCOMPARE(method2.access(), QMetaMethod::Protected); QCOMPARE(method2.attributes(), 24); QCOMPARE(method2.revision(), 321); QCOMPARE(method2.index(), 0); @@ -347,12 +342,12 @@ void tst_QMetaObjectBuilder::slot() // Add a slot and check its attributes. QMetaMethodBuilder method1 = builder.addSlot("foo(const QString&, int)"); QCOMPARE(method1.signature(), QByteArray("foo(QString,int)")); - QVERIFY(method1.methodType() == QMetaMethod::Slot); + QCOMPARE(method1.methodType(), QMetaMethod::Slot); QCOMPARE(method1.returnType(), QByteArray("void")); QCOMPARE(method1.parameterTypes(), QList<QByteArray>() << "QString" << "int"); QVERIFY(method1.parameterNames().isEmpty()); QVERIFY(method1.tag().isEmpty()); - QVERIFY(method1.access() == QMetaMethod::Public); + QCOMPARE(method1.access(), QMetaMethod::Public); QCOMPARE(method1.attributes(), 0); QCOMPARE(method1.index(), 0); QCOMPARE(builder.methodCount(), 1); @@ -360,12 +355,12 @@ void tst_QMetaObjectBuilder::slot() // Add another slot and check again. QMetaMethodBuilder method2 = builder.addSlot("bar(QString)"); QCOMPARE(method2.signature(), QByteArray("bar(QString)")); - QVERIFY(method2.methodType() == QMetaMethod::Slot); + QCOMPARE(method2.methodType(), QMetaMethod::Slot); QCOMPARE(method2.returnType(), QByteArray("void")); QCOMPARE(method2.parameterTypes(), QList<QByteArray>() << "QString"); QVERIFY(method2.parameterNames().isEmpty()); QVERIFY(method2.tag().isEmpty()); - QVERIFY(method2.access() == QMetaMethod::Public); + QCOMPARE(method2.access(), QMetaMethod::Public); QCOMPARE(method2.attributes(), 0); QCOMPARE(method2.index(), 1); QCOMPARE(builder.methodCount(), 2); @@ -386,12 +381,12 @@ void tst_QMetaObjectBuilder::signal() // Add a signal and check its attributes. QMetaMethodBuilder method1 = builder.addSignal("foo(const QString&, int)"); QCOMPARE(method1.signature(), QByteArray("foo(QString,int)")); - QVERIFY(method1.methodType() == QMetaMethod::Signal); + QCOMPARE(method1.methodType(), QMetaMethod::Signal); QCOMPARE(method1.returnType(), QByteArray("void")); QCOMPARE(method1.parameterTypes(), QList<QByteArray>() << "QString" << "int"); QVERIFY(method1.parameterNames().isEmpty()); QVERIFY(method1.tag().isEmpty()); - QVERIFY(method1.access() == QMetaMethod::Public); + QCOMPARE(method1.access(), QMetaMethod::Public); QCOMPARE(method1.attributes(), 0); QCOMPARE(method1.index(), 0); QCOMPARE(builder.methodCount(), 1); @@ -399,12 +394,12 @@ void tst_QMetaObjectBuilder::signal() // Add another signal and check again. QMetaMethodBuilder method2 = builder.addSignal("bar(QString)"); QCOMPARE(method2.signature(), QByteArray("bar(QString)")); - QVERIFY(method2.methodType() == QMetaMethod::Signal); + QCOMPARE(method2.methodType(), QMetaMethod::Signal); QCOMPARE(method2.returnType(), QByteArray("void")); QCOMPARE(method2.parameterTypes(), QList<QByteArray>() << "QString"); QVERIFY(method2.parameterNames().isEmpty()); QVERIFY(method2.tag().isEmpty()); - QVERIFY(method2.access() == QMetaMethod::Public); + QCOMPARE(method2.access(), QMetaMethod::Public); QCOMPARE(method2.attributes(), 0); QCOMPARE(method2.index(), 1); QCOMPARE(builder.methodCount(), 2); @@ -425,12 +420,12 @@ void tst_QMetaObjectBuilder::constructor() // Add a constructor and check its attributes. QMetaMethodBuilder ctor1 = builder.addConstructor("foo(const QString&, int)"); QCOMPARE(ctor1.signature(), QByteArray("foo(QString,int)")); - QVERIFY(ctor1.methodType() == QMetaMethod::Constructor); + QCOMPARE(ctor1.methodType(), QMetaMethod::Constructor); QVERIFY(ctor1.returnType().isEmpty()); QCOMPARE(ctor1.parameterTypes(), QList<QByteArray>() << "QString" << "int"); QVERIFY(ctor1.parameterNames().isEmpty()); QVERIFY(ctor1.tag().isEmpty()); - QVERIFY(ctor1.access() == QMetaMethod::Public); + QCOMPARE(ctor1.access(), QMetaMethod::Public); QCOMPARE(ctor1.attributes(), 0); QCOMPARE(ctor1.index(), 0); QCOMPARE(builder.constructorCount(), 1); @@ -438,12 +433,12 @@ void tst_QMetaObjectBuilder::constructor() // Add another constructor and check again. QMetaMethodBuilder ctor2 = builder.addConstructor("bar(QString)"); QCOMPARE(ctor2.signature(), QByteArray("bar(QString)")); - QVERIFY(ctor2.methodType() == QMetaMethod::Constructor); + QCOMPARE(ctor2.methodType(), QMetaMethod::Constructor); QVERIFY(ctor2.returnType().isEmpty()); QCOMPARE(ctor2.parameterTypes(), QList<QByteArray>() << "QString"); QVERIFY(ctor2.parameterNames().isEmpty()); QVERIFY(ctor2.tag().isEmpty()); - QVERIFY(ctor2.access() == QMetaMethod::Public); + QCOMPARE(ctor2.access(), QMetaMethod::Public); QCOMPARE(ctor2.attributes(), 0); QCOMPARE(ctor2.index(), 1); QCOMPARE(builder.constructorCount(), 2); @@ -464,21 +459,21 @@ void tst_QMetaObjectBuilder::constructor() // Check that ctor1 is changed, but ctor2 is not. QCOMPARE(ctor1.signature(), QByteArray("foo(QString,int)")); - QVERIFY(ctor1.methodType() == QMetaMethod::Constructor); + QCOMPARE(ctor1.methodType(), QMetaMethod::Constructor); QCOMPARE(ctor1.returnType(), QByteArray("int")); QCOMPARE(ctor1.parameterTypes(), QList<QByteArray>() << "QString" << "int"); QCOMPARE(ctor1.parameterNames(), QList<QByteArray>() << "a" << "b"); QCOMPARE(ctor1.tag(), QByteArray("tag")); - QVERIFY(ctor1.access() == QMetaMethod::Private); + QCOMPARE(ctor1.access(), QMetaMethod::Private); QCOMPARE(ctor1.attributes(), 42); QCOMPARE(ctor1.index(), 0); QCOMPARE(ctor2.signature(), QByteArray("bar(QString)")); - QVERIFY(ctor2.methodType() == QMetaMethod::Constructor); + QCOMPARE(ctor2.methodType(), QMetaMethod::Constructor); QVERIFY(ctor2.returnType().isEmpty()); QCOMPARE(ctor2.parameterTypes(), QList<QByteArray>() << "QString"); QVERIFY(ctor2.parameterNames().isEmpty()); QVERIFY(ctor2.tag().isEmpty()); - QVERIFY(ctor2.access() == QMetaMethod::Public); + QCOMPARE(ctor2.access(), QMetaMethod::Public); QCOMPARE(ctor2.attributes(), 0); QCOMPARE(ctor2.index(), 1); QCOMPARE(builder.constructorCount(), 2); @@ -492,21 +487,21 @@ void tst_QMetaObjectBuilder::constructor() // This time check that only ctor2 changed. QCOMPARE(ctor1.signature(), QByteArray("foo(QString,int)")); - QVERIFY(ctor1.methodType() == QMetaMethod::Constructor); + QCOMPARE(ctor1.methodType(), QMetaMethod::Constructor); QCOMPARE(ctor1.returnType(), QByteArray("int")); QCOMPARE(ctor1.parameterTypes(), QList<QByteArray>() << "QString" << "int"); QCOMPARE(ctor1.parameterNames(), QList<QByteArray>() << "a" << "b"); QCOMPARE(ctor1.tag(), QByteArray("tag")); - QVERIFY(ctor1.access() == QMetaMethod::Private); + QCOMPARE(ctor1.access(), QMetaMethod::Private); QCOMPARE(ctor1.attributes(), 42); QCOMPARE(ctor1.index(), 0); QCOMPARE(ctor2.signature(), QByteArray("bar(QString)")); - QVERIFY(ctor2.methodType() == QMetaMethod::Constructor); + QCOMPARE(ctor2.methodType(), QMetaMethod::Constructor); QCOMPARE(ctor2.returnType(), QByteArray("QString")); QCOMPARE(ctor2.parameterTypes(), QList<QByteArray>() << "QString"); QCOMPARE(ctor2.parameterNames(), QList<QByteArray>() << "c"); QCOMPARE(ctor2.tag(), QByteArray("Q_FOO")); - QVERIFY(ctor2.access() == QMetaMethod::Protected); + QCOMPARE(ctor2.access(), QMetaMethod::Protected); QCOMPARE(ctor2.attributes(), 24); QCOMPARE(ctor2.index(), 1); QCOMPARE(builder.constructorCount(), 2); @@ -516,12 +511,12 @@ void tst_QMetaObjectBuilder::constructor() QCOMPARE(builder.constructorCount(), 1); ctor2 = builder.constructor(0); QCOMPARE(ctor2.signature(), QByteArray("bar(QString)")); - QVERIFY(ctor2.methodType() == QMetaMethod::Constructor); + QCOMPARE(ctor2.methodType(), QMetaMethod::Constructor); QCOMPARE(ctor2.returnType(), QByteArray("QString")); QCOMPARE(ctor2.parameterTypes(), QList<QByteArray>() << "QString"); QCOMPARE(ctor2.parameterNames(), QList<QByteArray>() << "c"); QCOMPARE(ctor2.tag(), QByteArray("Q_FOO")); - QVERIFY(ctor2.access() == QMetaMethod::Protected); + QCOMPARE(ctor2.access(), QMetaMethod::Protected); QCOMPARE(ctor2.attributes(), 24); QCOMPARE(ctor2.index(), 0); @@ -536,10 +531,10 @@ void tst_QMetaObjectBuilder::constructor() QCOMPARE(builder.constructorCount(), 2); QCOMPARE(prototypeConstructor.signature(), QByteArray("SomethingOfEverything()")); - QVERIFY(prototypeConstructor.methodType() == QMetaMethod::Constructor); + QCOMPARE(prototypeConstructor.methodType(), QMetaMethod::Constructor); QCOMPARE(prototypeConstructor.returnType(), QByteArray()); QVERIFY(prototypeConstructor.parameterTypes().isEmpty()); - QVERIFY(prototypeConstructor.access() == QMetaMethod::Public); + QCOMPARE(prototypeConstructor.access(), QMetaMethod::Public); QCOMPARE(prototypeConstructor.index(), 1); // Check that nothing else changed. @@ -967,13 +962,13 @@ void tst_QMetaObjectBuilder::relatedMetaObject() // Add two related meta objects and check their attributes. QCOMPARE(builder.addRelatedMetaObject(&QObject::staticMetaObject), 0); QCOMPARE(builder.addRelatedMetaObject(&staticMetaObject), 1); - QVERIFY(builder.relatedMetaObject(0) == &QObject::staticMetaObject); - QVERIFY(builder.relatedMetaObject(1) == &staticMetaObject); + QCOMPARE(builder.relatedMetaObject(0), &QObject::staticMetaObject); + QCOMPARE(builder.relatedMetaObject(1), &staticMetaObject); QCOMPARE(builder.relatedMetaObjectCount(), 2); // Remove the first one and check again. builder.removeRelatedMetaObject(0); - QVERIFY(builder.relatedMetaObject(0) == &staticMetaObject); + QCOMPARE(builder.relatedMetaObject(0), &staticMetaObject); QCOMPARE(builder.relatedMetaObjectCount(), 1); // Check that nothing else changed. @@ -1617,7 +1612,7 @@ void tst_QMetaObjectBuilder::usage_slot() QVERIFY(index != -1); QMetaMethod voidSlotInt = testObject->metaObject()->method(index); - QVERIFY(testObject->voidSlotIntArgument() == -1); + QCOMPARE(testObject->voidSlotIntArgument(), -1); QVERIFY(voidSlotInt.invoke(testObject.data(), Q_ARG(int, 123))); QCOMPARE(testObject->voidSlotIntArgument(), 123); } @@ -1658,7 +1653,7 @@ void tst_QMetaObjectBuilder::usage_connect() QVERIFY(QObject::connect(testObject.data(), SIGNAL(intPropChanged(int)), testObject.data(), SLOT(voidSlotInt(int)))); - QVERIFY(testObject->voidSlotIntArgument() == -1); + QCOMPARE(testObject->voidSlotIntArgument(), -1); testObject->setProperty("intProp", 123); QCOMPARE(testObject->voidSlotIntArgument(), 123); @@ -1674,7 +1669,7 @@ void tst_QMetaObjectBuilder::usage_templateConnect() testObject.data(), &TestObject::voidSlotInt); QVERIFY(con); - QVERIFY(testObject->voidSlotIntArgument() == -1); + QCOMPARE(testObject->voidSlotIntArgument(), -1); testObject->setProperty("intProp", 123); QCOMPARE(testObject->voidSlotIntArgument(), 123); diff --git a/tests/auto/corelib/kernel/qmetaproperty/qmetaproperty.pro b/tests/auto/corelib/kernel/qmetaproperty/qmetaproperty.pro index f103abdd2b..1f338a909b 100644 --- a/tests/auto/corelib/kernel/qmetaproperty/qmetaproperty.pro +++ b/tests/auto/corelib/kernel/qmetaproperty/qmetaproperty.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qmetaproperty QT = core testlib SOURCES = tst_qmetaproperty.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp b/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp index 22c78f8e48..681a5d0146 100644 --- a/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp +++ b/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro index fc262b8fc7..1d4e647a4b 100644 --- a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro +++ b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qmetatype QT = core testlib INCLUDEPATH += $$PWD/../../../other/qvariant_common diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index e35790351d..fbb6a30917 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -193,8 +188,11 @@ protected: Bar space[1]; space[0].~Bar(); + const QByteArray postFix = '_' + + QByteArray::number(reinterpret_cast<quintptr>(QThread::currentThreadId())); + for (int i = 0; i < 1000; ++i) { - const QByteArray name = QString("Bar%1_%2").arg(i).arg((size_t)QThread::currentThreadId()).toLatin1(); + const QByteArray name = "Bar" + QByteArray::number(i) + postFix; const char *nm = name.constData(); int tp = qRegisterMetaType<Bar>(nm); #if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) @@ -2394,8 +2392,8 @@ void tst_QMetaType::compareCustomEqualOnlyType() QVERIFY(variant50 != variant100x); QVERIFY(variant100 != variant50); QVERIFY(variant100x != variant50); - QVERIFY(variant100 == variant100x); - QVERIFY(variant100 == variant100); + QCOMPARE(variant100, variant100x); + QCOMPARE(variant100, variant100); // compare always fails QVERIFY(!(variant50 < variant50)); diff --git a/tests/auto/corelib/kernel/qmimedata/qmimedata.pro b/tests/auto/corelib/kernel/qmimedata/qmimedata.pro index 51389da6ee..502ec78024 100644 --- a/tests/auto/corelib/kernel/qmimedata/qmimedata.pro +++ b/tests/auto/corelib/kernel/qmimedata/qmimedata.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qmimedata QT += testlib SOURCES = tst_qmimedata.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp b/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp index d368d9961b..e3b2399456 100644 --- a/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp +++ b/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -101,7 +96,7 @@ void tst_QMimeData::data() const // set text, verify mimeData.setData("text/plain", "pirates"); QCOMPARE(mimeData.data("text/plain"), QByteArray("pirates")); - QVERIFY(mimeData.data("text/html").length() == 0); + QCOMPARE(mimeData.data("text/html").length(), 0); // html time mimeData.setData("text/html", "ninjas"); diff --git a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.cpp b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.cpp index 93146a9b66..57fb1eb836 100644 --- a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.cpp +++ b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.h b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.h index 6f4fbf88ac..e6e40c35d9 100644 --- a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.h +++ b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.h @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro index b08dfb1838..125915047a 100644 --- a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro +++ b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro @@ -12,4 +12,3 @@ SOURCES += signalbug.cpp # This app is testdata for tst_qobject target.path = $$[QT_INSTALL_TESTS]/tst_qobject/$$TARGET INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qobject/test/test.pro b/tests/auto/corelib/kernel/qobject/test/test.pro index 3ac728931d..f3bc045455 100644 --- a/tests/auto/corelib/kernel/qobject/test/test.pro +++ b/tests/auto/corelib/kernel/qobject/test/test.pro @@ -1,5 +1,4 @@ CONFIG += testcase console -CONFIG += parallel_test TARGET = ../tst_qobject QT = core-private network testlib SOURCES = ../tst_qobject.cpp diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 46889225eb..b605b89f34 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -134,6 +129,7 @@ private slots: void returnValue2_data(); void returnValue2(); void connectVirtualSlots(); + void connectSlotsVMIClass(); // VMI = Virtual or Multiple Inheritance void connectPrivateSlots(); void connectFunctorArgDifference(); void connectFunctorOverloads(); @@ -148,6 +144,7 @@ private slots: void qmlConnect(); void exceptions(); void noDeclarativeParentChangedOnDestruction(); + void deleteLaterInAboutToBlockHandler(); void mutableFunctor(); }; @@ -2045,57 +2042,57 @@ void tst_QObject::metamethod() m = mobj->method(mobj->indexOfMethod("invoke1()")); QVERIFY(m.methodSignature() == "invoke1()"); - QVERIFY(m.methodType() == QMetaMethod::Method); - QVERIFY(m.access() == QMetaMethod::Public); + QCOMPARE(m.methodType(), QMetaMethod::Method); + QCOMPARE(m.access(), QMetaMethod::Public); QVERIFY(!(m.attributes() & QMetaMethod::Scriptable)); QVERIFY(!(m.attributes() & QMetaMethod::Compatibility)); m = mobj->method(mobj->indexOfMethod("sinvoke1()")); QVERIFY(m.methodSignature() == "sinvoke1()"); - QVERIFY(m.methodType() == QMetaMethod::Method); - QVERIFY(m.access() == QMetaMethod::Public); + QCOMPARE(m.methodType(), QMetaMethod::Method); + QCOMPARE(m.access(), QMetaMethod::Public); QVERIFY((m.attributes() & QMetaMethod::Scriptable)); QVERIFY(!(m.attributes() & QMetaMethod::Compatibility)); m = mobj->method(mobj->indexOfMethod("invoke2()")); QVERIFY(m.methodSignature() == "invoke2()"); - QVERIFY(m.methodType() == QMetaMethod::Method); - QVERIFY(m.access() == QMetaMethod::Protected); + QCOMPARE(m.methodType(), QMetaMethod::Method); + QCOMPARE(m.access(), QMetaMethod::Protected); QVERIFY(!(m.attributes() & QMetaMethod::Scriptable)); QVERIFY((m.attributes() & QMetaMethod::Compatibility)); m = mobj->method(mobj->indexOfMethod("sinvoke2()")); QVERIFY(m.methodSignature() == "sinvoke2()"); - QVERIFY(m.methodType() == QMetaMethod::Method); - QVERIFY(m.access() == QMetaMethod::Protected); + QCOMPARE(m.methodType(), QMetaMethod::Method); + QCOMPARE(m.access(), QMetaMethod::Protected); QVERIFY((m.attributes() & QMetaMethod::Scriptable)); QVERIFY((m.attributes() & QMetaMethod::Compatibility)); m = mobj->method(mobj->indexOfMethod("invoke3()")); QVERIFY(m.methodSignature() == "invoke3()"); - QVERIFY(m.methodType() == QMetaMethod::Method); - QVERIFY(m.access() == QMetaMethod::Private); + QCOMPARE(m.methodType(), QMetaMethod::Method); + QCOMPARE(m.access(), QMetaMethod::Private); QVERIFY(!(m.attributes() & QMetaMethod::Scriptable)); QVERIFY(!(m.attributes() & QMetaMethod::Compatibility)); m = mobj->method(mobj->indexOfMethod("sinvoke3()")); QVERIFY(m.methodSignature() == "sinvoke3()"); - QVERIFY(m.methodType() == QMetaMethod::Method); - QVERIFY(m.access() == QMetaMethod::Private); + QCOMPARE(m.methodType(), QMetaMethod::Method); + QCOMPARE(m.access(), QMetaMethod::Private); QVERIFY((m.attributes() & QMetaMethod::Scriptable)); QVERIFY(!(m.attributes() & QMetaMethod::Compatibility)); m = mobj->method(mobj->indexOfMethod("signal5()")); QVERIFY(m.methodSignature() == "signal5()"); - QVERIFY(m.methodType() == QMetaMethod::Signal); - QVERIFY(m.access() == QMetaMethod::Public); + QCOMPARE(m.methodType(), QMetaMethod::Signal); + QCOMPARE(m.access(), QMetaMethod::Public); QVERIFY(!(m.attributes() & QMetaMethod::Scriptable)); QVERIFY((m.attributes() & QMetaMethod::Compatibility)); m = mobj->method(mobj->indexOfMethod("aPublicSlot()")); QVERIFY(m.methodSignature() == "aPublicSlot()"); - QVERIFY(m.methodType() == QMetaMethod::Slot); - QVERIFY(m.access() == QMetaMethod::Public); + QCOMPARE(m.methodType(), QMetaMethod::Slot); + QCOMPARE(m.access(), QMetaMethod::Public); QVERIFY(!(m.attributes() & QMetaMethod::Scriptable)); QVERIFY(!(m.attributes() & QMetaMethod::Compatibility)); @@ -2367,7 +2364,7 @@ void tst_QObject::testUserData() int id = user_data_ids[i]; CustomData *data = static_cast<CustomData *>(my_test_object.userData(id)); QVERIFY(data != 0); - QVERIFY(data->id == id); + QCOMPARE(data->id, id); } } @@ -2909,12 +2906,12 @@ void tst_QObject::floatProperty() QVERIFY(idx > 0); QMetaProperty prop = obj.metaObject()->property(idx); QVERIFY(prop.isValid()); - QVERIFY(prop.type() == uint(QMetaType::type("float"))); + QCOMPARE(int(prop.type()), QMetaType::type("float")); QVERIFY(!prop.write(&obj, QVariant("Hello"))); QVERIFY(prop.write(&obj, QVariant::fromValue(128.0f))); QVariant v = prop.read(&obj); - QVERIFY(int(v.userType()) == QMetaType::Float); - QVERIFY(qvariant_cast<float>(v) == 128.0f); + QCOMPARE(v.userType(), int(QMetaType::Float)); + QCOMPARE(qvariant_cast<float>(v), 128.0f); } void tst_QObject::qrealProperty() @@ -2924,18 +2921,18 @@ void tst_QObject::qrealProperty() QVERIFY(idx > 0); QMetaProperty prop = obj.metaObject()->property(idx); QVERIFY(prop.isValid()); - QVERIFY(prop.type() == uint(QMetaType::type("qreal"))); + QCOMPARE(int(prop.type()), QMetaType::type("qreal")); QVERIFY(!prop.write(&obj, QVariant("Hello"))); QVERIFY(prop.write(&obj, QVariant::fromValue(128.0f))); QVariant v = prop.read(&obj); QCOMPARE(v.userType(), qMetaTypeId<qreal>()); - QVERIFY(qvariant_cast<qreal>(v) == 128.0); + QCOMPARE(qvariant_cast<qreal>(v), 128.0); QVERIFY(prop.write(&obj, QVariant::fromValue(double(127)))); v = prop.read(&obj); QCOMPARE(v.userType(), qMetaTypeId<qreal>()); - QVERIFY(qvariant_cast<qreal>(v) == 127.0); + QCOMPARE(qvariant_cast<qreal>(v), 127.0); } class DynamicPropertyObject : public PropertyObject @@ -3001,7 +2998,7 @@ void tst_QObject::recursiveSignalEmission() proc.start(path); QVERIFY2(proc.waitForStarted(), qPrintable(QString::fromLatin1("Cannot start '%1': %2").arg(path, proc.errorString()))); QVERIFY(proc.waitForFinished()); - QVERIFY(proc.exitStatus() == QProcess::NormalExit); + QCOMPARE(proc.exitStatus(), QProcess::NormalExit); QCOMPARE(proc.exitCode(), 0); #endif } @@ -5611,6 +5608,112 @@ void tst_QObject::connectVirtualSlots() */ } +struct VirtualBase +{ + int virtual_base_count; + VirtualBase() : virtual_base_count(0) {} + virtual ~VirtualBase() {} + virtual void slot2() = 0; +}; + +class ObjectWithVirtualBase : public VirtualSlotsObject, public virtual VirtualBase +{ + Q_OBJECT +public: + ObjectWithVirtualBase() : regular_call_count(0), derived_counter2(0) {} + int regular_call_count; + int derived_counter2; + +public slots: + void regularSlot() { ++regular_call_count; } + virtual void slot1() { ++derived_counter2; } + virtual void slot2() { ++virtual_base_count; } +}; + +// VMI = Virtual or Multiple Inheritance +// (in this case, both) +void tst_QObject::connectSlotsVMIClass() +{ + // test connecting by the base + { + ObjectWithVirtualBase obj; + QVERIFY( QObject::connect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &VirtualSlotsObjectBase::slot1, Qt::UniqueConnection)); + QVERIFY(!QObject::connect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &VirtualSlotsObjectBase::slot1, Qt::UniqueConnection)); + + emit obj.signal1(); + QCOMPARE(obj.base_counter1, 0); + QCOMPARE(obj.derived_counter1, 0); + QCOMPARE(obj.derived_counter2, 1); + QCOMPARE(obj.virtual_base_count, 0); + + QVERIFY(QObject::disconnect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &VirtualSlotsObjectBase::slot1)); + QVERIFY(!QObject::disconnect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &VirtualSlotsObjectBase::slot1)); + + emit obj.signal1(); + QCOMPARE(obj.base_counter1, 0); + QCOMPARE(obj.derived_counter1, 0); + QCOMPARE(obj.derived_counter2, 1); + QCOMPARE(obj.virtual_base_count, 0); + } + + // test connecting with the actual class + { + ObjectWithVirtualBase obj; + QVERIFY( QObject::connect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &ObjectWithVirtualBase::regularSlot, Qt::UniqueConnection)); + QVERIFY(!QObject::connect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &ObjectWithVirtualBase::regularSlot, Qt::UniqueConnection)); + QVERIFY( QObject::connect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &ObjectWithVirtualBase::slot1, Qt::UniqueConnection)); + QVERIFY(!QObject::connect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &ObjectWithVirtualBase::slot1, Qt::UniqueConnection)); + + emit obj.signal1(); + QCOMPARE(obj.base_counter1, 0); + QCOMPARE(obj.derived_counter1, 0); + QCOMPARE(obj.derived_counter2, 1); + QCOMPARE(obj.regular_call_count, 1); + QCOMPARE(obj.virtual_base_count, 0); + + QVERIFY( QObject::disconnect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &ObjectWithVirtualBase::regularSlot)); + QVERIFY(!QObject::disconnect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &ObjectWithVirtualBase::regularSlot)); + QVERIFY( QObject::disconnect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &ObjectWithVirtualBase::slot1)); + QVERIFY(!QObject::disconnect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &ObjectWithVirtualBase::slot1)); + + emit obj.signal1(); + QCOMPARE(obj.base_counter1, 0); + QCOMPARE(obj.derived_counter1, 0); + QCOMPARE(obj.derived_counter2, 1); + QCOMPARE(obj.regular_call_count, 1); + QCOMPARE(obj.virtual_base_count, 0); + + /* the C++ standard say the comparison between pointer to virtual member function is unspecified + QVERIFY( QObject::connect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &VirtualSlotsObjectBase::slot1, Qt::UniqueConnection)); + QVERIFY(!QObject::connect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &ObjectWithVirtualBase::slot1, Qt::UniqueConnection)); + */ + } + + // test connecting a slot that is virtual from the virtual base + { + ObjectWithVirtualBase obj; + QVERIFY( QObject::connect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &ObjectWithVirtualBase::slot2, Qt::UniqueConnection)); + QVERIFY(!QObject::connect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &ObjectWithVirtualBase::slot2, Qt::UniqueConnection)); + + emit obj.signal1(); + QCOMPARE(obj.base_counter1, 0); + QCOMPARE(obj.derived_counter1, 0); + QCOMPARE(obj.derived_counter2, 0); + QCOMPARE(obj.virtual_base_count, 1); + QCOMPARE(obj.regular_call_count, 0); + + QVERIFY( QObject::disconnect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &ObjectWithVirtualBase::slot2)); + QVERIFY(!QObject::disconnect(&obj, &VirtualSlotsObjectBase::signal1, &obj, &ObjectWithVirtualBase::slot2)); + + emit obj.signal1(); + QCOMPARE(obj.base_counter1, 0); + QCOMPARE(obj.derived_counter1, 0); + QCOMPARE(obj.derived_counter2, 0); + QCOMPARE(obj.virtual_base_count, 1); + QCOMPARE(obj.regular_call_count, 0); + } +} + #ifndef QT_BUILD_INTERNAL void tst_QObject::connectPrivateSlots() {QSKIP("Needs QT_BUILD_INTERNAL");} @@ -5801,6 +5904,102 @@ void tst_QObject::connectFunctorWithContext() context->deleteLater(); } +class StatusChanger : public QObject +{ + Q_OBJECT +public: + StatusChanger(int *status) : m_status(status) + { + } + ~StatusChanger() + { + *m_status = 2; + } +private: + int *m_status; +}; + +class DispatcherWatcher : public QObject +{ + Q_OBJECT +public: + DispatcherWatcher(QEventLoop &e, int *statusAwake, int *statusAboutToBlock) : + m_eventLoop(&e), + m_statusAwake(statusAwake), + m_statusAboutToBlock(statusAboutToBlock), + m_aboutToBlocks(0), + m_awakes(0) + { + awake = new StatusChanger(statusAwake); + abouttoblock = new StatusChanger(statusAboutToBlock); + QCOMPARE(*statusAwake, 1); + QCOMPARE(*statusAboutToBlock, 1); + connect(QAbstractEventDispatcher::instance(), SIGNAL(awake()), this, SLOT(onAwake())); + connect(QAbstractEventDispatcher::instance(), SIGNAL(aboutToBlock()), this, SLOT(onAboutToBlock())); + + } + + ~DispatcherWatcher() + { + if (awake) + awake->deleteLater(); + if (abouttoblock) + abouttoblock->deleteLater(); + } + +public slots: + // The order of these 2 handlers differs on different event dispatchers + void onAboutToBlock() + { + if (abouttoblock) { + abouttoblock->deleteLater(); + abouttoblock = 0; + } + ++m_aboutToBlocks; + } + void onAwake() + { + if (awake) { + awake->deleteLater(); + awake = 0; + } + ++m_awakes; + + } + void onSignal1() + { + // Status check. At this point the event loop should have spinned enough to delete all the objects. + QCOMPARE(*m_statusAwake, 2); + QCOMPARE(*m_statusAboutToBlock, 2); + QMetaObject::invokeMethod(m_eventLoop, "quit", Qt::QueuedConnection); + } + +private: + StatusChanger *awake; + StatusChanger *abouttoblock; + QEventLoop *m_eventLoop; + int *m_statusAwake; + int *m_statusAboutToBlock; + int m_aboutToBlocks; + int m_awakes; +}; + + +void tst_QObject::deleteLaterInAboutToBlockHandler() +{ + int statusAwake = 1; + int statusAboutToBlock = 1; + QEventLoop e; + DispatcherWatcher dw(e, &statusAwake, &statusAboutToBlock); + QTimer::singleShot(2000, &dw, &DispatcherWatcher::onSignal1); + + QCOMPARE(statusAwake, 1); + QCOMPARE(statusAboutToBlock, 1); + e.exec(); + QCOMPARE(statusAwake, 2); + QCOMPARE(statusAboutToBlock, 2); +} + void tst_QObject::connectFunctorWithContextUnique() { // Qt::UniqueConnections currently don't work for functors, but we need to diff --git a/tests/auto/corelib/kernel/qpointer/qpointer.pro b/tests/auto/corelib/kernel/qpointer/qpointer.pro index 4b573cb6a5..02765efdbd 100644 --- a/tests/auto/corelib/kernel/qpointer/qpointer.pro +++ b/tests/auto/corelib/kernel/qpointer/qpointer.pro @@ -1,7 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpointer QT = core testlib qtHaveModule(widgets): QT += widgets SOURCES = tst_qpointer.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp index f3f485297a..914f9e2b9b 100644 --- a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp +++ b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/corelib/kernel/qsharedmemory/sharedmemoryhelper/main.cpp b/tests/auto/corelib/kernel/qsharedmemory/sharedmemoryhelper/main.cpp index 03c5a13da9..ffbad37d82 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/sharedmemoryhelper/main.cpp +++ b/tests/auto/corelib/kernel/qsharedmemory/sharedmemoryhelper/main.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp index 43e25743d7..b6f6d2a7f3 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp +++ b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -147,7 +142,7 @@ void tst_QSharedMemory::init() { existingSharedMemory = new QSharedMemory(EXISTING_SHARE); if (!existingSharedMemory->create(EXISTING_SIZE)) { - QVERIFY(existingSharedMemory->error() == QSharedMemory::AlreadyExists); + QCOMPARE(existingSharedMemory->error(), QSharedMemory::AlreadyExists); } } @@ -246,10 +241,10 @@ void tst_QSharedMemory::constructor() QSharedMemory sm; QCOMPARE(sm.key(), QString()); QVERIFY(!sm.isAttached()); - QVERIFY(sm.data() == 0); + QVERIFY(!sm.data()); QCOMPARE(sm.size(), 0); QCOMPARE(sm.error(), QSharedMemory::NoError); - QVERIFY(sm.errorString() == QString()); + QCOMPARE(sm.errorString(), QString()); } void tst_QSharedMemory::key_data() @@ -290,8 +285,8 @@ void tst_QSharedMemory::key() QCOMPARE(sm.isAttached(), false); QCOMPARE(sm.error(), QSharedMemory::NoError); - QVERIFY(sm.errorString() == QString()); - QVERIFY(sm.data() == 0); + QCOMPARE(sm.errorString(), QString()); + QVERIFY(!sm.data()); QCOMPARE(sm.size(), 0); QCOMPARE(sm.detach(), false); @@ -330,11 +325,11 @@ void tst_QSharedMemory::create() qDebug() << sm.errorString(); QCOMPARE(sm.key(), key); if (canCreate) { - QVERIFY(sm.errorString() == QString()); + QCOMPARE(sm.errorString(), QString()); QVERIFY(sm.data() != 0); QVERIFY(sm.size() != 0); } else { - QVERIFY(sm.data() == 0); + QVERIFY(!sm.data()); QVERIFY(sm.errorString() != QString()); } } @@ -379,10 +374,10 @@ void tst_QSharedMemory::attach() QVERIFY(sm.size() != 0); QVERIFY(sm.detach()); QCOMPARE(sm.size(), 0); - QVERIFY(sm.data() == 0); + QVERIFY(!sm.data()); } else { - QVERIFY(sm.data() == 0); - QVERIFY(sm.size() == 0); + QVERIFY(!sm.data()); + QCOMPARE(sm.size(), 0); QVERIFY(sm.errorString() != QString()); QVERIFY(!sm.detach()); } @@ -483,7 +478,7 @@ void tst_QSharedMemory::useTooMuchMemory() bool success = true; int count = 0; while (success) { - QString key = QString("maxmemorytest_%1").arg(count++); + QString key = QLatin1String("maxmemorytest_") + QString::number(count++); QSharedMemory *sm = new QSharedMemory(rememberKey(key)); QVERIFY(sm); jail.append(sm); @@ -500,7 +495,7 @@ void tst_QSharedMemory::useTooMuchMemory() QVERIFY(!sm->isAttached()); QCOMPARE(sm->key(), key); QCOMPARE(sm->size(), 0); - QVERIFY(sm->data() == 0); + QVERIFY(!sm->data()); if (sm->error() != QSharedMemory::OutOfResources) qDebug() << sm->error() << sm->errorString(); // ### Linux won't return OutOfResources if there are not enough semaphores to use. @@ -537,7 +532,7 @@ void tst_QSharedMemory::attachTooMuch() QVERIFY(!war->isAttached()); QCOMPARE(war->key(), government.key()); QCOMPARE(war->size(), 0); - QVERIFY(war->data() == 0); + QVERIFY(!war->data()); QCOMPARE(war->error(), QSharedMemory::OutOfResources); QVERIFY(war->errorString() != QString()); QVERIFY(!war->detach()); diff --git a/tests/auto/corelib/kernel/qsignalblocker/qsignalblocker.pro b/tests/auto/corelib/kernel/qsignalblocker/qsignalblocker.pro index c6c6f379eb..6e4913db5d 100644 --- a/tests/auto/corelib/kernel/qsignalblocker/qsignalblocker.pro +++ b/tests/auto/corelib/kernel/qsignalblocker/qsignalblocker.pro @@ -1,7 +1,5 @@ CONFIG += testcase console -CONFIG += parallel_test TARGET = tst_qsignalblocker QT = core testlib SOURCES = tst_qsignalblocker.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qsignalblocker/tst_qsignalblocker.cpp b/tests/auto/corelib/kernel/qsignalblocker/tst_qsignalblocker.cpp index 9a2dfb451b..fd18f00cd0 100644 --- a/tests/auto/corelib/kernel/qsignalblocker/tst_qsignalblocker.cpp +++ b/tests/auto/corelib/kernel/qsignalblocker/tst_qsignalblocker.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@woboq.com> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro b/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro index 526db5eef3..418d6dce62 100644 --- a/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro +++ b/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsignalmapper QT = core testlib SOURCES = tst_qsignalmapper.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp b/tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp index 579aa78ac4..c03e3e8e9f 100644 --- a/tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp +++ b/tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -97,16 +92,16 @@ void tst_QSignalMapper::mapped() connect(&mapper, SIGNAL(mapped(QString)), &target, SLOT(myslot(QString))); src1.emit_mysignal(20); - QVERIFY(target.id == 1); + QCOMPARE(target.id, 1); QVERIFY(target.str.isEmpty()); src2.emit_mysignal(20); - QVERIFY(target.id == 2); - QVERIFY(target.str == "two"); + QCOMPARE(target.id, 2); + QCOMPARE(target.str, QLatin1String("two")); src3.emit_mysignal(20); - QVERIFY(target.id == 2); - QVERIFY(target.str == "three"); + QCOMPARE(target.id, 2); + QCOMPARE(target.str, QLatin1String("three")); } QTEST_MAIN(tst_QSignalMapper) diff --git a/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro b/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro index 303a96c68f..58e4b98af7 100644 --- a/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro +++ b/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsocketnotifier QT = core-private network-private testlib SOURCES = tst_qsocketnotifier.cpp @@ -7,4 +6,3 @@ SOURCES = tst_qsocketnotifier.cpp requires(contains(QT_CONFIG,private_tests)) include(../../../network/socket/platformsocketengine/platformsocketengine.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp index 95e924bd77..1598382959 100644 --- a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp +++ b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -155,7 +150,7 @@ void tst_QSocketNotifier::unexpectedDisconnection() readEnd1.initialize(QAbstractSocket::TcpSocket); readEnd1.connectToHost(server.serverAddress(), server.serverPort()); QVERIFY(readEnd1.waitForWrite()); - QVERIFY(readEnd1.state() == QAbstractSocket::ConnectedState); + QCOMPARE(readEnd1.state(), QAbstractSocket::ConnectedState); QVERIFY(server.waitForNewConnection()); QTcpSocket *writeEnd1 = server.nextPendingConnection(); QVERIFY(writeEnd1 != 0); @@ -164,7 +159,7 @@ void tst_QSocketNotifier::unexpectedDisconnection() readEnd2.initialize(QAbstractSocket::TcpSocket); readEnd2.connectToHost(server.serverAddress(), server.serverPort()); QVERIFY(readEnd2.waitForWrite()); - QVERIFY(readEnd2.state() == QAbstractSocket::ConnectedState); + QCOMPARE(readEnd2.state(), QAbstractSocket::ConnectedState); QVERIFY(server.waitForNewConnection()); QTcpSocket *writeEnd2 = server.nextPendingConnection(); QVERIFY(writeEnd2 != 0); @@ -190,8 +185,8 @@ void tst_QSocketNotifier::unexpectedDisconnection() QVERIFY(timer.isActive()); //escape if test would hang } while(tester.sequence <= 0); - QVERIFY(readEnd1.state() == QAbstractSocket::ConnectedState); - QVERIFY(readEnd2.state() == QAbstractSocket::ConnectedState); + QCOMPARE(readEnd1.state(), QAbstractSocket::ConnectedState); + QCOMPARE(readEnd2.state(), QAbstractSocket::ConnectedState); QCOMPARE(tester.sequence, 2); diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/systemsemaphorehelper/main.cpp b/tests/auto/corelib/kernel/qsystemsemaphore/systemsemaphorehelper/main.cpp index e7e92e55ac..7bfb6b16cc 100644 --- a/tests/auto/corelib/kernel/qsystemsemaphore/systemsemaphorehelper/main.cpp +++ b/tests/auto/corelib/kernel/qsystemsemaphore/systemsemaphorehelper/main.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp index 169a13aff2..641ea5fc9d 100644 --- a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp +++ b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -191,13 +186,13 @@ void tst_QSystemSemaphore::basicProcesses() acquire.start(m_helperBinary, QStringList("acquire")); QVERIFY2(acquire.waitForStarted(), "Could not start helper binary"); acquire.waitForFinished(HELPERWAITTIME); - QVERIFY(acquire.state() == QProcess::Running); + QCOMPARE(acquire.state(), QProcess::Running); acquire.kill(); release.start(m_helperBinary, QStringList("release")); QVERIFY2(release.waitForStarted(), "Could not start helper binary"); acquire.waitForFinished(HELPERWAITTIME); release.waitForFinished(HELPERWAITTIME); - QVERIFY(acquire.state() == QProcess::NotRunning); + QCOMPARE(acquire.state(), QProcess::NotRunning); #endif } diff --git a/tests/auto/corelib/kernel/qtimer/qtimer.pro b/tests/auto/corelib/kernel/qtimer/qtimer.pro index 48adf07f64..8afdbb148e 100644 --- a/tests/auto/corelib/kernel/qtimer/qtimer.pro +++ b/tests/auto/corelib/kernel/qtimer/qtimer.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtimer QT = core testlib SOURCES = tst_qtimer.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index b34a3a6beb..6fd192c357 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -1,31 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -529,7 +525,7 @@ void tst_QTimer::restartedTimerFiresTooSoon() { RestartedTimerFiresTooSoonObject object; object.timerFired(); - QVERIFY(object.eventLoop.exec() == 0); + QCOMPARE(object.eventLoop.exec(), 0); } class LongLastingSlotClass : public QObject diff --git a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro index c9b160a8d1..e673278920 100644 --- a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro +++ b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro @@ -1,9 +1,9 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtranslator QT = core testlib SOURCES = tst_qtranslator.cpp RESOURCES += qtranslator.qrc -android:!android-no-sdk: RESOURCES += android_testdata.qrc +android: RESOURCES += android_testdata.qrc else: TESTDATA += dependencies_la.qm hellotr_la.qm msgfmt_from_po.qm diff --git a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp index c2290add5b..66971af7b4 100644 --- a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp +++ b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -69,7 +64,7 @@ tst_QTranslator::tst_QTranslator() void tst_QTranslator::initTestCase() { -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QString sourceDir(":/android_testdata/"); QDirIterator it(sourceDir, QDirIterator::Subdirectories); while (it.hasNext()) { @@ -116,7 +111,7 @@ void tst_QTranslator::load() QTranslator tor( 0 ); tor.load("hellotr_la"); QVERIFY(!tor.isEmpty()); - QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QLatin1String("Hallo Welt!")); } void tst_QTranslator::load2() @@ -127,7 +122,7 @@ void tst_QTranslator::load2() QByteArray data = file.readAll(); tor.load((const uchar *)data.constData(), data.length()); QVERIFY(!tor.isEmpty()); - QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QLatin1String("Hallo Welt!")); } class TranslatorThread : public QThread @@ -138,7 +133,7 @@ class TranslatorThread : public QThread if (tor.isEmpty()) qFatal("Could not load translation"); - if (tor.translate("QPushButton", "Hello world!") != QString::fromLatin1("Hallo Welt!")) + if (tor.translate("QPushButton", "Hello world!") != QLatin1String("Hallo Welt!")) qFatal("Test string was not translated correctlys"); } }; @@ -221,9 +216,9 @@ void tst_QTranslator::plural() tor.load("hellotr_la"); QVERIFY(!tor.isEmpty()); QCoreApplication::installTranslator(&tor); - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 0), QString::fromLatin1("Hallo 0 Welten!")); - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 1), QString::fromLatin1("Hallo 1 Welt!")); - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 2), QString::fromLatin1("Hallo 2 Welten!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 0), QLatin1String("Hallo 0 Welten!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 1), QLatin1String("Hallo 1 Welt!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 2), QLatin1String("Hallo 2 Welten!")); } void tst_QTranslator::translate_qm_file_generated_with_msgfmt() @@ -249,7 +244,7 @@ void tst_QTranslator::loadFromResource() QTranslator tor; tor.load(":/tst_qtranslator/hellotr_la.qm"); QVERIFY(!tor.isEmpty()); - QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QLatin1String("Hallo Welt!")); } void tst_QTranslator::loadDirectory() @@ -269,16 +264,16 @@ void tst_QTranslator::dependencies() QTranslator tor; tor.load("dependencies_la"); QVERIFY(!tor.isEmpty()); - QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QLatin1String("Hallo Welt!")); // plural QCoreApplication::installTranslator(&tor); - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 0), QString::fromLatin1("Hallo 0 Welten!")); - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 1), QString::fromLatin1("Hallo 1 Welt!")); - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 2), QString::fromLatin1("Hallo 2 Welten!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 0), QLatin1String("Hallo 0 Welten!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 1), QLatin1String("Hallo 1 Welt!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 2), QLatin1String("Hallo 2 Welten!")); // pick up translation from the file with dependencies - QCOMPARE(tor.translate("QPushButton", "It's a small world"), QString::fromLatin1("Es ist eine kleine Welt")); + QCOMPARE(tor.translate("QPushButton", "It's a small world"), QLatin1String("Es ist eine kleine Welt")); } { @@ -288,7 +283,7 @@ void tst_QTranslator::dependencies() QByteArray data = file.readAll(); tor.load((const uchar *)data.constData(), data.length()); QVERIFY(!tor.isEmpty()); - QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QLatin1String("Hallo Welt!")); } } diff --git a/tests/auto/corelib/kernel/qvariant/qvariant.pro b/tests/auto/corelib/kernel/qvariant/qvariant.pro index 39178ba9e6..33e8b6e2ad 100644 --- a/tests/auto/corelib/kernel/qvariant/qvariant.pro +++ b/tests/auto/corelib/kernel/qvariant/qvariant.pro @@ -1,9 +1,11 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qvariant -QT = core testlib +QT = core-private testlib INCLUDEPATH += $$PWD/../../../other/qvariant_common SOURCES = tst_qvariant.cpp RESOURCES += qvariant.qrc DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 contains(QT_CONFIG, c++11): CONFIG += c++11 +!contains(QT_CONFIG, doubleconversion):!contains(QT_CONFIG, system-doubleconversion) { + DEFINES += QT_NO_DOUBLECONVERSION +} diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 509eed231d..75fa424ab1 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -1,33 +1,28 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com> -** Copyright (C) 2015 Intel Corporation. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com> +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -57,6 +52,7 @@ #include <QBuffer> #include "qnumeric.h" +#include <private/qlocale_p.h> #include "tst_qvariant_common.h" class CustomNonQObject; @@ -355,13 +351,13 @@ void tst_QVariant::constructor_invalid() QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Trying to construct an instance of an invalid type, type id:")); QVariant variant(static_cast<QVariant::Type>(typeId)); QVERIFY(!variant.isValid()); - QVERIFY(variant.userType() == QMetaType::UnknownType); + QCOMPARE(variant.userType(), int(QMetaType::UnknownType)); } { QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Trying to construct an instance of an invalid type, type id:")); QVariant variant(typeId, /* copy */ 0); QVERIFY(!variant.isValid()); - QVERIFY(variant.userType() == QMetaType::UnknownType); + QCOMPARE(variant.userType(), int(QMetaType::UnknownType)); } } @@ -905,7 +901,7 @@ void tst_QVariant::toFloat() bool ok; float d = value.toFloat(&ok); QCOMPARE(d, result); - QVERIFY(ok == valueOK); + QCOMPARE(ok, valueOK); } void tst_QVariant::toLongLong_data() @@ -1032,7 +1028,11 @@ void tst_QVariant::toByteArray_data() QTest::newRow( "int" ) << QVariant( -123 ) << QByteArray( "-123" ); QTest::newRow( "uint" ) << QVariant( (uint)123 ) << QByteArray( "123" ); QTest::newRow( "double" ) << QVariant( 123.456 ) << QByteArray( "123.456" ); - QTest::newRow( "float" ) << QVariant( 123.456f ) << QByteArray( "123.456001" ); + + // Conversion from float to double adds bits of which the double-to-string converter doesn't + // know they're insignificant + QTest::newRow( "float" ) << QVariant( 123.456f ) << QByteArray( "123.45600128173828" ); + QTest::newRow( "longlong" ) << QVariant( (qlonglong)34 ) << QByteArray( "34" ); QTest::newRow( "ulonglong" ) << QVariant( (qulonglong)34 ) << QByteArray( "34" ); } @@ -1058,7 +1058,11 @@ void tst_QVariant::toString_data() QTest::newRow( "int" ) << QVariant( -123 ) << QString( "-123" ); QTest::newRow( "uint" ) << QVariant( (uint)123 ) << QString( "123" ); QTest::newRow( "double" ) << QVariant( 123.456 ) << QString( "123.456" ); - QTest::newRow( "float" ) << QVariant( 123.456f ) << QString( "123.456001" ); + + // Conversion from float to double adds bits of which the double-to-string converter doesn't + // know they're insignificant + QTest::newRow( "float" ) << QVariant( 123.456f ) << QString( "123.45600128173828" ); + QTest::newRow( "bool" ) << QVariant( true ) << QString( "true" ); QTest::newRow( "qdate" ) << QVariant( QDate( 2002, 1, 1 ) ) << QString( "2002-01-01" ); QTest::newRow( "qtime" ) << QVariant( QTime( 12, 34, 56 ) ) << QString( "12:34:56" ); @@ -1327,9 +1331,9 @@ void tst_QVariant::writeToReadFromDataStream() // the uninitialized float can be NaN (observed on Windows Mobile 5 ARMv4i) float readFloat = qvariant_cast<float>(readVariant); float writtenFloat = qvariant_cast<float>(writeVariant); - QVERIFY(qIsNaN(readFloat) == qIsNaN(writtenFloat)); + QCOMPARE(qIsNaN(readFloat), qIsNaN(writtenFloat)); if (!qIsNaN(readFloat)) - QVERIFY(readFloat == writtenFloat); + QCOMPARE(readFloat, writtenFloat); } break; } @@ -1415,12 +1419,28 @@ void tst_QVariant::operator_eq_eq_data() QVariant mUIntQString(QString("42")); QVariant mDouble(42.11); +#ifdef QT_NO_DOUBLECONVERSION + // Without libdouble-conversion we don't get the shortest possible representation. QVariant mDoubleString(QByteArray("42.109999999999999")); - QVariant mDoubleQString(QString("42.109999999999999")); + QVariant mDoubleQString(QByteArray("42.109999999999999")); +#else + // You cannot fool the double-to-string conversion into producing insignificant digits with + // libdouble-conversion. You can, of course, add insignificant digits to the string and fool + // the double-to-double comparison after converting the string to a double. + QVariant mDoubleString(QByteArray("42.11")); + QVariant mDoubleQString(QString("42.11")); +#endif + // Float-to-double conversion produces insignificant extra bits. QVariant mFloat(42.11f); - QVariant mFloatString(QByteArray("42.1100006")); - QVariant mFloatQString(QString("42.1100006")); +#ifdef QT_NO_DOUBLECONVERSION + // The trailing '2' is not significant, but snprintf doesn't know this. + QVariant mFloatString(QByteArray("42.110000610351562")); + QVariant mFloatQString(QString("42.110000610351562")); +#else + QVariant mFloatString(QByteArray("42.11000061035156")); + QVariant mFloatQString(QString("42.11000061035156")); +#endif QVariant mLongLong((qlonglong)-42); QVariant mLongLongString(QByteArray("-42")); @@ -2126,7 +2146,7 @@ void tst_QVariant::userType() QVERIFY(!userVar.canConvert(QVariant::String)); QVariant userVar2(userVar); - QVERIFY(userVar == userVar2); + QCOMPARE(userVar, userVar2); userVar2.setValue(data2); QVERIFY(userVar != userVar2); @@ -2140,7 +2160,7 @@ void tst_QVariant::userType() userVar3.setValue(data2); userVar3 = userVar2; - QVERIFY(userVar2 == userVar3); + QCOMPARE(userVar2, userVar3); } // At this point all QVariants got destroyed but we have 2 MyType instances. QCOMPARE(instanceCount, 2); @@ -2155,7 +2175,7 @@ void tst_QVariant::userType() QVERIFY(!userVar.canConvert(QVariant::String)); QVariant userVar2(userVar); - QVERIFY(userVar == userVar2); + QCOMPARE(userVar, userVar2); userVar2.setValue(&data2); QVERIFY(userVar != userVar2); @@ -2169,10 +2189,10 @@ void tst_QVariant::userType() /* This check is correct now. userVar2 contains a pointer to data2 and so * does userVar3. */ - QVERIFY(userVar2 == userVar3); + QCOMPARE(userVar2, userVar3); userVar3 = userVar2; - QVERIFY(userVar2 == userVar3); + QCOMPARE(userVar2, userVar3); } QCOMPARE(instanceCount, 2); @@ -2457,7 +2477,7 @@ void tst_QVariant::saveLoadCustomTypes() qRegisterMetaTypeStreamOperators<Blah>("Blah"); QCOMPARE(v.userType(), tp); - QVERIFY(v.type() == QVariant::UserType); + QCOMPARE(v.type(), QVariant::UserType); { QDataStream stream(&data, QIODevice::WriteOnly); stream << v; @@ -2645,7 +2665,7 @@ void tst_QVariant::qvariant_cast_QObject_derived() { CustomQObjectDerivedNoMetaType *object = new CustomQObjectDerivedNoMetaType(this); QVariant data = QVariant::fromValue(object); - QVERIFY(data.userType() == qMetaTypeId<CustomQObjectDerivedNoMetaType*>()); + QCOMPARE(data.userType(), qMetaTypeId<CustomQObjectDerivedNoMetaType*>()); QCOMPARE(data.value<QObject *>(), object); QCOMPARE(data.value<CustomQObjectDerivedNoMetaType *>(), object); QCOMPARE(data.value<CustomQObject *>(), object); @@ -2654,7 +2674,7 @@ void tst_QVariant::qvariant_cast_QObject_derived() CustomQObjectDerived *object = new CustomQObjectDerived(this); QVariant data = QVariant::fromValue(object); - QVERIFY(data.userType() == qMetaTypeId<CustomQObjectDerived*>()); + QCOMPARE(data.userType(), qMetaTypeId<CustomQObjectDerived*>()); QCOMPARE(data.value<QObject *>(), object); QCOMPARE(data.value<CustomQObjectDerived *>(), object); @@ -2921,10 +2941,10 @@ void tst_QVariant::voidStar() const QVariant v1, v2; v1 = QVariant::fromValue(p1); v2 = v1; - QVERIFY(v1 == v2); + QCOMPARE(v1, v2); v2 = QVariant::fromValue(p2); - QVERIFY(v1 == v2); + QCOMPARE(v1, v2); p2 = 0; v2 = QVariant::fromValue(p2); @@ -2941,10 +2961,10 @@ void tst_QVariant::dataStar() const QCOMPARE(qvariant_cast<Data*>(v1), p1); QVariant v2 = v1; - QVERIFY(v1 == v2); + QCOMPARE(v1, v2); v2 = QVariant::fromValue(p1); - QVERIFY(v1 == v2); + QCOMPARE(v1, v2); delete p1; } @@ -3116,8 +3136,8 @@ void tst_QVariant::compareCustomTypes() const /* We compare pointers. */ QVERIFY(variant1 != variant2); - QVERIFY(variant1 == variant1); - QVERIFY(variant2 == variant2); + QCOMPARE(variant1, variant1); + QCOMPARE(variant2, variant2); } void tst_QVariant::timeToDateTime() const @@ -3340,7 +3360,7 @@ void tst_QVariant::toIntFromQString() const void tst_QVariant::toIntFromDouble() const { double d = 2147483630; // max int 2147483647 - QVERIFY((int)d == 2147483630); + QCOMPARE((int)d, 2147483630); QVariant var(d); QVERIFY( var.canConvert( QVariant::Int ) ); @@ -3425,10 +3445,11 @@ void tst_QVariant::numericalConvert() switch (v.userType()) { case QVariant::Double: - QCOMPARE(v.toString() , QString::number(num, 'g', DBL_MANT_DIG * std::log10(2.) + 2)); + QCOMPARE(v.toString() , QString::number(num, 'g', QLocale::FloatingPointShortest)); break; case QMetaType::Float: - QCOMPARE(v.toString() , QString::number(float(num), 'g', FLT_MANT_DIG * std::log10(2.) + 2)); + QCOMPARE(v.toString() , + QString::number(float(num), 'g', QLocale::FloatingPointShortest)); break; } } @@ -3664,8 +3685,17 @@ void tst_QVariant::moreCustomTypes() QCOMPARE(MyNotMovable::count, 0); { +#ifdef QT_NO_DOUBLECONVERSION + // snprintf cannot do "shortest" conversion and always adds noise. PLAY_WITH_VARIANT(12.12, false, "12.119999999999999", 12.12, true); - PLAY_WITH_VARIANT(12.12f, false, "12.1199999", 12.12f, true); +#else + // Double can be printed exactly with libdouble-conversion + PLAY_WITH_VARIANT(12.12, false, "12.12", 12.12, true); +#endif + + // Float is converted to double, adding insignificant bits + PLAY_WITH_VARIANT(12.12f, false, "12.119999885559082", 12.12f, true); + PLAY_WITH_VARIANT('a', false, "a", 'a', true); PLAY_WITH_VARIANT((unsigned char)('a'), false, "a", 'a', true); PLAY_WITH_VARIANT( quint8(12), false, "\xc", 12, true); @@ -4170,7 +4200,7 @@ void tst_QVariant::saveInvalid() QDataStream stream(&data, QIODevice::WriteOnly); stream.setVersion(version); stream << QVariant(); - QVERIFY(stream.status() == QDataStream::Ok); + QCOMPARE(stream.status(), QDataStream::Ok); QVERIFY(data.size() >= 4); QCOMPARE(int(data.constData()[0]), 0); QCOMPARE(int(data.constData()[1]), 0); @@ -4184,7 +4214,7 @@ void tst_QVariant::saveNewBuiltinWithOldStream() QDataStream stream(&data, QIODevice::WriteOnly); stream.setVersion(QDataStream::Qt_3_1); stream << QVariant::fromValue<QJsonValue>(123); // QJsonValue class was introduced in Qt5 - QVERIFY(stream.status() == QDataStream::Ok); + QCOMPARE(stream.status(), QDataStream::Ok); QVERIFY(data.size() >= 4); QCOMPARE(int(data.constData()[0]), 0); QCOMPARE(int(data.constData()[1]), 0); diff --git a/tests/auto/corelib/kernel/qwineventnotifier/qwineventnotifier.pro b/tests/auto/corelib/kernel/qwineventnotifier/qwineventnotifier.pro index f0ac7c621f..20ec7572fb 100644 --- a/tests/auto/corelib/kernel/qwineventnotifier/qwineventnotifier.pro +++ b/tests/auto/corelib/kernel/qwineventnotifier/qwineventnotifier.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qwineventnotifier QT = core-private testlib SOURCES = tst_qwineventnotifier.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp b/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp index 7fc28e2615..3221587300 100644 --- a/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp +++ b/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** 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:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** |