diff options
Diffstat (limited to 'tests/auto/corelib/global')
22 files changed, 333 insertions, 201 deletions
diff --git a/tests/auto/corelib/global/q_func_info/q_func_info.pro b/tests/auto/corelib/global/q_func_info/q_func_info.pro index aad0edf4ed..7663a880eb 100644 --- a/tests/auto/corelib/global/q_func_info/q_func_info.pro +++ b/tests/auto/corelib/global/q_func_info/q_func_info.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_q_func_info QT = core testlib SOURCES = tst_q_func_info.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/global/q_func_info/tst_q_func_info.cpp b/tests/auto/corelib/global/q_func_info/tst_q_func_info.cpp index 34eb8161e3..32e4217ad0 100644 --- a/tests/auto/corelib/global/q_func_info/tst_q_func_info.cpp +++ b/tests/auto/corelib/global/q_func_info/tst_q_func_info.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/global/qflags/qflags.pro b/tests/auto/corelib/global/qflags/qflags.pro index 7602008e22..29dfb0684c 100644 --- a/tests/auto/corelib/global/qflags/qflags.pro +++ b/tests/auto/corelib/global/qflags/qflags.pro @@ -1,7 +1,6 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qflags QT = core testlib SOURCES = tst_qflags.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 contains(QT_CONFIG, c++11): CONFIG += c++11 contains(QT_CONFIG, c++14): CONFIG += c++14 diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp index 1f2e7ca0cd..10902b6f55 100644 --- a/tests/auto/corelib/global/qflags/tst_qflags.cpp +++ b/tests/auto/corelib/global/qflags/tst_qflags.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$ ** @@ -43,6 +38,7 @@ private slots: void signedness(); void classEnum(); void initializerLists(); + void testSetFlags(); }; void tst_QFlags::testFlag() const @@ -283,6 +279,19 @@ void tst_QFlags::initializerLists() #endif // Q_COMPILER_INITIALIZER_LISTS } +void tst_QFlags::testSetFlags() +{ + Qt::MouseButtons btn = Qt::NoButton; + + btn.setFlag(Qt::LeftButton); + QVERIFY(btn.testFlag(Qt::LeftButton)); + QVERIFY(!btn.testFlag(Qt::MidButton)); + + btn.setFlag(Qt::LeftButton, false); + QVERIFY(!btn.testFlag(Qt::LeftButton)); + QVERIFY(!btn.testFlag(Qt::MidButton)); +} + // (statically) check QTypeInfo for QFlags instantiations: enum MyEnum { Zero, One, Two, Four=4 }; Q_DECLARE_FLAGS( MyFlags, MyEnum ) diff --git a/tests/auto/corelib/global/qgetputenv/qgetputenv.pro b/tests/auto/corelib/global/qgetputenv/qgetputenv.pro index 34fb1a702b..c6d1100335 100644 --- a/tests/auto/corelib/global/qgetputenv/qgetputenv.pro +++ b/tests/auto/corelib/global/qgetputenv/qgetputenv.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qgetputenv QT = core testlib SOURCES = tst_qgetputenv.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp index 71a3419963..7ffb5d0fd7 100644 --- a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp +++ b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.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$ ** @@ -80,7 +75,7 @@ void tst_QGetPutEnv::getSetCheck() QCOMPARE(qEnvironmentVariableIntValue(varName, &ok), 0); QVERIFY(!ok); result = qgetenv(varName); - QVERIFY(result == "supervalue"); + QCOMPARE(result, QByteArrayLiteral("supervalue")); qputenv(varName,QByteArray()); diff --git a/tests/auto/corelib/global/qglobal/qglobal.pro b/tests/auto/corelib/global/qglobal/qglobal.pro index d1c02f80e9..b8ed7761f5 100644 --- a/tests/auto/corelib/global/qglobal/qglobal.pro +++ b/tests/auto/corelib/global/qglobal/qglobal.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qglobal QT = core testlib SOURCES = tst_qglobal.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp index 00f70f5380..bb4d1f4bf2 100644 --- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp +++ b/tests/auto/corelib/global/qglobal/tst_qglobal.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$ ** @@ -60,6 +55,7 @@ private slots: void qprintable(); void qprintable_data(); void buildAbiEndianness(); + void testqOverload(); }; void tst_QGlobal::qIsNull() @@ -657,5 +653,126 @@ void tst_QGlobal::buildAbiEndianness() QVERIFY(QSysInfo::buildAbi().contains(endian)); } +struct Overloaded +{ + void foo() {} + void foo(QByteArray) {} + void foo(QByteArray, const QString &) {} + + void constFoo() const {} + void constFoo(QByteArray) const {} + void constFoo(QByteArray, const QString &) const {} + + void mixedFoo() {} + void mixedFoo(QByteArray) const {} +}; + +void freeOverloaded() {} +void freeOverloaded(QByteArray) {} +void freeOverloaded(QByteArray, const QString &) {} + +void freeOverloadedGet(QByteArray) {} +QByteArray freeOverloadedGet() { return QByteArray(); } + + +void tst_QGlobal::testqOverload() +{ +#ifdef Q_COMPILER_VARIADIC_TEMPLATES + + // void returning free overloaded functions + QVERIFY(QOverload<>::of(&freeOverloaded) == + static_cast<void (*)()>(&freeOverloaded)); + + QVERIFY(QOverload<QByteArray>::of(&freeOverloaded) == + static_cast<void (*)(QByteArray)>(&freeOverloaded)); + + QVERIFY((QOverload<QByteArray, const QString &>::of(&freeOverloaded)) == + static_cast<void (*)(QByteArray, const QString &)>(&freeOverloaded)); + + // value returning free overloaded functions + QVERIFY(QOverload<>::of(&freeOverloadedGet) == + static_cast<QByteArray (*)()>(&freeOverloadedGet)); + + QVERIFY(QOverload<QByteArray>::of(&freeOverloadedGet) == + static_cast<void (*)(QByteArray)>(&freeOverloadedGet)); + + // void returning overloaded member functions + QVERIFY(QOverload<>::of(&Overloaded::foo) == + static_cast<void (Overloaded::*)()>(&Overloaded::foo)); + + QVERIFY(QOverload<QByteArray>::of(&Overloaded::foo) == + static_cast<void (Overloaded::*)(QByteArray)>(&Overloaded::foo)); + + QVERIFY((QOverload<QByteArray, const QString &>::of(&Overloaded::foo)) == + static_cast<void (Overloaded::*)(QByteArray, const QString &)>(&Overloaded::foo)); + + // void returning overloaded const member functions + QVERIFY(QOverload<>::of(&Overloaded::constFoo) == + static_cast<void (Overloaded::*)() const>(&Overloaded::constFoo)); + + QVERIFY(QOverload<QByteArray>::of(&Overloaded::constFoo) == + static_cast<void (Overloaded::*)(QByteArray) const>(&Overloaded::constFoo)); + + QVERIFY((QOverload<QByteArray, const QString &>::of(&Overloaded::constFoo)) == + static_cast<void (Overloaded::*)(QByteArray, const QString &) const>(&Overloaded::constFoo)); + + // void returning overloaded const AND non-const member functions + QVERIFY(QNonConstOverload<>::of(&Overloaded::mixedFoo) == + static_cast<void (Overloaded::*)()>(&Overloaded::mixedFoo)); + + QVERIFY(QConstOverload<QByteArray>::of(&Overloaded::mixedFoo) == + static_cast<void (Overloaded::*)(QByteArray) const>(&Overloaded::mixedFoo)); + +#if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304 // C++14 + + // void returning free overloaded functions + QVERIFY(qOverload<>(&freeOverloaded) == + static_cast<void (*)()>(&freeOverloaded)); + + QVERIFY(qOverload<QByteArray>(&freeOverloaded) == + static_cast<void (*)(QByteArray)>(&freeOverloaded)); + + QVERIFY((qOverload<QByteArray, const QString &>(&freeOverloaded) == + static_cast<void (*)(QByteArray, const QString &)>(&freeOverloaded))); + + // value returning free overloaded functions + QVERIFY(qOverload<>(&freeOverloadedGet) == + static_cast<QByteArray (*)()>(&freeOverloadedGet)); + + QVERIFY(qOverload<QByteArray>(&freeOverloadedGet) == + static_cast<void (*)(QByteArray)>(&freeOverloadedGet)); + + // void returning overloaded member functions + QVERIFY(qOverload<>(&Overloaded::foo) == + static_cast<void (Overloaded::*)()>(&Overloaded::foo)); + + QVERIFY(qOverload<QByteArray>(&Overloaded::foo) == + static_cast<void (Overloaded::*)(QByteArray)>(&Overloaded::foo)); + + QVERIFY((qOverload<QByteArray, const QString &>(&Overloaded::foo)) == + static_cast<void (Overloaded::*)(QByteArray, const QString &)>(&Overloaded::foo)); + + // void returning overloaded const member functions + QVERIFY(qOverload<>(&Overloaded::constFoo) == + static_cast<void (Overloaded::*)() const>(&Overloaded::constFoo)); + + QVERIFY(qOverload<QByteArray>(&Overloaded::constFoo) == + static_cast<void (Overloaded::*)(QByteArray) const>(&Overloaded::constFoo)); + + QVERIFY((qOverload<QByteArray, const QString &>(&Overloaded::constFoo)) == + static_cast<void (Overloaded::*)(QByteArray, const QString &) const>(&Overloaded::constFoo)); + + // void returning overloaded const AND non-const member functions + QVERIFY(qNonConstOverload<>(&Overloaded::mixedFoo) == + static_cast<void (Overloaded::*)()>(&Overloaded::mixedFoo)); + + QVERIFY(qConstOverload<QByteArray>(&Overloaded::mixedFoo) == + static_cast<void (Overloaded::*)(QByteArray) const>(&Overloaded::mixedFoo)); +#endif + +#endif +} + + QTEST_APPLESS_MAIN(tst_QGlobal) #include "tst_qglobal.moc" diff --git a/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro b/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro index 7b374505ce..056d940da7 100644 --- a/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro +++ b/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro @@ -10,4 +10,3 @@ CONFIG += exceptions SOURCES += tst_qglobalstatic.cpp DEFINES += SRCDIR=\\\"$$PWD/\\\" -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp b/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp index e9fd999e9f..1253a32f97 100644 --- a/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp +++ b/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp @@ -1,12 +1,23 @@ /**************************************************************************** ** -** Copyright (C) 2011 Thiago Macieira <thiago@kde.org> -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 Thiago Macieira <thiago@kde.org> +** Copyright (C) 2016 Intel Corporation. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/tests/auto/corelib/global/qhooks/qhooks.pro b/tests/auto/corelib/global/qhooks/qhooks.pro index f886e7d49a..a5c0d63cb9 100644 --- a/tests/auto/corelib/global/qhooks/qhooks.pro +++ b/tests/auto/corelib/global/qhooks/qhooks.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qhooks QT = core-private testlib SOURCES = tst_qhooks.cpp diff --git a/tests/auto/corelib/global/qhooks/tst_qhooks.cpp b/tests/auto/corelib/global/qhooks/tst_qhooks.cpp index b5930790e4..f0685d64c5 100644 --- a/tests/auto/corelib/global/qhooks/tst_qhooks.cpp +++ b/tests/auto/corelib/global/qhooks/tst_qhooks.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Volker Krause <volker.krause@kdab.com> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module 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$ ** @@ -46,7 +41,7 @@ private slots: void tst_QHooks::testVersion() { - QVERIFY(qtHookData[QHooks::HookDataVersion] >= 1); + QVERIFY(qtHookData[QHooks::HookDataVersion] >= 3); QCOMPARE(qtHookData[QHooks::HookDataSize], (quintptr)QHooks::LastHookIndex); QCOMPARE(qtHookData[QHooks::QtVersion], (quintptr)QT_VERSION); } diff --git a/tests/auto/corelib/global/qlogging/app/app.pro b/tests/auto/corelib/global/qlogging/app/app.pro index 4789efc478..8ada04acdc 100644 --- a/tests/auto/corelib/global/qlogging/app/app.pro +++ b/tests/auto/corelib/global/qlogging/app/app.pro @@ -9,7 +9,6 @@ CONFIG -= app_bundle CONFIG += console SOURCES += main.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 DEFINES += QT_MESSAGELOGCONTEXT gcc:!mingw:!haiku: QMAKE_LFLAGS += -rdynamic diff --git a/tests/auto/corelib/global/qlogging/app/main.cpp b/tests/auto/corelib/global/qlogging/app/main.cpp index 0a78b60ff9..4c26bb85e3 100644 --- a/tests/auto/corelib/global/qlogging/app/main.cpp +++ b/tests/auto/corelib/global/qlogging/app/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/global/qlogging/test/test.pro b/tests/auto/corelib/global/qlogging/test/test.pro index 64a63ce28a..b5b75be3a6 100644 --- a/tests/auto/corelib/global/qlogging/test/test.pro +++ b/tests/auto/corelib/global/qlogging/test/test.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase CONFIG -= app_bundle debug_and_release_target contains(QT_CONFIG, c++11): CONFIG += c++11 contains(QT_CONFIG, c++14): CONFIG += c++14 diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index 618806f3cd..ce227a6c8b 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.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$ ** @@ -725,16 +720,16 @@ void tst_qmessagehandler::qMessagePattern_data() // %{file} is tricky because of shadow builds QTest::newRow("basic") << "%{type} %{appname} %{line} %{function} %{message}" << true << (QList<QByteArray>() - << "debug 44 T::T static constructor" + << "debug 39 T::T static constructor" // we can't be sure whether the QT_MESSAGE_PATTERN is already destructed << "static destructor" - << "debug tst_qlogging 65 MyClass::myFunction from_a_function 34" - << "debug tst_qlogging 75 main qDebug" - << "info tst_qlogging 76 main qInfo" - << "warning tst_qlogging 77 main qWarning" - << "critical tst_qlogging 78 main qCritical" - << "warning tst_qlogging 81 main qDebug with category" - << "debug tst_qlogging 85 main qDebug2"); + << "debug tst_qlogging 60 MyClass::myFunction from_a_function 34" + << "debug tst_qlogging 70 main qDebug" + << "info tst_qlogging 71 main qInfo" + << "warning tst_qlogging 72 main qWarning" + << "critical tst_qlogging 73 main qCritical" + << "warning tst_qlogging 76 main qDebug with category" + << "debug tst_qlogging 80 main qDebug2"); QTest::newRow("invalid") << "PREFIX: %{unknown} %{message}" << false << (QList<QByteArray>() @@ -832,7 +827,7 @@ void tst_qmessagehandler::qMessagePattern() // test QT_MESSAGE_PATTERN // QStringList environment = m_baseEnvironment; - environment.prepend("QT_MESSAGE_PATTERN=\"" + pattern + "\""); + environment.prepend("QT_MESSAGE_PATTERN=\"" + pattern + QLatin1Char('"')); process.setEnvironment(environment); process.start(appExe); diff --git a/tests/auto/corelib/global/qnumeric/qnumeric.pro b/tests/auto/corelib/global/qnumeric/qnumeric.pro index 0772ce6aab..188bb5b463 100644 --- a/tests/auto/corelib/global/qnumeric/qnumeric.pro +++ b/tests/auto/corelib/global/qnumeric/qnumeric.pro @@ -1,7 +1,6 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qnumeric QT = core-private testlib SOURCES = tst_qnumeric.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 intel_icc: QMAKE_CXXFLAGS += -fp-model strict intel_icl: QMAKE_CXXFLAGS += /fp:strict diff --git a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp index 6be8ff81cf..8232ca8fba 100644 --- a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp +++ b/tests/auto/corelib/global/qnumeric/tst_qnumeric.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$ ** @@ -55,6 +51,7 @@ private slots: void addOverflow(); void mulOverflow_data(); void mulOverflow(); + void signedOverflow(); }; void tst_QNumeric::fuzzyCompare_data() @@ -105,6 +102,18 @@ void tst_QNumeric::qNan() QVERIFY(qIsNaN(nan)); QVERIFY(qIsNaN(nan + 1)); QVERIFY(qIsNaN(-nan)); + + Q_STATIC_ASSERT(sizeof(double) == 8); +#ifdef Q_LITTLE_ENDIAN + const uchar bytes[] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f }; +#else + const uchar bytes[] = { 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; +#endif + memcpy(&nan, bytes, 8); + QVERIFY(!qIsFinite(nan)); + QVERIFY(!qIsInf(nan)); + QVERIFY(qIsNaN(nan)); + double inf = qInf(); QVERIFY(inf > 0); QVERIFY(-inf < 0); @@ -366,5 +375,35 @@ void tst_QNumeric::mulOverflow() MulOverflowDispatch<quint64>()(); } +void tst_QNumeric::signedOverflow() +{ + const int minInt = std::numeric_limits<int>::min(); + const int maxInt = std::numeric_limits<int>::max(); + int r; + + QCOMPARE(add_overflow(minInt + 1, int(-1), &r), false); + QCOMPARE(add_overflow(minInt, int(-1), &r), true); + QCOMPARE(add_overflow(minInt, minInt, &r), true); + QCOMPARE(add_overflow(maxInt - 1, int(1), &r), false); + QCOMPARE(add_overflow(maxInt, int(1), &r), true); + QCOMPARE(add_overflow(maxInt, maxInt, &r), true); + + QCOMPARE(sub_overflow(minInt + 1, int(1), &r), false); + QCOMPARE(sub_overflow(minInt, int(1), &r), true); + QCOMPARE(sub_overflow(minInt, maxInt, &r), true); + QCOMPARE(sub_overflow(maxInt - 1, int(-1), &r), false); + QCOMPARE(sub_overflow(maxInt, int(-1), &r), true); + QCOMPARE(sub_overflow(maxInt, minInt, &r), true); + + QCOMPARE(mul_overflow(minInt, int(1), &r), false); + QCOMPARE(mul_overflow(minInt, int(-1), &r), true); + QCOMPARE(mul_overflow(minInt, int(2), &r), true); + QCOMPARE(mul_overflow(minInt, minInt, &r), true); + QCOMPARE(mul_overflow(maxInt, int(1), &r), false); + QCOMPARE(mul_overflow(maxInt, int(-1), &r), false); + QCOMPARE(mul_overflow(maxInt, int(2), &r), true); + QCOMPARE(mul_overflow(maxInt, maxInt, &r), true); +} + QTEST_APPLESS_MAIN(tst_QNumeric) #include "tst_qnumeric.moc" diff --git a/tests/auto/corelib/global/qrand/qrand.pro b/tests/auto/corelib/global/qrand/qrand.pro index 7761b6721a..ee1430aea5 100644 --- a/tests/auto/corelib/global/qrand/qrand.pro +++ b/tests/auto/corelib/global/qrand/qrand.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qrand QT = core testlib SOURCES = tst_qrand.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/global/qrand/tst_qrand.cpp b/tests/auto/corelib/global/qrand/tst_qrand.cpp index fd4934054b..6a4b2b322b 100644 --- a/tests/auto/corelib/global/qrand/tst_qrand.cpp +++ b/tests/auto/corelib/global/qrand/tst_qrand.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/global/qtendian/qtendian.pro b/tests/auto/corelib/global/qtendian/qtendian.pro index 363b86988d..2b0af4fa4c 100644 --- a/tests/auto/corelib/global/qtendian/qtendian.pro +++ b/tests/auto/corelib/global/qtendian/qtendian.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtendian QT = core testlib SOURCES = tst_qtendian.cpp @@ -6,4 +6,3 @@ wince* { # QTBUG-37194 , internal compiler errors with MSVC2008 for Windows CE QMAKE_CFLAGS_RELEASE -= -O2 QMAKE_CXXFLAGS_RELEASE -= -O2 } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/global/qtendian/tst_qtendian.cpp b/tests/auto/corelib/global/qtendian/tst_qtendian.cpp index 5726535c5b..915e40954b 100644 --- a/tests/auto/corelib/global/qtendian/tst_qtendian.cpp +++ b/tests/auto/corelib/global/qtendian/tst_qtendian.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$ ** |