diff options
Diffstat (limited to 'tests/auto/corelib/tools')
145 files changed, 2121 insertions, 2056 deletions
diff --git a/tests/auto/corelib/tools/collections/collections.pro b/tests/auto/corelib/tools/collections/collections.pro index 51ea667f58..5c04515fa0 100644 --- a/tests/auto/corelib/tools/collections/collections.pro +++ b/tests/auto/corelib/tools/collections/collections.pro @@ -2,8 +2,6 @@ CONFIG += testcase TARGET = tst_collections SOURCES += tst_collections.cpp QT = core testlib -CONFIG += parallel_test # This test does not work with strict iterators DEFINES -= QT_STRICT_ITERATORS -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp index b9487cee33..af270ded98 100644 --- a/tests/auto/corelib/tools/collections/tst_collections.cpp +++ b/tests/auto/corelib/tools/collections/tst_collections.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$ ** @@ -98,13 +93,6 @@ class tst_Collections : public QObject { Q_OBJECT -public: - tst_Collections(); - ~tst_Collections(); - -public slots: - void init(); - void cleanup(); private slots: void typeinfo(); void qstring(); @@ -176,23 +164,6 @@ struct Pod { int i1, i2; }; -tst_Collections::tst_Collections() -{ -} - -tst_Collections::~tst_Collections() -{ - -} - -void tst_Collections::init() -{ -} - -void tst_Collections::cleanup() -{ -} - void tst_Collections::typeinfo() { QVERIFY(QTypeInfo<int*>::isPointer); @@ -519,11 +490,11 @@ void tst_Collections::list() QList<QString> list = vector.toList(); QVERIFY(list.size() == 5); - QVERIFY(list.at(0) == "99"); - QVERIFY(list.at(4) == "100"); + QCOMPARE(list.at(0), QLatin1String("99")); + QCOMPARE(list.at(4), QLatin1String("100")); list[0] = "10"; - QVERIFY(list.at(0) == "10"); - QVERIFY(vector.at(0) == "99"); + QCOMPARE(list.at(0), QLatin1String("10")); + QCOMPARE(vector.at(0), QLatin1String("99")); } @@ -535,15 +506,15 @@ void tst_Collections::list() QVERIFY((*it)[0] == QChar('H')); QVERIFY(it->constData()[0] == QChar('H')); it->replace(QChar('H'), QChar('X')); - QVERIFY(list.first() == "Xello"); + QCOMPARE(list.first(), QLatin1String("Xello")); QList<QString>::const_iterator cit = list.constBegin(); - QVERIFY((*cit).toLower() == "xello"); - QVERIFY(cit->toUpper() == "XELLO"); + QCOMPARE((*cit).toLower(), QLatin1String("xello")); + QCOMPARE(cit->toUpper(), QLatin1String("XELLO")); cit = list.cbegin(); - QVERIFY((*cit).toLower() == "xello"); - QVERIFY(cit->toUpper() == "XELLO"); + QCOMPARE((*cit).toLower(),QLatin1String("xello")); + QCOMPARE(cit->toUpper(), QLatin1String("XELLO")); } { @@ -577,10 +548,10 @@ void tst_Collections::list() list << "alpha" << "beta"; list += list; QVERIFY(list.size() == 4); - QVERIFY(list.at(0) == "alpha"); - QVERIFY(list.at(1) == "beta"); - QVERIFY(list.at(2) == "alpha"); - QVERIFY(list.at(3) == "beta"); + QCOMPARE(list.at(0), QLatin1String("alpha")); + QCOMPARE(list.at(1), QLatin1String("beta")); + QCOMPARE(list.at(2), QLatin1String("alpha")); + QCOMPARE(list.at(3), QLatin1String("beta")); } // test endcases for inserting into a qlist @@ -956,15 +927,15 @@ void tst_Collections::linkedList() QVERIFY((*it)[0] == QChar('H')); QVERIFY(it->constData()[0] == QChar('H')); it->replace(QChar('H'), QChar('X')); - QVERIFY(list.first() == "Xello"); + QCOMPARE(list.first(), QLatin1String("Xello")); QLinkedList<QString>::const_iterator cit = list.constBegin(); - QVERIFY((*cit).toLower() == "xello"); - QVERIFY(cit->toUpper() == "XELLO"); + QCOMPARE((*cit).toLower(), QLatin1String("xello")); + QCOMPARE(cit->toUpper(), QLatin1String("XELLO")); cit = list.cbegin(); - QVERIFY((*cit).toLower() == "xello"); - QVERIFY(cit->toUpper() == "XELLO"); + QCOMPARE((*cit).toLower(), QLatin1String("xello")); + QCOMPARE(cit->toUpper(), QLatin1String("XELLO")); } { @@ -972,10 +943,10 @@ void tst_Collections::linkedList() list << "alpha" << "beta"; list += list; QVERIFY(list.size() == 4); - QVERIFY(*list.begin() == "alpha"); - QVERIFY(*(list.begin() + 1) == "beta"); - QVERIFY(*(list.begin() + 2) == "alpha"); - QVERIFY(*(list.begin() + 3) == "beta"); + QCOMPARE(*list.begin(), QLatin1String("alpha")); + QCOMPARE(*(list.begin() + 1), QLatin1String("beta")); + QCOMPARE(*(list.begin() + 2), QLatin1String("alpha")); + QCOMPARE(*(list.begin() + 3), QLatin1String("beta")); } { @@ -1056,8 +1027,8 @@ void tst_Collections::vector() QVector<QString> vec; vec << "foo" << "bar"; vec.reserve( 512 ); - QVERIFY(vec[0] == "foo"); - QVERIFY(vec[1] == "bar"); + QCOMPARE(vec[0], QLatin1String("foo")); + QCOMPARE(vec[1], QLatin1String("bar")); int initialLargeStaticCount = LargeStatic::count; { @@ -1072,10 +1043,10 @@ void tst_Collections::vector() vector << "alpha" << "beta"; vector += vector; QVERIFY(vector.size() == 4); - QVERIFY(vector.at(0) == "alpha"); - QVERIFY(vector.at(1) == "beta"); - QVERIFY(vector.at(2) == "alpha"); - QVERIFY(vector.at(3) == "beta"); + QCOMPARE(vector.at(0), QLatin1String("alpha")); + QCOMPARE(vector.at(1), QLatin1String("beta")); + QCOMPARE(vector.at(2), QLatin1String("alpha")); + QCOMPARE(vector.at(3), QLatin1String("beta")); } int originalLargeStaticCount = LargeStatic::count; @@ -1596,15 +1567,15 @@ void tst_Collections::hash() QVERIFY((*it)[0] == QChar('H')); QVERIFY(it->constData()[0] == QChar('H')); it->replace(QChar('H'), QChar('X')); - QVERIFY(*hash.begin() == "Xello"); + QCOMPARE(*hash.begin(), QLatin1String("Xello")); QHash<int, QString>::const_iterator cit = hash.constBegin(); - QVERIFY((*cit).toLower() == "xello"); - QVERIFY(cit->toUpper() == "XELLO"); + QCOMPARE((*cit).toLower(), QLatin1String("xello")); + QCOMPARE(cit->toUpper(), QLatin1String("XELLO")); cit = hash.cbegin(); - QVERIFY((*cit).toLower() == "xello"); - QVERIFY(cit->toUpper() == "XELLO"); + QCOMPARE((*cit).toLower(), QLatin1String("xello")); + QCOMPARE(cit->toUpper(), QLatin1String("XELLO")); } { @@ -1917,15 +1888,15 @@ void tst_Collections::map() QVERIFY((*it)[0] == QChar('H')); QVERIFY(it->constData()[0] == QChar('H')); it->replace(QChar('H'), QChar('X')); - QVERIFY(*map.begin() == "Xello"); + QCOMPARE(*map.begin(), QLatin1String("Xello")); QMap<int, QString>::const_iterator cit = map.constBegin(); - QVERIFY((*cit).toLower() == "xello"); - QVERIFY(cit->toUpper() == "XELLO"); + QCOMPARE((*cit).toLower(), QLatin1String("xello")); + QCOMPARE(cit->toUpper(), QLatin1String("XELLO")); cit = map.cbegin(); - QVERIFY((*cit).toLower() == "xello"); - QVERIFY(cit->toUpper() == "XELLO"); + QCOMPARE((*cit).toLower(), QLatin1String("xello")); + QCOMPARE(cit->toUpper(), QLatin1String("XELLO")); } { @@ -2007,17 +1978,17 @@ void tst_Collections::qstring() QVERIFY(hello.left(0) == ""); QVERIFY(!hello.left(0).isNull()); - QVERIFY(hello.left(1) == "h"); - QVERIFY(hello.left(2) == "he"); - QVERIFY(hello.left(200) == "hello"); + QCOMPARE(hello.left(1), QLatin1String("h")); + QCOMPARE(hello.left(2), QLatin1String("he")); + QCOMPARE(hello.left(200), QLatin1String("hello")); QVERIFY(hello.left(hello.size()) == hello); QVERIFY(hello.left(hello.size()+1) == hello); QVERIFY(hello.right(0) == ""); QVERIFY(!hello.right(0).isNull()); - QVERIFY(hello.right(1) == "o"); - QVERIFY(hello.right(2) == "lo"); - QVERIFY(hello.right(200) == "hello"); + QCOMPARE(hello.right(1), QLatin1String("o")); + QCOMPARE(hello.right(2), QLatin1String("lo")); + QCOMPARE(hello.right(200), QLatin1String("hello")); QVERIFY(hello.right(hello.size()) == hello); QVERIFY(hello.right(hello.size()+1) == hello); @@ -2025,16 +1996,16 @@ void tst_Collections::qstring() QVERIFY(hello.mid(0, 1) == "h"); QVERIFY(hello.mid(0, 2) == "he"); QVERIFY(hello.mid(0, 200) == "hello"); - QVERIFY(hello.mid(0) == "hello"); + QCOMPARE(hello.mid(0), QLatin1String("hello")); QVERIFY(hello.mid(0, hello.size()) == hello); QVERIFY(hello.mid(0, hello.size()+1) == hello); QVERIFY(hello.mid(hello.size()-0) == ""); QVERIFY(hello.mid(hello.size()-0).isEmpty()); QVERIFY(!hello.mid(hello.size()-0).isNull()); - QVERIFY(hello.mid(hello.size()-1) == "o"); - QVERIFY(hello.mid(hello.size()-2) == "lo"); - QVERIFY(hello.mid(hello.size()-200) == "hello"); + QCOMPARE(hello.mid(hello.size()-1), QLatin1String("o")); + QCOMPARE(hello.mid(hello.size()-2), QLatin1String("lo")); + QCOMPARE(hello.mid(hello.size()-200), QLatin1String("hello")); QString null; QString nonNull = ""; @@ -2050,7 +2021,7 @@ void tst_Collections::qstring() QString fill = "123"; fill.fill('a'); - QVERIFY(fill == "aaa"); + QCOMPARE(fill, QLatin1String("aaa")); s.clear(); s = hello; @@ -2062,15 +2033,15 @@ void tst_Collections::qstring() QVERIFY(s == helloWorld); s = "012345"; s.insert(3, 'E'); - QVERIFY(s == "012E345"); + QCOMPARE(s, QLatin1String("012E345")); s.insert(3, "INSID"); - QVERIFY(s == "012INSIDE345"); + QCOMPARE(s, QLatin1String("012INSIDE345")); s = "short"; s.insert(7, 'E'); - QVERIFY(s == "short E"); + QCOMPARE(s, QLatin1String("short E")); s = "short"; s.insert(7, "END"); - QVERIFY(s == "short END"); + QCOMPARE(s, QLatin1String("short END")); QVERIFY(QString::fromLatin1("hello") == "hello"); @@ -2127,25 +2098,25 @@ void tst_Collections::qstring() s += QChar((uchar) 0xb0); QVERIFY(s.toUtf8() != s.toLatin1()); QCOMPARE(s[s.length()-1].unicode(), (ushort)0xb0); - QVERIFY(s.left(s.length()-1) == "ascii"); + QCOMPARE(s.left(s.length()-1), QLatin1String("ascii")); QVERIFY(s == QString::fromUtf8(s.toUtf8().constData())); s = "12"; s.append('3'); s += '4'; - QVERIFY(s == "1234"); + QCOMPARE(s, QLatin1String("1234")); s = "repend"; s.prepend('p'); - QVERIFY(s == "prepend"); + QCOMPARE(s, QLatin1String("prepend")); s.prepend("abc "); - QVERIFY(s == "abc prepend"); + QCOMPARE(s, QLatin1String("abc prepend")); s = " whitespace "; - QVERIFY(s.trimmed() == "whitespace"); + QCOMPARE(s.trimmed(), QLatin1String("whitespace")); s = " lots of stuff "; - QVERIFY(s.simplified() == "lots of stuff"); + QCOMPARE(s.simplified(), QLatin1String("lots of stuff")); s = "a hat, a stick, a ski"; QVERIFY(s[2] == 'h'); @@ -2154,17 +2125,17 @@ void tst_Collections::qstring() s = "12223"; s.remove(1, 2); - QVERIFY(s == "123"); + QCOMPARE(s, QLatin1String("123")); s = "(%1)(%2)"; s = s.arg("foo").arg(7); - QVERIFY(s == "(foo)(7)"); + QCOMPARE(s, QLatin1String("(foo)(7)")); s = "stl rocks"; std::string stl_string = s.toStdString(); // TODO: std::string stl_string = s does not work. - QVERIFY(s == "stl rocks"); + QCOMPARE(s, QLatin1String("stl rocks")); s = QString::fromStdString(stl_string); // TODO: s = stl_string does not work. - QVERIFY(s == "stl rocks"); + QCOMPARE(s, QLatin1String("stl rocks")); { QString str("Bananas"); @@ -2180,10 +2151,10 @@ void tst_Collections::qstring() QString str = "Hello"; QString cstr = QString::fromRawData(str.unicode(), str.length()); - QVERIFY(str == "Hello"); - QVERIFY(cstr == "Hello"); + QCOMPARE(str, QLatin1String("Hello")); + QCOMPARE(cstr, QLatin1String("Hello")); cstr.clear(); - QVERIFY(str == "Hello"); + QCOMPARE(str, QLatin1String("Hello")); QVERIFY(cstr.isEmpty()); { @@ -2330,7 +2301,7 @@ void tst_Collections::pair() QPair<int, QString> a(1, "Zebra"), b(2, "Ying"), c(3, "Yang"), d(3, "Ying"), e(5, "Alabama"); QVERIFY(a.first == 1); - QVERIFY(a.second == "Zebra"); + QCOMPARE(a.second, QLatin1String("Zebra")); QVERIFY(a == qMakePair(1, QString("Zebra"))); QVERIFY(a == a && b == b && c == c && d == d && e == e); @@ -3484,7 +3455,7 @@ template<class Container> void foreach_test_arrays(const Container &container) void tst_Collections::foreach_2() { - QStringList strlist = QString::fromLatin1("a,b,c,d,e,f,g,h,ih,kl,mn,op,qr,st,uvw,xyz").split(","); + QStringList strlist = QString::fromLatin1("a,b,c,d,e,f,g,h,ih,kl,mn,op,qr,st,uvw,xyz").split(QLatin1Char(',')); foreach_test_arrays(strlist); foreach_test_arrays(QList<QString>(strlist)); foreach_test_arrays(strlist.toVector()); diff --git a/tests/auto/corelib/tools/qalgorithms/qalgorithms.pro b/tests/auto/corelib/tools/qalgorithms/qalgorithms.pro index cb6f6595b4..0e6e830185 100644 --- a/tests/auto/corelib/tools/qalgorithms/qalgorithms.pro +++ b/tests/auto/corelib/tools/qalgorithms/qalgorithms.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qalgorithms QT = core testlib SOURCES = tst_qalgorithms.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp index 99e5c4c85d..c14e9fadf7 100644 --- a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp +++ b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.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$ ** @@ -312,24 +307,24 @@ void tst_QAlgorithms::swap() { QString a = "1", b = "2"; qSwap(a, b); - QVERIFY(a == "2"); - QVERIFY(b == "1"); + QCOMPARE(a, QLatin1String("2")); + QCOMPARE(b, QLatin1String("1")); qSwap(a, a); - QVERIFY(a == "2"); - QVERIFY(b == "1"); + QCOMPARE(a, QLatin1String("2")); + QCOMPARE(b, QLatin1String("1")); qSwap(b, b); - QVERIFY(a == "2"); - QVERIFY(b == "1"); + QCOMPARE(a, QLatin1String("2")); + QCOMPARE(b, QLatin1String("1")); qSwap(a, b); - QVERIFY(a == "1"); - QVERIFY(b == "2"); + QCOMPARE(a, QLatin1String("1")); + QCOMPARE(b, QLatin1String("2")); qSwap(b, a); - QVERIFY(a == "2"); - QVERIFY(b == "1"); + QCOMPARE(a, QLatin1String("2")); + QCOMPARE(b, QLatin1String("1")); } { diff --git a/tests/auto/corelib/tools/qarraydata/qarraydata.pro b/tests/auto/corelib/tools/qarraydata/qarraydata.pro index d5fe08c009..ee3faa9ad7 100644 --- a/tests/auto/corelib/tools/qarraydata/qarraydata.pro +++ b/tests/auto/corelib/tools/qarraydata/qarraydata.pro @@ -2,5 +2,4 @@ TARGET = tst_qarraydata SOURCES += $$PWD/tst_qarraydata.cpp HEADERS += $$PWD/simplevector.h QT = core testlib -CONFIG += testcase parallel_test -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 +CONFIG += testcase diff --git a/tests/auto/corelib/tools/qarraydata/simplevector.h b/tests/auto/corelib/tools/qarraydata/simplevector.h index 091d871e82..90e86dca4e 100644 --- a/tests/auto/corelib/tools/qarraydata/simplevector.h +++ b/tests/auto/corelib/tools/qarraydata/simplevector.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/tools/qarraydata/tst_qarraydata.cpp b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp index 31e44bc3ae..0732a55063 100644 --- a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp +++ b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.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/tools/qbitarray/qbitarray.pro b/tests/auto/corelib/tools/qbitarray/qbitarray.pro index 22f62faaca..1e7185b600 100644 --- a/tests/auto/corelib/tools/qbitarray/qbitarray.pro +++ b/tests/auto/corelib/tools/qbitarray/qbitarray.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qbitarray QT = core testlib SOURCES = tst_qbitarray.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp index d3bbfa338b..d19eac7530 100644 --- a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp +++ b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.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$ ** @@ -126,9 +121,9 @@ void tst_QBitArray::size() for (int j=0; j<len; j++) { bool b = a[j]; if (b) - S+= "1"; + S+= QLatin1Char('1'); else - S+= "0"; + S+= QLatin1Char('0'); } QTEST(S,"res"); } diff --git a/tests/auto/corelib/tools/qbytearray/qbytearray.pro b/tests/auto/corelib/tools/qbytearray/qbytearray.pro index 22104f817f..a4501611d6 100644 --- a/tests/auto/corelib/tools/qbytearray/qbytearray.pro +++ b/tests/auto/corelib/tools/qbytearray/qbytearray.pro @@ -1,10 +1,9 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qbytearray QT = core-private testlib SOURCES = tst_qbytearray.cpp TESTDATA += rfc3252.txt -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 mac { OBJECTIVE_SOURCES += tst_qbytearray_mac.mm diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp index f942eab800..910d7abf51 100644 --- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.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$ ** @@ -212,12 +208,12 @@ QByteArray verifyZeroTermination(const QByteArray &ba) const_cast<char *>(baData)[baSize] = 'x'; if ('x' != ba.constData()[baSize]) { - return QString::fromLatin1("*** Failed to replace null-terminator in " - "result ('%1') ***").arg(QString::fromLatin1(ba)).toLatin1(); + return "*** Failed to replace null-terminator in " + "result ('" + ba + "') ***"; } if (ba != baCopy) { - return QString::fromLatin1( "*** Result ('%1') differs from its copy " - "after null-terminator was replaced ***").arg(QString::fromLatin1(ba)).toLatin1(); + return "*** Result ('" + ba + "') differs from its copy " + "after null-terminator was replaced ***"; } const_cast<char *>(baData)[baSize] = '\0'; // Restore sanity @@ -896,7 +892,9 @@ void tst_QByteArray::prepend() QCOMPARE(ba.prepend("1"), QByteArray("1foo")); QCOMPARE(ba.prepend(QByteArray("2")), QByteArray("21foo")); QCOMPARE(ba.prepend('3'), QByteArray("321foo")); - QCOMPARE(ba.prepend("\0 ", 2), QByteArray::fromRawData("\0 321foo", 8)); + QCOMPARE(ba.prepend(-1, 'x'), QByteArray("321foo")); + QCOMPARE(ba.prepend(3, 'x'), QByteArray("xxx321foo")); + QCOMPARE(ba.prepend("\0 ", 2), QByteArray::fromRawData("\0 xxx321foo", 11)); } void tst_QByteArray::prependExtended_data() @@ -924,8 +922,10 @@ void tst_QByteArray::prependExtended() QCOMPARE(array.prepend("1"), QByteArray("1data")); QCOMPARE(array.prepend(QByteArray("2")), QByteArray("21data")); QCOMPARE(array.prepend('3'), QByteArray("321data")); - QCOMPARE(array.prepend("\0 ", 2), QByteArray::fromRawData("\0 321data", 9)); - QCOMPARE(array.size(), 9); + QCOMPARE(array.prepend(-1, 'x'), QByteArray("321data")); + QCOMPARE(array.prepend(3, 'x'), QByteArray("xxx321data")); + QCOMPARE(array.prepend("\0 ", 2), QByteArray::fromRawData("\0 xxx321data", 12)); + QCOMPARE(array.size(), 12); } void tst_QByteArray::append() @@ -936,9 +936,11 @@ void tst_QByteArray::append() QCOMPARE(ba.append("1"), QByteArray("foo1")); QCOMPARE(ba.append(QByteArray("2")), QByteArray("foo12")); QCOMPARE(ba.append('3'), QByteArray("foo123")); - QCOMPARE(ba.append("\0"), QByteArray("foo123")); - QCOMPARE(ba.append("\0", 1), QByteArray::fromRawData("foo123\0", 7)); - QCOMPARE(ba.size(), 7); + QCOMPARE(ba.append(-1, 'x'), QByteArray("foo123")); + QCOMPARE(ba.append(3, 'x'), QByteArray("foo123xxx")); + QCOMPARE(ba.append("\0"), QByteArray("foo123xxx")); + QCOMPARE(ba.append("\0", 1), QByteArray::fromRawData("foo123xxx\0", 10)); + QCOMPARE(ba.size(), 10); } void tst_QByteArray::appendExtended_data() @@ -958,9 +960,11 @@ void tst_QByteArray::appendExtended() QCOMPARE(array.append("1"), QByteArray("data1")); QCOMPARE(array.append(QByteArray("2")), QByteArray("data12")); QCOMPARE(array.append('3'), QByteArray("data123")); - QCOMPARE(array.append("\0"), QByteArray("data123")); - QCOMPARE(array.append("\0", 1), QByteArray::fromRawData("data123\0", 8)); - QCOMPARE(array.size(), 8); + QCOMPARE(array.append(-1, 'x'), QByteArray("data123")); + QCOMPARE(array.append(3, 'x'), QByteArray("data123xxx")); + QCOMPARE(array.append("\0"), QByteArray("data123xxx")); + QCOMPARE(array.append("\0", 1), QByteArray::fromRawData("data123xxx\0", 11)); + QCOMPARE(array.size(), 11); } void tst_QByteArray::insert() @@ -976,6 +980,12 @@ void tst_QByteArray::insert() QCOMPARE(ba.insert(1, 'b'), QByteArray("abc")); QCOMPARE(ba.size(), 3); + ba = "ac"; + QCOMPARE(ba.insert(-1, 3, 'x'), QByteArray("ac")); + QCOMPARE(ba.insert(1, 3, 'x'), QByteArray("axxxc")); + QCOMPARE(ba.insert(6, 3, 'x'), QByteArray("axxxc xxx")); + QCOMPARE(ba.size(), 9); + ba = "ikl"; QCOMPARE(ba.insert(1, "j"), QByteArray("ijkl")); QCOMPARE(ba.size(), 4); @@ -994,7 +1004,8 @@ void tst_QByteArray::insertExtended() { QFETCH(QByteArray, array); QCOMPARE(array.insert(1, "i"), QByteArray("diata")); - QCOMPARE(array.size(), 5); + QCOMPARE(array.insert(1, 3, 'x'), QByteArray("dxxxiata")); + QCOMPARE(array.size(), 8); } void tst_QByteArray::remove_data() @@ -1969,15 +1980,15 @@ void tst_QByteArray::movablity() QCOMPARE(array.isEmpty(), newIsEmpty); QCOMPARE(array.isNull(), newIsNull); QCOMPARE(array.capacity(), newCapacity); - QVERIFY(array.startsWith("a")); - QVERIFY(array.endsWith("b")); + QVERIFY(array.startsWith('a')); + QVERIFY(array.endsWith('b')); QCOMPARE(copy.size(), newSize); QCOMPARE(copy.isEmpty(), newIsEmpty); QCOMPARE(copy.isNull(), newIsNull); QCOMPARE(copy.capacity(), newCapacity); - QVERIFY(copy.startsWith("a")); - QVERIFY(copy.endsWith("b")); + QVERIFY(copy.startsWith('a')); + QVERIFY(copy.endsWith('b')); // try to not crash array.squeeze(); diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray_mac.mm b/tests/auto/corelib/tools/qbytearray/tst_qbytearray_mac.mm index 95d05904a2..98146e3525 100644 --- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray_mac.mm +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray_mac.mm @@ -1,32 +1,27 @@ /**************************************************************************** ** ** Copyright (C) 2014 Samuel Gaist <samuel.gaist@edeltech.ch> -** 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/tools/qbytearraylist/qbytearraylist.pro b/tests/auto/corelib/tools/qbytearraylist/qbytearraylist.pro index 2cd4522f67..6c05c288cf 100644 --- a/tests/auto/corelib/tools/qbytearraylist/qbytearraylist.pro +++ b/tests/auto/corelib/tools/qbytearraylist/qbytearraylist.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qbytearraylist QT = core testlib SOURCES = tst_qbytearraylist.cpp diff --git a/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp b/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp index 9ce9910f6f..85b4c4bfb7 100644 --- a/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp +++ b/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2014 by Southwest Research Institute (R) -** 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$ ** diff --git a/tests/auto/corelib/tools/qbytearraymatcher/qbytearraymatcher.pro b/tests/auto/corelib/tools/qbytearraymatcher/qbytearraymatcher.pro index 7da193d01a..0624e1886c 100644 --- a/tests/auto/corelib/tools/qbytearraymatcher/qbytearraymatcher.pro +++ b/tests/auto/corelib/tools/qbytearraymatcher/qbytearraymatcher.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qbytearraymatcher QT = core testlib SOURCES = tst_qbytearraymatcher.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qbytearraymatcher/tst_qbytearraymatcher.cpp b/tests/auto/corelib/tools/qbytearraymatcher/tst_qbytearraymatcher.cpp index fcb35f92b6..82cc432d55 100644 --- a/tests/auto/corelib/tools/qbytearraymatcher/tst_qbytearraymatcher.cpp +++ b/tests/auto/corelib/tools/qbytearraymatcher/tst_qbytearraymatcher.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/tools/qbytedatabuffer/tst_qbytedatabuffer.cpp b/tests/auto/corelib/tools/qbytedatabuffer/tst_qbytedatabuffer.cpp index ccc770d4b3..59f4d153e6 100644 --- a/tests/auto/corelib/tools/qbytedatabuffer/tst_qbytedatabuffer.cpp +++ b/tests/auto/corelib/tools/qbytedatabuffer/tst_qbytedatabuffer.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2012 Hewlett-Packard Development Company, L.P. -** 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/tools/qcache/qcache.pro b/tests/auto/corelib/tools/qcache/qcache.pro index 80a616ce38..07488ef40f 100644 --- a/tests/auto/corelib/tools/qcache/qcache.pro +++ b/tests/auto/corelib/tools/qcache/qcache.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qcache QT = core testlib SOURCES = tst_qcache.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qcache/tst_qcache.cpp b/tests/auto/corelib/tools/qcache/tst_qcache.cpp index f8f55d2830..d880953c1c 100644 --- a/tests/auto/corelib/tools/qcache/tst_qcache.cpp +++ b/tests/auto/corelib/tools/qcache/tst_qcache.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/tools/qchar/qchar.pro b/tests/auto/corelib/tools/qchar/qchar.pro index a72f16fa49..771e4290b8 100644 --- a/tests/auto/corelib/tools/qchar/qchar.pro +++ b/tests/auto/corelib/tools/qchar/qchar.pro @@ -1,10 +1,9 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qchar QT = core-private testlib SOURCES = tst_qchar.cpp TESTDATA += data/NormalizationTest.txt -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 android: !android-no-sdk { RESOURCES += \ diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp index 22fbce9f8e..e51f5d4694 100644 --- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/tools/qchar/tst_qchar.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,10 +38,8 @@ class tst_QChar : public QObject { Q_OBJECT -public slots: - void init(); - void cleanup(); private slots: + void operator_eqeq_int(); void operators_data(); void operators(); void toUpper(); @@ -80,25 +73,30 @@ private slots: void normalization_manual(); void normalizationCorrections(); void unicodeVersion(); -#if defined(Q_OS_WINCE) -private: - QCoreApplication* app; -#endif }; -void tst_QChar::init() -{ -#if defined(Q_OS_WINCE) - int argc = 0; - app = new QCoreApplication(argc, NULL); -#endif -} - -void tst_QChar::cleanup() +void tst_QChar::operator_eqeq_int() { -#if defined(Q_OS_WINCE) - delete app; -#endif + { + const QChar ch = QLatin1Char(' '); + QVERIFY(ch != 0); + QVERIFY(!(ch == 0)); + + QVERIFY(ch == 0x20); + QVERIFY(!(ch != 0x20)); + QVERIFY(0x20 == ch); + QVERIFY(!(0x20 != ch)); + } + { + const QChar ch = QLatin1Char('\0'); + QVERIFY(ch == 0); + QVERIFY(!(ch != 0)); + + QVERIFY(ch != 0x20); + QVERIFY(!(ch == 0x20)); + QVERIFY(0x20 != ch); + QVERIFY(!(0x20 == ch)); + } } void tst_QChar::operators_data() @@ -239,8 +237,8 @@ void tst_QChar::isDigit_data() for (ushort ucs = 0; ucs < 256; ++ucs) { bool isDigit = (ucs <= '9' && ucs >= '0'); - QString tag = QString::fromLatin1("0x%0").arg(QString::number(ucs, 16)); - QTest::newRow(tag.toLatin1()) << ucs << isDigit; + const QByteArray tag = "0x" + QByteArray::number(ucs, 16); + QTest::newRow(tag.constData()) << ucs << isDigit; } } @@ -266,8 +264,8 @@ void tst_QChar::isLetter_data() QTest::addColumn<bool>("expected"); for (ushort ucs = 0; ucs < 256; ++ucs) { - QString tag = QString::fromLatin1("0x%0").arg(QString::number(ucs, 16)); - QTest::newRow(tag.toLatin1()) << ucs << isExpectedLetter(ucs); + const QByteArray tag = "0x" + QByteArray::number(ucs, 16); + QTest::newRow(tag.constData()) << ucs << isExpectedLetter(ucs); } } @@ -288,8 +286,8 @@ void tst_QChar::isLetterOrNumber_data() || (ucs >= '0' && ucs <= '9') || ucs == 0xB2 || ucs == 0xB3 || ucs == 0xB9 || (ucs >= 0xBC && ucs <= 0xBE); - QString tag = QString::fromLatin1("0x%0").arg(QString::number(ucs, 16)); - QTest::newRow(tag.toLatin1()) << ucs << isLetterOrNumber; + const QByteArray tag = "0x" + QByteArray::number(ucs, 16); + QTest::newRow(tag.constData()) << ucs << isLetterOrNumber; } } @@ -403,8 +401,8 @@ void tst_QChar::isSpace_data() for (ushort ucs = 0; ucs < 256; ++ucs) { bool isSpace = (ucs <= 0x0D && ucs >= 0x09) || ucs == 0x20 || ucs == 0xA0 || ucs == 0x85; - QString tag = QString::fromLatin1("0x%0").arg(QString::number(ucs, 16)); - QTest::newRow(tag.toLatin1()) << ucs << isSpace; + const QByteArray tag = "0x" + QByteArray::number(ucs, 16); + QTest::newRow(tag.constData()) << ucs << isSpace; } } @@ -760,7 +758,7 @@ void tst_QChar::normalization_data() if (comment >= 0) line = line.left(comment); - if (line.startsWith("@")) { + if (line.startsWith('@')) { if (line.startsWith("@Part") && line.size() > 5 && QChar(line.at(5)).isDigit()) part = QChar(line.at(5)).digitValue(); continue; @@ -797,8 +795,10 @@ void tst_QChar::normalization_data() } } - QString nm = QString("line #%1 (part %2").arg(linenum).arg(part); - QTest::newRow(nm.toLatin1()) << columns << part; + + const QByteArray nm = "line #" + QByteArray::number(linenum) + " (part " + + QByteArray::number(part); + QTest::newRow(nm.constData()) << columns << part; } } diff --git a/tests/auto/corelib/tools/qcollator/qcollator.pro b/tests/auto/corelib/tools/qcollator/qcollator.pro index 3c5987ffa0..ed879ee70e 100644 --- a/tests/auto/corelib/tools/qcollator/qcollator.pro +++ b/tests/auto/corelib/tools/qcollator/qcollator.pro @@ -1,7 +1,6 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qcollator QT = core testlib SOURCES = tst_qcollator.cpp DEFINES += QT_NO_CAST_TO_ASCII contains(QT_CONFIG,icu):DEFINES += QT_USE_ICU -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp index b0135ab6af..f2f1038dc2 100644 --- a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp +++ b/tests/auto/corelib/tools/qcollator/tst_qcollator.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/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp index 6e09ebb09b..36bc8621d2 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2013 David Faure <faure@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/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp index fb0b971602..f3f335cb92 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2013 David Faure <faure@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/tools/qcommandlineparser/tst_qcommandlineparser.pro b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.pro index 6d3e6d677f..75b74bbf4d 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.pro +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qcommandlineparser QT = core testlib SOURCES = tst_qcommandlineparser.cpp diff --git a/tests/auto/corelib/tools/qcontiguouscache/qcontiguouscache.pro b/tests/auto/corelib/tools/qcontiguouscache/qcontiguouscache.pro index db4412ed59..d79bd16c76 100644 --- a/tests/auto/corelib/tools/qcontiguouscache/qcontiguouscache.pro +++ b/tests/auto/corelib/tools/qcontiguouscache/qcontiguouscache.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qcontiguouscache QT = core testlib SOURCES = tst_qcontiguouscache.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp b/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp index 76687bd478..31a5f93822 100644 --- a/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp +++ b/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.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/tools/qcryptographichash/qcryptographichash.pro b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro index 941a068f8e..15a57c692e 100644 --- a/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro +++ b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro @@ -1,10 +1,9 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qcryptographichash QT = core testlib SOURCES = tst_qcryptographichash.cpp TESTDATA += data/* -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 android: !android-no-sdk { RESOURCES += \ diff --git a/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp b/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp index e7958ce707..dee10cbebc 100644 --- a/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp +++ b/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.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/tools/qdate/qdate.pro b/tests/auto/corelib/tools/qdate/qdate.pro index 6be3164fd7..dd7c6cb888 100644 --- a/tests/auto/corelib/tools/qdate/qdate.pro +++ b/tests/auto/corelib/tools/qdate/qdate.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qdate QT = core testlib SOURCES = tst_qdate.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qdate/tst_qdate.cpp b/tests/auto/corelib/tools/qdate/tst_qdate.cpp index 937a490da2..f22138b795 100644 --- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp +++ b/tests/auto/corelib/tools/qdate/tst_qdate.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$ ** @@ -1068,7 +1064,7 @@ void tst_QDate::fromStringFormat_data() QTest::newRow("data14") << QString("132") << QString("Md") << invalidDate(); QTest::newRow("data15") << february << QString("MMMM") << QDate(defDate().year(), 2, 1); - QString date = mon + " " + august + " 8 2005"; + QString date = mon + QLatin1Char(' ') + august + " 8 2005"; QTest::newRow("data16") << date << QString("ddd MMMM d yyyy") << QDate(2005, 8, 8); QTest::newRow("data17") << QString("2000:00") << QString("yyyy:yy") << QDate(2000, 1, 1); QTest::newRow("data18") << QString("1999:99") << QString("yyyy:yy") << QDate(1999, 1, 1); diff --git a/tests/auto/corelib/tools/qdatetime/qdatetime.pro b/tests/auto/corelib/tools/qdatetime/qdatetime.pro index 25d11443e4..ba36621cf1 100644 --- a/tests/auto/corelib/tools/qdatetime/qdatetime.pro +++ b/tests/auto/corelib/tools/qdatetime/qdatetime.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qdatetime QT = core-private testlib SOURCES = tst_qdatetime.cpp @@ -10,7 +10,6 @@ win32-msvc|win32-msvc9x { QMAKE_CFLAGS_RELEASE -= -O1 QMAKE_CXXFLAGS_RELEASE -= -O1 } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 mac { OBJECTIVE_SOURCES += tst_qdatetime_mac.mm diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index f6f1c05814..cfec327319 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.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$ ** @@ -718,8 +714,6 @@ void tst_QDateTime::fromMSecsSinceEpoch() QCOMPARE(dtLocal.toLocalTime(), cet); QCOMPARE(dtUtc.toLocalTime(), cet); QCOMPARE(dtOffset.toLocalTime(), cet); - } else { - QSKIP("You must test using Central European (CET/CEST) time zone, e.g. TZ=Europe/Oslo"); } // LocalTime will overflow for max @@ -1885,13 +1879,15 @@ void tst_QDateTime::operator_insert_extract_data() const int thisVersion = tmpDataStream.version(); for (int version = QDataStream::Qt_1_0; version <= thisVersion; ++version) { const QDataStream::Version dataStreamVersion = static_cast<QDataStream::Version>(version); - QTest::newRow(QString::fromLatin1("v%1 WA => HAWAII %2").arg(dataStreamVersion).arg(positiveYear.toString()).toLocal8Bit().constData()) + const QByteArray vN = QByteArray::number(dataStreamVersion); + const QByteArray pY = positiveYear.toString().toLatin1(); + QTest::newRow(('v' + vN + " WA => HAWAII " + pY).constData()) << positiveYear << westernAustralia << hawaii << dataStreamVersion; - QTest::newRow(QString::fromLatin1("v%1 WA => WA %2").arg(dataStreamVersion).arg(positiveYear.toString()).toLocal8Bit().constData()) + QTest::newRow(('v' + vN + " WA => WA " + pY).constData()) << positiveYear << westernAustralia << westernAustralia << dataStreamVersion; - QTest::newRow(QString::fromLatin1("v%1 HAWAII => WA %2").arg(dataStreamVersion).arg(negativeYear.toString()).toLocal8Bit().constData()) + QTest::newRow(('v' + vN + " HAWAII => WA " + negativeYear.toString().toLatin1()).constData()) << negativeYear << hawaii << westernAustralia << dataStreamVersion; - QTest::newRow(QString::fromLatin1("v%1 HAWAII => HAWAII %2").arg(dataStreamVersion).arg(positiveYear.toString()).toLocal8Bit().constData()) + QTest::newRow(('v' + vN + " HAWAII => HAWAII " + pY).constData()) << positiveYear << hawaii << hawaii << dataStreamVersion; } } @@ -2292,11 +2288,11 @@ void tst_QDateTime::fromStringStringFormat_data() QTest::newRow("data9") << QString("101010") << QString("dMyy") << QDateTime(QDate(1910, 10, 10), QTime()); QTest::newRow("data10") << QString("101010") << QString("dMyy") << QDateTime(QDate(1910, 10, 10), QTime()); QTest::newRow("data11") << date << QString("dd MMM yy") << QDateTime(QDate(1910, 10, 10), QTime()); - date = fri + " " + december + " 3 2004"; + date = fri + QLatin1Char(' ') + december + " 3 2004"; QTest::newRow("data12") << date << QString("ddd MMMM d yyyy") << QDateTime(QDate(2004, 12, 3), QTime()); QTest::newRow("data13") << QString("30.02.2004") << QString("dd.MM.yyyy") << invalidDateTime(); QTest::newRow("data14") << QString("32.01.2004") << QString("dd.MM.yyyy") << invalidDateTime(); - date = thu + " " + january + " 2004"; + date = thu + QLatin1Char(' ') + january + " 2004"; QTest::newRow("data15") << date << QString("ddd MMMM yyyy") << QDateTime(QDate(2004, 1, 1), QTime()); QTest::newRow("data16") << QString("2005-06-28T07:57:30.001Z") << QString("yyyy-MM-ddThh:mm:ss.zZ") diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime_mac.mm b/tests/auto/corelib/tools/qdatetime/tst_qdatetime_mac.mm index 0ad9a8253b..fb49b8952e 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime_mac.mm +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime_mac.mm @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2014 Petroules Corporation. -** 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/tools/qeasingcurve/qeasingcurve.pro b/tests/auto/corelib/tools/qeasingcurve/qeasingcurve.pro index 679f9bbda4..80c5a94a83 100644 --- a/tests/auto/corelib/tools/qeasingcurve/qeasingcurve.pro +++ b/tests/auto/corelib/tools/qeasingcurve/qeasingcurve.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qeasingcurve QT = core testlib SOURCES = tst_qeasingcurve.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp index dd88edae7b..0714883855 100644 --- a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp +++ b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.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/tools/qelapsedtimer/qelapsedtimer.pro b/tests/auto/corelib/tools/qelapsedtimer/qelapsedtimer.pro index 7e9f907915..657a63a5d7 100644 --- a/tests/auto/corelib/tools/qelapsedtimer/qelapsedtimer.pro +++ b/tests/auto/corelib/tools/qelapsedtimer/qelapsedtimer.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qelapsedtimer QT = core testlib SOURCES = tst_qelapsedtimer.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp b/tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp index 4d6b5e4e41..9db001c37d 100644 --- a/tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp +++ b/tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.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/tools/qexplicitlyshareddatapointer/qexplicitlyshareddatapointer.pro b/tests/auto/corelib/tools/qexplicitlyshareddatapointer/qexplicitlyshareddatapointer.pro index 2ee091c139..45fe1f60fe 100644 --- a/tests/auto/corelib/tools/qexplicitlyshareddatapointer/qexplicitlyshareddatapointer.pro +++ b/tests/auto/corelib/tools/qexplicitlyshareddatapointer/qexplicitlyshareddatapointer.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qexplicitlyshareddatapointer QT = core testlib SOURCES = tst_qexplicitlyshareddatapointer.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp b/tests/auto/corelib/tools/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp index 750fdec3e7..f545ead1f1 100644 --- a/tests/auto/corelib/tools/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp +++ b/tests/auto/corelib/tools/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.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/tools/qfreelist/qfreelist.pro b/tests/auto/corelib/tools/qfreelist/qfreelist.pro index 60ae819f87..fb108338bd 100644 --- a/tests/auto/corelib/tools/qfreelist/qfreelist.pro +++ b/tests/auto/corelib/tools/qfreelist/qfreelist.pro @@ -1,7 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qfreelist QT = core-private testlib SOURCES = tst_qfreelist.cpp !contains(QT_CONFIG,private_tests): SOURCES += $$QT_SOURCE_TREE/src/corelib/tools/qfreelist.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp b/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp index 381362961a..a09bcd5121 100644 --- a/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp +++ b/tests/auto/corelib/tools/qfreelist/tst_qfreelist.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/tools/qhash/qhash.pro b/tests/auto/corelib/tools/qhash/qhash.pro index 1ed062ca91..79ffd4e9d1 100644 --- a/tests/auto/corelib/tools/qhash/qhash.pro +++ b/tests/auto/corelib/tools/qhash/qhash.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qhash QT = core testlib SOURCES = $$PWD/tst_qhash.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp index 6a5c6b5670..4336d02b2c 100644 --- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp +++ b/tests/auto/corelib/tools/qhash/tst_qhash.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$ ** @@ -37,6 +32,7 @@ #include <qmap.h> #include <algorithm> +#include <vector> class tst_QHash : public QObject { @@ -70,6 +66,7 @@ private slots: void twoArguments_qHash(); void initializerList(); void eraseValidIteratorOnSharedHash(); + void equal_range(); }; struct IdentityTracker { @@ -510,24 +507,24 @@ void tst_QHash::key() QCOMPARE(hash1.key(1, def), def); hash1.insert("one", 1); - QCOMPARE(hash1.key(1), QString("one")); - QCOMPARE(hash1.key(1, def), QString("one")); + QCOMPARE(hash1.key(1), QLatin1String("one")); + QCOMPARE(hash1.key(1, def), QLatin1String("one")); QCOMPARE(hash1.key(2), QString()); QCOMPARE(hash1.key(2, def), def); hash1.insert("two", 2); - QCOMPARE(hash1.key(1), QString("one")); - QCOMPARE(hash1.key(1, def), QString("one")); - QCOMPARE(hash1.key(2), QString("two")); - QCOMPARE(hash1.key(2, def), QString("two")); + QCOMPARE(hash1.key(1), QLatin1String("one")); + QCOMPARE(hash1.key(1, def), QLatin1String("one")); + QCOMPARE(hash1.key(2), QLatin1String("two")); + QCOMPARE(hash1.key(2, def), QLatin1String("two")); QCOMPARE(hash1.key(3), QString()); QCOMPARE(hash1.key(3, def), def); hash1.insert("deux", 2); - QCOMPARE(hash1.key(1), QString("one")); - QCOMPARE(hash1.key(1, def), QString("one")); - QVERIFY(hash1.key(2) == "deux" || hash1.key(2) == "two"); - QVERIFY(hash1.key(2, def) == "deux" || hash1.key(2, def) == "two"); + QCOMPARE(hash1.key(1), QLatin1String("one")); + QCOMPARE(hash1.key(1, def), QLatin1String("one")); + QVERIFY(hash1.key(2) == QLatin1String("deux") || hash1.key(2) == QLatin1String("two")); + QVERIFY(hash1.key(2, def) == QLatin1String("deux") || hash1.key(2, def) == QLatin1String("two")); QCOMPARE(hash1.key(3), QString()); QCOMPARE(hash1.key(3, def), def); } @@ -628,8 +625,8 @@ void tst_QHash::find() map1.insert(1,"Mayer"); map1.insert(2,"Hej"); - QVERIFY(map1.find(1).value() == "Mayer"); - QVERIFY(map1.find(2).value() == "Hej"); + QCOMPARE(map1.find(1).value(), QLatin1String("Mayer")); + QCOMPARE(map1.find(2).value(), QLatin1String("Hej")); for(i = 3; i < 10; ++i) { compareString = testString.arg(i); @@ -661,8 +658,8 @@ void tst_QHash::constFind() map1.insert(1,"Mayer"); map1.insert(2,"Hej"); - QVERIFY(map1.constFind(1).value() == "Mayer"); - QVERIFY(map1.constFind(2).value() == "Hej"); + QCOMPARE(map1.constFind(1).value(), QLatin1String("Mayer")); + QCOMPARE(map1.constFind(2).value(), QLatin1String("Hej")); for(i = 3; i < 10; ++i) { compareString = testString.arg(i); @@ -706,7 +703,7 @@ void tst_QHash::take() map.insert(2, "zwei"); map.insert(3, "drei"); - QVERIFY(map.take(3) == "drei"); + QCOMPARE(map.take(3), QLatin1String("drei")); QVERIFY(!map.contains(3)); } @@ -1360,5 +1357,111 @@ void tst_QHash::eraseValidIteratorOnSharedHash() QCOMPARE(itemsWith10, 3); } +void tst_QHash::equal_range() +{ + QHash<int, QString> hash; + + auto result = hash.equal_range(0); + QCOMPARE(result.first, hash.end()); + QCOMPARE(result.second, hash.end()); + + hash.insert(1, "one"); + + result = hash.equal_range(1); + + QCOMPARE(result.first, hash.find(1)); + QVERIFY(std::distance(result.first, result.second) == 1); + + QHash<int, int> h1; + { + auto p = h1.equal_range(0); + QVERIFY(p.first == p.second); + QVERIFY(p.first == h1.end()); + } + + h1.insert(1, 2); + { + auto p1 = h1.equal_range(9); + QVERIFY(p1.first == p1.second); + QVERIFY(p1.first == h1.end()); + } + { + auto p2 = h1.equal_range(1); + QVERIFY(p2.first != p2.second); + QVERIFY(p2.first == h1.begin()); + QVERIFY(p2.second == h1.end()); + } + + QMultiHash<int, int> m1 = h1; + m1.insert(1, 0); + QCOMPARE(m1.size(), 2); + { + auto p1 = m1.equal_range(9); + QVERIFY(p1.first == p1.second); + QVERIFY(p1.first == m1.end()); + } + { + auto p2 = m1.equal_range(1); + QVERIFY(p2.first != p2.second); + QVERIFY(p2.first == m1.begin()); + QVERIFY(p2.second == m1.end()); + QCOMPARE(std::distance(p2.first, p2.second), 2); + } + + m1.insert(0, 0); + QCOMPARE(m1.size(), 3); + { + auto p1 = m1.equal_range(9); + QVERIFY(p1.first == p1.second); + QVERIFY(p1.first == m1.end()); + } + { + const auto p2 = m1.equal_range(1); + QVERIFY(p2.first != p2.second); + QCOMPARE(p2.first.key(), 1); + QCOMPARE(std::distance(p2.first, p2.second), 2); + QVERIFY(p2.first == m1.begin() || p2.second == m1.end()); + } + + const QHash<int, int> ch1 = h1; + { + auto p1 = ch1.equal_range(9); + QVERIFY(p1.first == p1.second); + QVERIFY(p1.first == ch1.end()); + } + { + auto p2 = ch1.equal_range(1); + QVERIFY(p2.first != p2.second); + QVERIFY(p2.first == ch1.begin()); + QVERIFY(p2.second == ch1.end()); + } + + const QMultiHash<int, int> cm1 = m1; + { + auto p1 = cm1.equal_range(9); + QVERIFY(p1.first == p1.second); + QVERIFY(p1.first == cm1.end()); + } + { + auto p2 = cm1.equal_range(1); + QVERIFY(p2.first != p2.second); + QCOMPARE(std::distance(p2.first, p2.second), 2); + QVERIFY(p2.first == cm1.cbegin() || p2.second == cm1.cend()); + } + + QHash<int, int> h2; + for (int i = 0; i < 8; ++i) + for (int j = 0; j < 8; ++j) + h2.insertMulti(i, i*j); + + for (int i = 0; i < 8; ++i) { + auto pair = h2.equal_range(i); + std::vector<int> vec(pair.first, pair.second); + std::sort(vec.begin(), vec.end()); + for (int j = 0; j < 8; ++j) + QCOMPARE(i*j, vec[j]); + } +} + QTEST_APPLESS_MAIN(tst_QHash) #include "tst_qhash.moc" diff --git a/tests/auto/corelib/tools/qhashfunctions/qhashfunctions.pro b/tests/auto/corelib/tools/qhashfunctions/qhashfunctions.pro index 21426a4f55..853e9f30e5 100644 --- a/tests/auto/corelib/tools/qhashfunctions/qhashfunctions.pro +++ b/tests/auto/corelib/tools/qhashfunctions/qhashfunctions.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qhashfunctions QT = core testlib SOURCES = $$PWD/tst_qhashfunctions.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp index bde9433a24..7cdee891bb 100644 --- a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp +++ b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.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$ ** @@ -115,6 +110,22 @@ void tst_QHashFunctions::qhash() QVERIFY(qHash(pA) != qHash(pB)); } + + { + std::pair<int, int> p12(1, 2); + std::pair<int, int> p21(2, 1); + + using QT_PREPEND_NAMESPACE(qHash); + + QVERIFY(qHash(p12) == qHash(p12)); + QVERIFY(qHash(p21) == qHash(p21)); + QVERIFY(qHash(p12) != qHash(p21)); + + std::pair<int, int> pA(0x12345678, 0x12345678); + std::pair<int, int> pB(0x12345675, 0x12345675); + + QVERIFY(qHash(pA) != qHash(pB)); + } } void tst_QHashFunctions::fp_qhash_of_zero_is_zero() diff --git a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp index 290c9fc12a..1295a36c1a 100644 --- a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp +++ b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.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/tools/qline/qline.pro b/tests/auto/corelib/tools/qline/qline.pro index 56f852ac52..c66df2cd68 100644 --- a/tests/auto/corelib/tools/qline/qline.pro +++ b/tests/auto/corelib/tools/qline/qline.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qline QT = core testlib SOURCES = tst_qline.cpp unix:!mac:!vxworks:!haiku:LIBS+=-lm -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qline/tst_qline.cpp b/tests/auto/corelib/tools/qline/tst_qline.cpp index 20373bfb15..3aee0ff17d 100644 --- a/tests/auto/corelib/tools/qline/tst_qline.cpp +++ b/tests/auto/corelib/tools/qline/tst_qline.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$ ** @@ -179,7 +174,7 @@ void tst_QLine::testIntersection_data() a = a.translated(1, 1); b = b.translated(1, 1); - QTest::newRow(qPrintable(QString::fromLatin1("rotation-%0").arg(i))) + QTest::newRow(("rotation-" + QByteArray::number(i)).constData()) << (double)a.x1() << (double)a.y1() << (double)a.x2() << (double)a.y2() << (double)b.x1() << (double)b.y1() << (double)b.x2() << (double)b.y2() << int(QLineF::BoundedIntersection) @@ -332,7 +327,7 @@ void tst_QLine::testAngle_data() << 135.0; for (int i=0; i<180; ++i) { - QTest::newRow(QString("angle:%1").arg(i).toLatin1()) + QTest::newRow(("angle:" + QByteArray::number(i)).constData()) << 0.0 << 0.0 << double(cos(i*M_2PI/360)) << double(sin(i*M_2PI/360)) << 0.0 << 0.0 << 1.0 << 0.0 << double(i); @@ -460,7 +455,7 @@ void tst_QLine::testAngleTo_data() for (int i = 0; i < 360; ++i) { const QLineF l = QLineF::fromPolar(1, i); - QTest::newRow(QString("angle:%1").arg(i).toLatin1()) + QTest::newRow(("angle:" + QByteArray::number(i)).constData()) << qreal(0.0) << qreal(0.0) << qreal(1.0) << qreal(0.0) << qreal(0.0) << qreal(0.0) << l.p2().x() << l.p2().y() << qreal(i); diff --git a/tests/auto/corelib/tools/qlinkedlist/qlinkedlist.pro b/tests/auto/corelib/tools/qlinkedlist/qlinkedlist.pro index 439bf03707..80630f78ad 100644 --- a/tests/auto/corelib/tools/qlinkedlist/qlinkedlist.pro +++ b/tests/auto/corelib/tools/qlinkedlist/qlinkedlist.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qlinkedlist QT = core testlib SOURCES = tst_qlinkedlist.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp b/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp index d3ace40164..4c4cb4879b 100644 --- a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp +++ b/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.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/tools/qlist/qlist.pro b/tests/auto/corelib/tools/qlist/qlist.pro index 43c06e0ee1..47f0140abb 100644 --- a/tests/auto/corelib/tools/qlist/qlist.pro +++ b/tests/auto/corelib/tools/qlist/qlist.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qlist QT = core testlib SOURCES = $$PWD/tst_qlist.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qlist/tst_qlist.cpp b/tests/auto/corelib/tools/qlist/tst_qlist.cpp index 1bb31afa9c..bae8ece303 100644 --- a/tests/auto/corelib/tools/qlist/tst_qlist.cpp +++ b/tests/auto/corelib/tools/qlist/tst_qlist.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/tools/qlocale/syslocaleapp/syslocaleapp.cpp b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.cpp index 5aec10e55e..1e1bcc8c5f 100644 --- a/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.cpp +++ b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.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/tools/qlocale/syslocaleapp/syslocaleapp.pro b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro index 8995fce52c..b61f51d53a 100644 --- a/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro +++ b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro @@ -6,4 +6,3 @@ CONFIG -= app_bundle QT = core -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qlocale/test/test.pro b/tests/auto/corelib/tools/qlocale/test/test.pro index 60afb29233..d9004d1eb6 100644 --- a/tests/auto/corelib/tools/qlocale/test/test.pro +++ b/tests/auto/corelib/tools/qlocale/test/test.pro @@ -1,10 +1,13 @@ CONFIG += console testcase -CONFIG += parallel_test CONFIG -= app_bundle QT = core testlib core-private embedded: QT += gui SOURCES = ../tst_qlocale.cpp +!contains(QT_CONFIG, doubleconversion):!contains(QT_CONFIG, system-doubleconversion) { + DEFINES += QT_NO_DOUBLECONVERSION +} + TARGET = ../tst_qlocale win32 { CONFIG(debug, debug|release) { @@ -15,6 +18,3 @@ win32 { } !winrt: TEST_HELPER_INSTALLS = ../syslocaleapp/syslocaleapp - -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -blackberry:LIBS += -lpps diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 5f046575c4..352d82796d 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.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$ ** @@ -42,9 +37,11 @@ #include <qdatetime.h> #include <qprocess.h> #include <float.h> +#include <locale.h> #include <qlocale.h> #include <private/qlocale_p.h> +#include <private/qlocale_tools_p.h> #include <qnumeric.h> #if defined(Q_OS_LINUX) && !defined(__UCLIBC__) @@ -68,52 +65,6 @@ extern "C" DWORD GetThreadLocale(void) { # include <stdlib.h> #endif -#ifdef Q_OS_BLACKBERRY -#include <unistd.h> -#include <errno.h> -#include <fcntl.h> -#include <sys/stat.h> -#include <sys/pps.h> - -static const char ppsLanguageLocalePath[] = "/pps/services/confstr/_CS_LOCALE"; -static const size_t ppsBufferSize = 256; - -static QByteArray readPpsValue(const char *ppsObject, int ppsFd) -{ - QByteArray result; - if (!ppsObject || ppsFd == -1) - return result; - - char buffer[ppsBufferSize]; - - int bytes = read(ppsFd, buffer, ppsBufferSize - 1); - if (bytes == -1) { - qFatal("Failed to read Locale pps, errno=%d", errno); - return result; - } - // ensure data is null terminated - buffer[bytes] = '\0'; - - pps_decoder_t ppsDecoder; - pps_decoder_initialize(&ppsDecoder, 0); - if (pps_decoder_parse_pps_str(&ppsDecoder, buffer) == PPS_DECODER_OK) { - pps_decoder_push(&ppsDecoder, 0); - const char *ppsBuff; - if (pps_decoder_get_string(&ppsDecoder, ppsObject, &ppsBuff) == PPS_DECODER_OK) { - result = ppsBuff; - } else { - int val; - if (pps_decoder_get_int(&ppsDecoder, ppsObject, &val) == PPS_DECODER_OK) - result = QByteArray::number(val); - } - } - - pps_decoder_cleanup(&ppsDecoder); - - return result; -} -#endif // Q_OS_BLACKBERRY - Q_DECLARE_METATYPE(QLocale::FormatType) class tst_QLocale : public QObject @@ -140,8 +91,12 @@ private slots: void legacyNames(); void unixLocaleName(); void matchingLocales(); - void double_conversion_data(); - void double_conversion(); + void stringToDouble_data(); + void stringToDouble(); + void doubleToString_data(); + void doubleToString(); + void strtod_data(); + void strtod(); void long_long_conversion_data(); void long_long_conversion(); void long_long_conversion_extra(); @@ -194,10 +149,6 @@ private: QString m_decimal, m_thousand, m_sdate, m_ldate, m_time; QString m_sysapp; bool europeanTimeZone; - -#ifdef Q_OS_BLACKBERRY - int m_languageFd; -#endif }; tst_QLocale::tst_QLocale() @@ -212,6 +163,7 @@ tst_QLocale::tst_QLocale() void tst_QLocale::initTestCase() { +#ifndef QT_NO_PROCESS const QString syslocaleapp_dir = QFINDTESTDATA("syslocaleapp"); QVERIFY2(!syslocaleapp_dir.isEmpty(), qPrintable(QStringLiteral("Cannot find 'syslocaleapp' starting from ") @@ -224,19 +176,11 @@ void tst_QLocale::initTestCase() QVERIFY2(fi.exists() && fi.isExecutable(), qPrintable(QDir::toNativeSeparators(m_sysapp) + QStringLiteral(" does not exist or is not executable."))); - -#ifdef Q_OS_BLACKBERRY - if ((m_languageFd = open(ppsLanguageLocalePath, O_RDONLY)) == -1) - QFAIL("Failed to open language pps."); -#endif +#endif // QT_NO_PROCESS } void tst_QLocale::cleanupTestCase() -{ -#ifdef Q_OS_BLACKBERRY - close(m_languageFd); -#endif -} +{} void tst_QLocale::ctor() { @@ -370,7 +314,7 @@ void tst_QLocale::ctor() && l.country() == QLocale::exp_country, \ QString("requested: \"" + QString(req_lc) + "\", got: " \ + QLocale::languageToString(l.language()) \ - + "/" + QLocale::countryToString(l.country())).toLatin1().constData()); \ + + QLatin1Char('/') + QLocale::countryToString(l.country())).toLatin1().constData()); \ QCOMPARE(l, QLocale(QLocale::exp_lang, QLocale::exp_country)); \ QCOMPARE(qHash(l), qHash(QLocale(QLocale::exp_lang, QLocale::exp_country))); \ } @@ -431,8 +375,8 @@ void tst_QLocale::ctor() && l.country() == QLocale::exp_country, \ QString("requested: \"" + QString(req_lc) + "\", got: " \ + QLocale::languageToString(l.language()) \ - + "/" + QLocale::scriptToString(l.script()) \ - + "/" + QLocale::countryToString(l.country())).toLatin1().constData()); \ + + QLatin1Char('/') + QLocale::scriptToString(l.script()) \ + + QLatin1Char('/') + QLocale::countryToString(l.country())).toLatin1().constData()); \ } TEST_CTOR("zh_CN", Chinese, SimplifiedHanScript, China) @@ -532,11 +476,6 @@ void tst_QLocale::emptyCtor() QVERIFY2(runSysApp(m_sysapp, env, &defaultLoc, &errorMessage), qPrintable(errorMessage)); -#ifdef Q_OS_BLACKBERRY - QString locale = readPpsValue("_CS_LOCALE", m_languageFd); - QVERIFY2(runSysApp(m_sysapp, env, &locale, &errorMessage), - qPrintable(errorMessage)); -#else TEST_CTOR("C", "C") TEST_CTOR("bla", "C") TEST_CTOR("zz", "C") @@ -574,7 +513,6 @@ void tst_QLocale::emptyCtor() TEST_CTOR("en/", defaultLoc.toLatin1()) TEST_CTOR("asdfghj", defaultLoc.toLatin1()); TEST_CTOR("123456", defaultLoc.toLatin1()); -#endif // Q_OS_BLACKBERRY #undef TEST_CTOR #endif @@ -606,7 +544,7 @@ void tst_QLocale::legacyNames() && l.country() == QLocale::exp_country, \ QString("requested: \"" + QString(req_lc) + "\", got: " \ + QLocale::languageToString(l.language()) \ - + "/" + QLocale::countryToString(l.country())).toLatin1().constData()); \ + + QLatin1Char('/') + QLocale::countryToString(l.country())).toLatin1().constData()); \ } TEST_CTOR("mo_MD", Romanian, Moldova) @@ -665,7 +603,7 @@ void tst_QLocale::unixLocaleName() #undef TEST_NAME } -void tst_QLocale::double_conversion_data() +void tst_QLocale::stringToDouble_data() { QTest::addColumn<QString>("locale_name"); QTest::addColumn<QString>("num_str"); @@ -787,7 +725,7 @@ void tst_QLocale::double_conversion_data() QTest::newRow("de_DE 9.876543,0e--2") << QString("de_DE") << QString("9.876543,0e")+QChar(8722)+QString("2") << false << 0.0; } -void tst_QLocale::double_conversion() +void tst_QLocale::stringToDouble() { #define MY_DOUBLE_EPSILON (2.22045e-16) @@ -804,6 +742,11 @@ void tst_QLocale::double_conversion() double d = locale.toDouble(num_str, &ok); QCOMPARE(ok, good); + char *currentLocale = setlocale(LC_ALL, "de_DE"); + QCOMPARE(locale.toDouble(num_str, &ok), d); // make sure result is independent of locale + QCOMPARE(ok, good); + setlocale(LC_ALL, currentLocale); + if (ok) { double diff = d - num; if (diff < 0) @@ -822,6 +765,178 @@ void tst_QLocale::double_conversion() } } +void tst_QLocale::doubleToString_data() +{ + QTest::addColumn<QString>("locale_name"); + QTest::addColumn<QString>("num_str"); + QTest::addColumn<double>("num"); + QTest::addColumn<char>("mode"); + QTest::addColumn<int>("precision"); + + int shortest = QLocale::FloatingPointShortest; + + QTest::newRow("C 3.4 f 5") << QString("C") << QString("3.40000") << 3.4 << 'f' << 5; + QTest::newRow("C 3.4 f 0") << QString("C") << QString("3") << 3.4 << 'f' << 0; + QTest::newRow("C 3.4 e 5") << QString("C") << QString("3.40000e+00") << 3.4 << 'e' << 5; + QTest::newRow("C 3.4 e 0") << QString("C") << QString("3e+00") << 3.4 << 'e' << 0; + QTest::newRow("C 3.4 g 5") << QString("C") << QString("3.4") << 3.4 << 'g' << 5; + QTest::newRow("C 3.4 g 1") << QString("C") << QString("3") << 3.4 << 'g' << 1; + + QTest::newRow("C 3.4 f 1") << QString("C") << QString("3.4") << 3.4 << 'f' << 1; + QTest::newRow("C 3.4 f -") << QString("C") << QString("3.4") << 3.4 << 'f' << shortest; + QTest::newRow("C 3.4 e 1") << QString("C") << QString("3.4e+00") << 3.4 << 'e' << 1; + QTest::newRow("C 3.4 e -") << QString("C") << QString("3.4e+00") << 3.4 << 'e' << shortest; + QTest::newRow("C 3.4 g 2") << QString("C") << QString("3.4") << 3.4 << 'g' << 2; + QTest::newRow("C 3.4 g -") << QString("C") << QString("3.4") << 3.4 << 'g' << shortest; + + QTest::newRow("de_DE 3,4 f 1") << QString("de_DE") << QString("3,4") << 3.4 << 'f' << 1; + QTest::newRow("de_DE 3,4 f -") << QString("de_DE") << QString("3,4") << 3.4 << 'f' << shortest; + QTest::newRow("de_DE 3,4 e 1") << QString("de_DE") << QString("3,4e+00") << 3.4 << 'e' << 1; + QTest::newRow("de_DE 3,4 e -") << QString("de_DE") << QString("3,4e+00") << 3.4 << 'e' << shortest; + QTest::newRow("de_DE 3,4 g 2") << QString("de_DE") << QString("3,4") << 3.4 << 'g' << 2; + QTest::newRow("de_DE 3,4 g -") << QString("de_DE") << QString("3,4") << 3.4 << 'g' << shortest; + + QTest::newRow("C 0.035003945 f 12") << QString("C") << QString("0.035003945000") << 0.035003945 << 'f' << 12; + QTest::newRow("C 0.035003945 f 6") << QString("C") << QString("0.035004") << 0.035003945 << 'f' << 6; + QTest::newRow("C 0.035003945 e 10") << QString("C") << QString("3.5003945000e-02") << 0.035003945 << 'e' << 10; + QTest::newRow("C 0.035003945 e 4") << QString("C") << QString("3.5004e-02") << 0.035003945 << 'e' << 4; + QTest::newRow("C 0.035003945 g 11") << QString("C") << QString("0.035003945") << 0.035003945 << 'g' << 11; + QTest::newRow("C 0.035003945 g 5") << QString("C") << QString("0.035004") << 0.035003945 << 'g' << 5; + + QTest::newRow("C 0.035003945 f 9") << QString("C") << QString("0.035003945") << 0.035003945 << 'f' << 9; + QTest::newRow("C 0.035003945 f -") << QString("C") << QString("0.035003945") << 0.035003945 << 'f' << shortest; + QTest::newRow("C 0.035003945 e 7") << QString("C") << QString("3.5003945e-02") << 0.035003945 << 'e' << 7; + QTest::newRow("C 0.035003945 e -") << QString("C") << QString("3.5003945e-02") << 0.035003945 << 'e' << shortest; + QTest::newRow("C 0.035003945 g 8") << QString("C") << QString("0.035003945") << 0.035003945 << 'g' << 8; + QTest::newRow("C 0.035003945 g -") << QString("C") << QString("0.035003945") << 0.035003945 << 'g' << shortest; + + QTest::newRow("de_DE 0,035003945 f 9") << QString("de_DE") << QString("0,035003945") << 0.035003945 << 'f' << 9; + QTest::newRow("de_DE 0,035003945 f -") << QString("de_DE") << QString("0,035003945") << 0.035003945 << 'f' << shortest; + QTest::newRow("de_DE 0,035003945 e 7") << QString("de_DE") << QString("3,5003945e-02") << 0.035003945 << 'e' << 7; + QTest::newRow("de_DE 0,035003945 e -") << QString("de_DE") << QString("3,5003945e-02") << 0.035003945 << 'e' << shortest; + QTest::newRow("de_DE 0,035003945 g 8") << QString("de_DE") << QString("0,035003945") << 0.035003945 << 'g' << 8; + QTest::newRow("de_DE 0,035003945 g -") << QString("de_DE") << QString("0,035003945") << 0.035003945 << 'g' << shortest; + + QTest::newRow("C 0.000003945 f 12") << QString("C") << QString("0.000003945000") << 0.000003945 << 'f' << 12; + QTest::newRow("C 0.000003945 f 6") << QString("C") << QString("0.000004") << 0.000003945 << 'f' << 6; + QTest::newRow("C 0.000003945 e 6") << QString("C") << QString("3.945000e-06") << 0.000003945 << 'e' << 6; + QTest::newRow("C 0.000003945 e 0") << QString("C") << QString("4e-06") << 0.000003945 << 'e' << 0; + QTest::newRow("C 0.000003945 g 7") << QString("C") << QString("3.945e-06") << 0.000003945 << 'g' << 7; + QTest::newRow("C 0.000003945 g 1") << QString("C") << QString("4e-06") << 0.000003945 << 'g' << 1; + + QTest::newRow("C 0.000003945 f 9") << QString("C") << QString("0.000003945") << 0.000003945 << 'f' << 9; + QTest::newRow("C 0.000003945 f -") << QString("C") << QString("0.000003945") << 0.000003945 << 'f' << shortest; + QTest::newRow("C 0.000003945 e 3") << QString("C") << QString("3.945e-06") << 0.000003945 << 'e' << 3; + QTest::newRow("C 0.000003945 e -") << QString("C") << QString("3.945e-06") << 0.000003945 << 'e' << shortest; + QTest::newRow("C 0.000003945 g 4") << QString("C") << QString("3.945e-06") << 0.000003945 << 'g' << 4; + QTest::newRow("C 0.000003945 g -") << QString("C") << QString("3.945e-06") << 0.000003945 << 'g' << shortest; + + QTest::newRow("de_DE 0,000003945 f 9") << QString("de_DE") << QString("0,000003945") << 0.000003945 << 'f' << 9; + QTest::newRow("de_DE 0,000003945 f -") << QString("de_DE") << QString("0,000003945") << 0.000003945 << 'f' << shortest; + QTest::newRow("de_DE 0,000003945 e 3") << QString("de_DE") << QString("3,945e-06") << 0.000003945 << 'e' << 3; + QTest::newRow("de_DE 0,000003945 e -") << QString("de_DE") << QString("3,945e-06") << 0.000003945 << 'e' << shortest; + QTest::newRow("de_DE 0,000003945 g 4") << QString("de_DE") << QString("3,945e-06") << 0.000003945 << 'g' << 4; + QTest::newRow("de_DE 0,000003945 g -") << QString("de_DE") << QString("3,945e-06") << 0.000003945 << 'g' << shortest; + + QTest::newRow("C 12456789012 f 3") << QString("C") << QString("12456789012.000") << 12456789012.0 << 'f' << 3; + QTest::newRow("C 12456789012 e 13") << QString("C") << QString("1.2456789012000e+10") << 12456789012.0 << 'e' << 13; + QTest::newRow("C 12456789012 e 7") << QString("C") << QString("1.2456789e+10") << 12456789012.0 << 'e' << 7; + QTest::newRow("C 12456789012 g 14") << QString("C") << QString("12456789012") << 12456789012.0 << 'g' << 14; + QTest::newRow("C 12456789012 g 8") << QString("C") << QString("1.2456789e+10") << 12456789012.0 << 'g' << 8; + + QTest::newRow("C 12456789012 f 0") << QString("C") << QString("12456789012") << 12456789012.0 << 'f' << 0; + QTest::newRow("C 12456789012 f -") << QString("C") << QString("12456789012") << 12456789012.0 << 'f' << shortest; + QTest::newRow("C 12456789012 e 10") << QString("C") << QString("1.2456789012e+10") << 12456789012.0 << 'e' << 10; + QTest::newRow("C 12456789012 e -") << QString("C") << QString("1.2456789012e+10") << 12456789012.0 << 'e' << shortest; + QTest::newRow("C 12456789012 g 11") << QString("C") << QString("12456789012") << 12456789012.0 << 'g' << 11; + QTest::newRow("C 12456789012 g -") << QString("C") << QString("12456789012") << 12456789012.0 << 'g' << shortest; + + QTest::newRow("de_DE 12456789012 f 0") << QString("de_DE") << QString("12.456.789.012") << 12456789012.0 << 'f' << 0; + QTest::newRow("de_DE 12456789012 f -") << QString("de_DE") << QString("12.456.789.012") << 12456789012.0 << 'f' << shortest; + QTest::newRow("de_DE 12456789012 e 10") << QString("de_DE") << QString("1,2456789012e+10") << 12456789012.0 << 'e' << 10; + QTest::newRow("de_DE 12456789012 e -") << QString("de_DE") << QString("1,2456789012e+10") << 12456789012.0 << 'e' << shortest; + QTest::newRow("de_DE 12456789012 g 11") << QString("de_DE") << QString("12.456.789.012") << 12456789012.0 << 'g' << 11; + QTest::newRow("de_DE 12456789012 g -") << QString("de_DE") << QString("12.456.789.012") << 12456789012.0 << 'g' << shortest; +} + +void tst_QLocale::doubleToString() +{ + QFETCH(QString, locale_name); + QFETCH(QString, num_str); + QFETCH(double, num); + QFETCH(char, mode); + QFETCH(int, precision); + +#ifdef QT_NO_DOUBLECONVERSION + if (precision == QLocale::FloatingPointShortest) + QSKIP("'Shortest' double conversion is not that short without libdouble-conversion"); +#endif + + const QLocale locale(locale_name); + QCOMPARE(locale.toString(num, mode, precision), num_str); + + char *currentLocale = setlocale(LC_ALL, "de_DE"); + QCOMPARE(locale.toString(num, mode, precision), num_str); + setlocale(LC_ALL, currentLocale); +} + +void tst_QLocale::strtod_data() +{ + QTest::addColumn<QString>("num_str"); + QTest::addColumn<double>("num"); + QTest::addColumn<int>("processed"); + QTest::addColumn<bool>("ok"); + + QTest::newRow("3.4") << QString("3.4") << 3.4 << 3 << true; + QTest::newRow("0.035003945") << QString("0.035003945") << 0.035003945 << 11 << true; + QTest::newRow("3.5003945e-2") << QString("3.5003945e-2") << 0.035003945 << 12 << true; + QTest::newRow("0.000003945") << QString("0.000003945") << 0.000003945 << 11 << true; + QTest::newRow("3.945e-6") << QString("3.945e-6") << 0.000003945 << 8 << true; + QTest::newRow("12456789012") << QString("12456789012") << 12456789012.0 << 11 << true; + QTest::newRow("1.2456789012e10") << QString("1.2456789012e10") << 12456789012.0 << 15 << true; + + QTest::newRow("a3.4") << QString("a3.4") << 0.0 << 0 << false; + QTest::newRow("b0.035003945") << QString("b0.035003945") << 0.0 << 0 << false; + QTest::newRow("c3.5003945e-2") << QString("c3.5003945e-2") << 0.0 << 0 << false; + QTest::newRow("d0.000003945") << QString("d0.000003945") << 0.0 << 0 << false; + QTest::newRow("e3.945e-6") << QString("e3.945e-6") << 0.0 << 0 << false; + QTest::newRow("f12456789012") << QString("f12456789012") << 0.0 << 0 << false; + QTest::newRow("g1.2456789012e10") << QString("g1.2456789012e10") << 0.0 << 0 << false; + + QTest::newRow("3.4a") << QString("3.4a") << 3.4 << 3 << true; + QTest::newRow("0.035003945b") << QString("0.035003945b") << 0.035003945 << 11 << true; + QTest::newRow("3.5003945e-2c") << QString("3.5003945e-2c") << 0.035003945 << 12 << true; + QTest::newRow("0.000003945d") << QString("0.000003945d") << 0.000003945 << 11 << true; + QTest::newRow("3.945e-6e") << QString("3.945e-6e") << 0.000003945 << 8 << true; + QTest::newRow("12456789012f") << QString("12456789012f") << 12456789012.0 << 11 << true; + QTest::newRow("1.2456789012e10g") << QString("1.2456789012e10g") << 12456789012.0 << 15 << true; + + QTest::newRow("0x3.4") << QString("0x3.4") << 0.0 << 1 << true; + QTest::newRow("0x0.035003945") << QString("0x0.035003945") << 0.0 << 1 << true; + QTest::newRow("0x3.5003945e-2") << QString("0x3.5003945e-2") << 0.0 << 1 << true; + QTest::newRow("0x0.000003945") << QString("0x0.000003945") << 0.0 << 1 << true; + QTest::newRow("0x3.945e-6") << QString("0x3.945e-6") << 0.0 << 1 << true; + QTest::newRow("0x12456789012") << QString("0x12456789012") << 0.0 << 1 << true; + QTest::newRow("0x1.2456789012e10") << QString("0x1.2456789012e10") << 0.0 << 1 << true; +} + +void tst_QLocale::strtod() +{ + QFETCH(QString, num_str); + QFETCH(double, num); + QFETCH(int, processed); + QFETCH(bool, ok); + + QByteArray numData = num_str.toLatin1(); + const char *end = 0; + bool actualOk = false; + double result = qstrtod(numData.constData(), &end, &actualOk); + + QCOMPARE(result, num); + QCOMPARE(actualOk, ok); + QCOMPARE(static_cast<int>(end - numData.constData()), processed); +} + void tst_QLocale::long_long_conversion_data() { QTest::addColumn<QString>("locale_name"); @@ -953,7 +1068,8 @@ void tst_QLocale::fpExceptions() #define _EM_INEXACT 0x00000001 #endif - // check that qdtoa doesn't throw floating point exceptions when they are enabled + // check that double-to-string conversion doesn't throw floating point exceptions when they are + // enabled #ifdef Q_OS_WIN unsigned int oldbits = _control87(0, 0); _control87( 0 | _EM_INEXACT, _MCW_EM ); @@ -1279,13 +1395,13 @@ void tst_QLocale::formatTimeZone() QLocale enUS("en_US"); QDateTime dt1(QDate(2013, 1, 1), QTime(1, 0, 0), Qt::OffsetFromUTC, 60 * 60); - QCOMPARE(enUS.toString(dt1, "t"), QString("UTC+01:00")); + QCOMPARE(enUS.toString(dt1, "t"), QLatin1String("UTC+01:00")); QDateTime dt2(QDate(2013, 1, 1), QTime(1, 0, 0), Qt::OffsetFromUTC, -60 * 60); - QCOMPARE(enUS.toString(dt2, "t"), QString("UTC-01:00")); + QCOMPARE(enUS.toString(dt2, "t"), QLatin1String("UTC-01:00")); QDateTime dt3(QDate(2013, 1, 1), QTime(0, 0, 0), Qt::UTC); - QCOMPARE(enUS.toString(dt3, "t"), QString("UTC")); + QCOMPARE(enUS.toString(dt3, "t"), QLatin1String("UTC")); // LocalTime should vary if (europeanTimeZone) { @@ -1294,14 +1410,14 @@ void tst_QLocale::formatTimeZone() #ifdef Q_OS_WIN QEXPECT_FAIL("", "Windows only returns long name (QTBUG-32759)", Continue); #endif // Q_OS_WIN - QCOMPARE(enUS.toString(dt4, "t"), QString("CET")); + QCOMPARE(enUS.toString(dt4, "t"), QLatin1String("CET")); // Time definitely in Daylight Time QDateTime dt5(QDate(2013, 6, 1), QTime(0, 0, 0), Qt::LocalTime); #ifdef Q_OS_WIN QEXPECT_FAIL("", "Windows only returns long name (QTBUG-32759)", Continue); #endif // Q_OS_WIN - QCOMPARE(enUS.toString(dt5, "t"), QString("CEST")); + QCOMPARE(enUS.toString(dt5, "t"), QLatin1String("CEST")); } else { QSKIP("You must test using Central European (CET/CEST) time zone, e.g. TZ=Europe/Oslo"); } @@ -1310,13 +1426,13 @@ void tst_QLocale::formatTimeZone() #ifdef Q_OS_WIN QEXPECT_FAIL("", "QTimeZone windows backend only returns long name", Continue); #endif - QCOMPARE(enUS.toString(dt6, "t"), QString("CET")); + QCOMPARE(enUS.toString(dt6, "t"), QLatin1String("CET")); QDateTime dt7(QDate(2013, 6, 1), QTime(0, 0, 0), QTimeZone("Europe/Berlin")); #ifdef Q_OS_WIN QEXPECT_FAIL("", "QTimeZone windows backend only returns long name", Continue); #endif - QCOMPARE(enUS.toString(dt7, "t"), QString("CEST")); + QCOMPARE(enUS.toString(dt7, "t"), QLatin1String("CEST")); // Current datetime should return current abbreviation QCOMPARE(enUS.toString(QDateTime::currentDateTime(), "t"), @@ -1462,9 +1578,9 @@ void tst_QLocale::macDefaultLocale() if (timeString.contains(QString("GMT"))) { QString expectedGMTSpecifierBase("GMT"); if (diff >= 0) - expectedGMTSpecifierBase.append("+"); + expectedGMTSpecifierBase.append(QLatin1Char('+')); else - expectedGMTSpecifierBase.append("-"); + expectedGMTSpecifierBase.append(QLatin1Char('-')); QString expectedGMTSpecifier = expectedGMTSpecifierBase + QString("%1").arg(qAbs(diff)); QString expectedGMTSpecifierZeroExtended = expectedGMTSpecifierBase + QString("0%1").arg(qAbs(diff)); @@ -1640,6 +1756,20 @@ void tst_QLocale::numberOptions() QLocale locale2 = locale; QCOMPARE(locale2.numberOptions(), QLocale::RejectGroupSeparator); + + QCOMPARE(locale.toString(12.4, 'e', 2), QString("1.24e+01")); + locale.setNumberOptions(QLocale::OmitLeadingZeroInExponent); + QCOMPARE(locale.numberOptions(), QLocale::OmitLeadingZeroInExponent); + QCOMPARE(locale.toString(12.4, 'e', 2), QString("1.24e+1")); + + locale.toDouble(QString("1.24e+01"), &ok); + QVERIFY(ok); + locale.setNumberOptions(QLocale::RejectLeadingZeroInExponent); + QCOMPARE(locale.numberOptions(), QLocale::RejectLeadingZeroInExponent); + locale.toDouble(QString("1.24e+1"), &ok); + QVERIFY(ok); + locale.toDouble(QString("1.24e+01"), &ok); + QVERIFY(!ok); } void tst_QLocale::negativeNumbers() @@ -1699,9 +1829,11 @@ void tst_QLocale::testNames_data() for (int i = 0; i < locale_data_count; ++i) { const QLocaleData &item = locale_data[i]; - const QString testName = QString::fromLatin1("data_%1 (%2/%3)").arg(i) - .arg(QLocale::languageToString((QLocale::Language)item.m_language_id)) - .arg(QLocale::countryToString((QLocale::Country)item.m_country_id)); + + const QString testName = QLatin1String("data_") + QString::number(i) + QLatin1String(" (") + + QLocale::languageToString((QLocale::Language)item.m_language_id) + + QLatin1Char('/') + QLocale::countryToString((QLocale::Country)item.m_country_id) + + QLatin1Char(')'); QTest::newRow(testName.toLatin1().constData()) << (int)item.m_language_id << (int)item.m_country_id; } } @@ -1829,13 +1961,27 @@ void tst_QLocale::underflowOverflow() a(QLatin1String("0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e10")); bool ok = false; - a.toDouble(&ok); + double d = a.toDouble(&ok); QVERIFY(!ok); + QCOMPARE(d, 0.0); a = QLatin1String("1e600"); ok = false; - a.toDouble(&ok); + d = a.toDouble(&ok); + QVERIFY(!ok); // detectable overflow + QVERIFY(qIsInf(d)); + + a = QLatin1String("-1e600"); + ok = false; + d = a.toDouble(&ok); + QVERIFY(!ok); // detectable underflow + QVERIFY(qIsInf(-d)); + + a = QLatin1String("1e-600"); + ok = false; + d = a.toDouble(&ok); QVERIFY(!ok); + QCOMPARE(d, 0.0); a = QLatin1String("-9223372036854775809"); a.toLongLong(&ok); @@ -2039,12 +2185,18 @@ void tst_QLocale::currency() QCOMPARE(c.toCurrencyString(qlonglong(-1234)), QString("-1234")); QCOMPARE(c.toCurrencyString(double(1234.56)), QString("1234.56")); QCOMPARE(c.toCurrencyString(double(-1234.56)), QString("-1234.56")); + QCOMPARE(c.toCurrencyString(double(-1234.5678)), QString("-1234.57")); + QCOMPARE(c.toCurrencyString(double(-1234.5678), NULL, 4), QString("-1234.5678")); + QCOMPARE(c.toCurrencyString(double(-1234.56), NULL, 4), QString("-1234.5600")); const QLocale en_US("en_US"); QCOMPARE(en_US.toCurrencyString(qulonglong(1234)), QString("$1,234")); QCOMPARE(en_US.toCurrencyString(qlonglong(-1234)), QString("$-1,234")); QCOMPARE(en_US.toCurrencyString(double(1234.56)), QString("$1,234.56")); QCOMPARE(en_US.toCurrencyString(double(-1234.56)), QString("$-1,234.56")); + QCOMPARE(en_US.toCurrencyString(double(-1234.5678)), QString("$-1,234.57")); + QCOMPARE(en_US.toCurrencyString(double(-1234.5678), NULL, 4), QString("$-1,234.5678")); + QCOMPARE(en_US.toCurrencyString(double(-1234.56), NULL, 4), QString("$-1,234.5600")); const QLocale ru_RU("ru_RU"); QCOMPARE(ru_RU.toCurrencyString(qulonglong(1234)), QString::fromUtf8("1" "\xc2\xa0" "234\xc2\xa0\xd1\x80\xd1\x83\xd0\xb1.")); diff --git a/tests/auto/corelib/tools/qmap/qmap.pro b/tests/auto/corelib/tools/qmap/qmap.pro index 460b6654fb..27820a76c8 100644 --- a/tests/auto/corelib/tools/qmap/qmap.pro +++ b/tests/auto/corelib/tools/qmap/qmap.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qmap QT = core testlib SOURCES = $$PWD/tst_qmap.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp index bb6535b635..0898c10ea6 100644 --- a/tests/auto/corelib/tools/qmap/tst_qmap.cpp +++ b/tests/auto/corelib/tools/qmap/tst_qmap.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$ ** @@ -413,24 +408,24 @@ void tst_QMap::key() QCOMPARE(map1.key(1, def), def); map1.insert("one", 1); - QCOMPARE(map1.key(1), QString("one")); - QCOMPARE(map1.key(1, def), QString("one")); + QCOMPARE(map1.key(1), QLatin1String("one")); + QCOMPARE(map1.key(1, def), QLatin1String("one")); QCOMPARE(map1.key(2), QString()); QCOMPARE(map1.key(2, def), def); map1.insert("two", 2); - QCOMPARE(map1.key(1), QString("one")); - QCOMPARE(map1.key(1, def), QString("one")); - QCOMPARE(map1.key(2), QString("two")); - QCOMPARE(map1.key(2, def), QString("two")); + QCOMPARE(map1.key(1), QLatin1String("one")); + QCOMPARE(map1.key(1, def), QLatin1String("one")); + QCOMPARE(map1.key(2), QLatin1String("two")); + QCOMPARE(map1.key(2, def), QLatin1String("two")); QCOMPARE(map1.key(3), QString()); QCOMPARE(map1.key(3, def), def); map1.insert("deux", 2); - QCOMPARE(map1.key(1), QString("one")); - QCOMPARE(map1.key(1, def), QString("one")); - QVERIFY(map1.key(2) == "deux" || map1.key(2) == "two"); - QVERIFY(map1.key(2, def) == "deux" || map1.key(2, def) == "two"); + QCOMPARE(map1.key(1), QLatin1String("one")); + QCOMPARE(map1.key(1, def), QLatin1String("one")); + QVERIFY(map1.key(2) == QLatin1String("deux") || map1.key(2) == QLatin1String("two")); + QVERIFY(map1.key(2, def) == QLatin1String("deux") || map1.key(2, def) == QLatin1String("two")); QCOMPARE(map1.key(3), QString()); QCOMPARE(map1.key(3, def), def); } @@ -608,8 +603,8 @@ void tst_QMap::find() map1.insert(1,"Mayer"); map1.insert(2,"Hej"); - QVERIFY(map1.find(1).value() == "Mayer"); - QVERIFY(map1.find(2).value() == "Hej"); + QCOMPARE(map1.find(1).value(), QLatin1String("Mayer")); + QCOMPARE(map1.find(2).value(), QLatin1String("Hej")); for(i = 3; i < 10; ++i) { compareString = testString.arg(i); @@ -643,8 +638,8 @@ void tst_QMap::constFind() QVERIFY(map1.constFind(4) == map1.constEnd()); - QVERIFY(map1.constFind(1).value() == "Mayer"); - QVERIFY(map1.constFind(2).value() == "Hej"); + QCOMPARE(map1.constFind(1).value(), QLatin1String("Mayer")); + QCOMPARE(map1.constFind(2).value(), QLatin1String("Hej")); for(i = 3; i < 10; ++i) { compareString = testString.arg(i); @@ -705,10 +700,10 @@ void tst_QMap::lowerUpperBound() QCOMPARE(map1.lowerBound(5).key(), 5); QCOMPARE(map1.lowerBound(6).key(), 7); QCOMPARE(map1.lowerBound(7).key(), 7); - QCOMPARE(map1.lowerBound(6).value(), QString("seven_2")); - QCOMPARE(map1.lowerBound(7).value(), QString("seven_2")); - QCOMPARE((++map1.lowerBound(6)).value(), QString("seven")); - QCOMPARE((++map1.lowerBound(7)).value(), QString("seven")); + QCOMPARE(map1.lowerBound(6).value(), QLatin1String("seven_2")); + QCOMPARE(map1.lowerBound(7).value(), QLatin1String("seven_2")); + QCOMPARE((++map1.lowerBound(6)).value(), QLatin1String("seven")); + QCOMPARE((++map1.lowerBound(7)).value(), QLatin1String("seven")); QCOMPARE(map1.lowerBound(10).key(), 10); QVERIFY(map1.lowerBound(999) == map1.end()); } @@ -733,11 +728,11 @@ void tst_QMap::mergeCompare() map1b.unite(map2b); sanityCheckTree(map1b, __LINE__); - QVERIFY(map1.value(1) == "ett"); - QVERIFY(map1.value(2) == "tvo"); - QVERIFY(map1.value(3) == "tre"); - QVERIFY(map1.value(4) == "fyra"); - QVERIFY(map1.value(5) == "fem"); + QCOMPARE(map1.value(1), QLatin1String("ett")); + QCOMPARE(map1.value(2), QLatin1String("tvo")); + QCOMPARE(map1.value(3), QLatin1String("tre")); + QCOMPARE(map1.value(4), QLatin1String("fyra")); + QCOMPARE(map1.value(5), QLatin1String("fem")); map3.insert(1, "ett"); map3.insert(2, "tvo"); @@ -755,7 +750,7 @@ void tst_QMap::take() map.insert(2, "zwei"); map.insert(3, "drei"); - QVERIFY(map.take(3) == "drei"); + QCOMPARE(map.take(3), QLatin1String("drei")); QVERIFY(!map.contains(3)); } @@ -771,19 +766,19 @@ void tst_QMap::iterators() //STL-Style iterators QMap<int, QString>::iterator stlIt = map.begin(); - QVERIFY(stlIt.value() == "Teststring 1"); + QCOMPARE(stlIt.value(), QLatin1String("Teststring 1")); stlIt+=5; - QVERIFY(stlIt.value() == "Teststring 6"); + QCOMPARE(stlIt.value(), QLatin1String("Teststring 6")); stlIt++; - QVERIFY(stlIt.value() == "Teststring 7"); + QCOMPARE(stlIt.value(), QLatin1String("Teststring 7")); stlIt-=3; - QVERIFY(stlIt.value() == "Teststring 4"); + QCOMPARE(stlIt.value(), QLatin1String("Teststring 4")); stlIt--; - QVERIFY(stlIt.value() == "Teststring 3"); + QCOMPARE(stlIt.value(), QLatin1String("Teststring 3")); for(stlIt = map.begin(), i = 1; stlIt != map.end(); ++stlIt, ++i) QVERIFY(stlIt.value() == testString.arg(i)); @@ -792,19 +787,19 @@ void tst_QMap::iterators() //STL-Style const-iterators QMap<int, QString>::const_iterator cstlIt = map.constBegin(); - QVERIFY(cstlIt.value() == "Teststring 1"); + QCOMPARE(cstlIt.value(), QLatin1String("Teststring 1")); cstlIt+=5; - QVERIFY(cstlIt.value() == "Teststring 6"); + QCOMPARE(cstlIt.value(), QLatin1String("Teststring 6")); cstlIt++; - QVERIFY(cstlIt.value() == "Teststring 7"); + QCOMPARE(cstlIt.value(), QLatin1String("Teststring 7")); cstlIt-=3; - QVERIFY(cstlIt.value() == "Teststring 4"); + QCOMPARE(cstlIt.value(), QLatin1String("Teststring 4")); cstlIt--; - QVERIFY(cstlIt.value() == "Teststring 3"); + QCOMPARE(cstlIt.value(), QLatin1String("Teststring 3")); for(cstlIt = map.constBegin(), i = 1; cstlIt != map.constEnd(); ++cstlIt, ++i) QVERIFY(cstlIt.value() == testString.arg(i)); @@ -1062,7 +1057,7 @@ void tst_QMap::equal_range() QCOMPARE(cresult.second, cmap.cend()); for (int i = -10; i < 10; i += 2) - map.insert(i, QString("%1").arg(i)); + map.insert(i, QString::number(i)); result = map.equal_range(0); QCOMPARE(result.first, map.find(0)); diff --git a/tests/auto/corelib/tools/qmargins/qmargins.pro b/tests/auto/corelib/tools/qmargins/qmargins.pro index 25fe715edf..696f9374a2 100644 --- a/tests/auto/corelib/tools/qmargins/qmargins.pro +++ b/tests/auto/corelib/tools/qmargins/qmargins.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qmargins QT = core testlib SOURCES = tst_qmargins.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp b/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp index 1233382f5c..2a35162ef0 100644 --- a/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp +++ b/tests/auto/corelib/tools/qmargins/tst_qmargins.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/tools/qmessageauthenticationcode/qmessageauthenticationcode.pro b/tests/auto/corelib/tools/qmessageauthenticationcode/qmessageauthenticationcode.pro index afd0c1176d..a62b702f22 100644 --- a/tests/auto/corelib/tools/qmessageauthenticationcode/qmessageauthenticationcode.pro +++ b/tests/auto/corelib/tools/qmessageauthenticationcode/qmessageauthenticationcode.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qmessageauthenticationcode QT = core testlib SOURCES = tst_qmessageauthenticationcode.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qmessageauthenticationcode/tst_qmessageauthenticationcode.cpp b/tests/auto/corelib/tools/qmessageauthenticationcode/tst_qmessageauthenticationcode.cpp index 32a0d80282..2f8052fd4a 100644 --- a/tests/auto/corelib/tools/qmessageauthenticationcode/tst_qmessageauthenticationcode.cpp +++ b/tests/auto/corelib/tools/qmessageauthenticationcode/tst_qmessageauthenticationcode.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2013 Ruslan Nigmatullin <euroelessar@yandex.ru> -** 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/tools/qpair/qpair.pro b/tests/auto/corelib/tools/qpair/qpair.pro index c49215cb1c..659be887d3 100644 --- a/tests/auto/corelib/tools/qpair/qpair.pro +++ b/tests/auto/corelib/tools/qpair/qpair.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qpair QT = core testlib SOURCES = tst_qpair.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qpair/tst_qpair.cpp b/tests/auto/corelib/tools/qpair/tst_qpair.cpp index 076efc5428..fb0986d05b 100644 --- a/tests/auto/corelib/tools/qpair/tst_qpair.cpp +++ b/tests/auto/corelib/tools/qpair/tst_qpair.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.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$ ** @@ -41,6 +36,8 @@ class tst_QPair : public QObject Q_OBJECT private Q_SLOTS: void testConstexpr(); + void testConversions(); + void taskQTBUG_48780_pairContainingCArray(); }; class C { char _[4]; }; @@ -108,5 +105,72 @@ void tst_QPair::testConstexpr() Q_UNUSED(pSI); } +void tst_QPair::testConversions() +{ + // construction from lvalue: + { + const QPair<int, double> rhs(42, 4.5); + const QPair<int, int> pii = rhs; + QCOMPARE(pii.first, 42); + QCOMPARE(pii.second, 4); + + const QPair<int, float> pif = rhs; + QCOMPARE(pif.first, 42); + QCOMPARE(pif.second, 4.5f); + } + + // assignment from lvalue: + { + const QPair<int, double> rhs(42, 4.5); + QPair<int, int> pii; + pii = rhs; + QCOMPARE(pii.first, 42); + QCOMPARE(pii.second, 4); + + QPair<int, float> pif; + pif = rhs; + QCOMPARE(pif.first, 42); + QCOMPARE(pif.second, 4.5f); + } + + // construction from rvalue: + { +#define rhs qMakePair(42, 4.5) + const QPair<int, int> pii = rhs; + QCOMPARE(pii.first, 42); + QCOMPARE(pii.second, 4); + + const QPair<int, float> pif = rhs; + QCOMPARE(pif.first, 42); + QCOMPARE(pif.second, 4.5f); +#undef rhs + } + + // assignment from rvalue: + { +#define rhs qMakePair(42, 4.5) + QPair<int, int> pii; + pii = rhs; + QCOMPARE(pii.first, 42); + QCOMPARE(pii.second, 4); + + QPair<int, float> pif; + pif = rhs; + QCOMPARE(pif.first, 42); + QCOMPARE(pif.second, 4.5f); +#undef rhs + } +} + +void tst_QPair::taskQTBUG_48780_pairContainingCArray() +{ + // compile-only: + QPair<int[2], int> pair; + pair.first[0] = 0; + pair.first[1] = 1; + pair.second = 2; + Q_UNUSED(pair); +} + QTEST_APPLESS_MAIN(tst_QPair) #include "tst_qpair.moc" diff --git a/tests/auto/corelib/tools/qpoint/qpoint.pro b/tests/auto/corelib/tools/qpoint/qpoint.pro index 0923abbc88..8321d08fe0 100644 --- a/tests/auto/corelib/tools/qpoint/qpoint.pro +++ b/tests/auto/corelib/tools/qpoint/qpoint.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qpoint QT = core testlib SOURCES = tst_qpoint.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qpoint/tst_qpoint.cpp b/tests/auto/corelib/tools/qpoint/tst_qpoint.cpp index 904ceb7d35..8e184f3ef3 100644 --- a/tests/auto/corelib/tools/qpoint/tst_qpoint.cpp +++ b/tests/auto/corelib/tools/qpoint/tst_qpoint.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/tools/qpointf/qpointf.pro b/tests/auto/corelib/tools/qpointf/qpointf.pro index 1c594cd47c..5715b95d96 100644 --- a/tests/auto/corelib/tools/qpointf/qpointf.pro +++ b/tests/auto/corelib/tools/qpointf/qpointf.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qpointf QT = core testlib SOURCES = tst_qpointf.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp b/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp index ff58c9b181..17a43af58c 100644 --- a/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp +++ b/tests/auto/corelib/tools/qpointf/tst_qpointf.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/tools/qqueue/qqueue.pro b/tests/auto/corelib/tools/qqueue/qqueue.pro index 7b1e28baf3..55ceb65fbd 100644 --- a/tests/auto/corelib/tools/qqueue/qqueue.pro +++ b/tests/auto/corelib/tools/qqueue/qqueue.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qqueue QT = core testlib SOURCES = tst_qqueue.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qqueue/tst_qqueue.cpp b/tests/auto/corelib/tools/qqueue/tst_qqueue.cpp index a67c46dad7..6c391bd764 100644 --- a/tests/auto/corelib/tools/qqueue/tst_qqueue.cpp +++ b/tests/auto/corelib/tools/qqueue/tst_qqueue.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/tools/qrect/qrect.pro b/tests/auto/corelib/tools/qrect/qrect.pro index 06fe15b0d6..8ec31db215 100644 --- a/tests/auto/corelib/tools/qrect/qrect.pro +++ b/tests/auto/corelib/tools/qrect/qrect.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qrect QT = core testlib SOURCES = tst_qrect.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qrect/tst_qrect.cpp b/tests/auto/corelib/tools/qrect/tst_qrect.cpp index 585cf5d4d0..9b35cdec30 100644 --- a/tests/auto/corelib/tools/qrect/tst_qrect.cpp +++ b/tests/auto/corelib/tools/qrect/tst_qrect.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$ ** @@ -132,6 +127,9 @@ private slots: void translate_data(); void translate(); + void transposed_data(); + void transposed(); + void moveTop(); void moveBottom(); void moveLeft(); @@ -3567,6 +3565,41 @@ void tst_QRect::translate() } +void tst_QRect::transposed_data() +{ + QTest::addColumn<QRect>("r"); + + QTest::newRow("InvalidQRect") << getQRectCase(InvalidQRect); + QTest::newRow("SmallestQRect") << getQRectCase(SmallestQRect); + QTest::newRow("MiddleQRect") << getQRectCase(MiddleQRect); + QTest::newRow("LargestQRect") << getQRectCase(LargestQRect); + QTest::newRow("SmallestCoordQRect") << getQRectCase(SmallestCoordQRect); + QTest::newRow("LargestCoordQRect") << getQRectCase(LargestCoordQRect); + QTest::newRow("RandomQRect") << getQRectCase(RandomQRect); + QTest::newRow("NegativeSizeQRect") << getQRectCase(NegativeSizeQRect); + QTest::newRow("NegativePointQRect") << getQRectCase(NegativePointQRect); + QTest::newRow("NullQRect") << getQRectCase(NullQRect); + QTest::newRow("EmptyQRect") << getQRectCase(EmptyQRect); +} + +void tst_QRect::transposed() +{ + QFETCH(QRect, r); + + const QRect rt = r.transposed(); + QCOMPARE(rt.height(), r.width()); + QCOMPARE(rt.width(), r.height()); + QCOMPARE(rt.topLeft(), r.topLeft()); + + const QRectF rf = r; + + const QRectF rtf = rf.transposed(); + QCOMPARE(rtf.height(), rf.width()); + QCOMPARE(rtf.width(), rf.height()); + QCOMPARE(rtf.topLeft(), rf.topLeft()); + + QCOMPARE(rtf, QRectF(rt)); +} void tst_QRect::moveTop() { diff --git a/tests/auto/corelib/tools/qregexp/qregexp.pro b/tests/auto/corelib/tools/qregexp/qregexp.pro index d8f67eed25..5f6ff0a71c 100644 --- a/tests/auto/corelib/tools/qregexp/qregexp.pro +++ b/tests/auto/corelib/tools/qregexp/qregexp.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qregexp QT = core testlib SOURCES = tst_qregexp.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp index b9a3fc13c5..2f285f3393 100644 --- a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp +++ b/tests/auto/corelib/tools/qregexp/tst_qregexp.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$ ** @@ -880,19 +875,19 @@ void tst_QRegExp::caretAnchoredOptimization() { QString s = "---babnana----"; s.replace( QRegExp("^-*|(-*)$"), "" ); - QVERIFY(s == "babnana"); + QCOMPARE(s, QLatin1String("babnana")); s = "---babnana----"; s.replace( QRegExp("^-*|(-{0,})$"), "" ); - QVERIFY(s == "babnana"); + QCOMPARE(s, QLatin1String("babnana")); s = "---babnana----"; s.replace( QRegExp("^-*|(-{1,})$"), "" ); - QVERIFY(s == "babnana"); + QCOMPARE(s, QLatin1String("babnana")); s = "---babnana----"; s.replace( QRegExp("^-*|(-+)$"), "" ); - QVERIFY(s == "babnana"); + QCOMPARE(s, QLatin1String("babnana")); } void tst_QRegExp::isEmpty() @@ -1370,12 +1365,14 @@ void tst_QRegExp::escapeSequences() { QString perlSyntaxSpecialChars("0123456789afnrtvbBdDwWsSx\\|[]{}()^$?+*"); QString w3cXmlSchema11SyntaxSpecialChars("cCiIpP"); // as well as the perl ones + QString pattern = QLatin1String("\\?"); for (int i = ' '; i <= 127; ++i) { QLatin1Char c(i); if (perlSyntaxSpecialChars.indexOf(c) == -1) { - QRegExp rx(QString("\\%1").arg(c), Qt::CaseSensitive, QRegExp::RegExp); + pattern[1] = c; + QRegExp rx(pattern, Qt::CaseSensitive, QRegExp::RegExp); // we'll never have c == 'a' since it's a special character - QString s = QString("aaa%1aaa").arg(c); + const QString s = QLatin1String("aaa") + c + QLatin1String("aaa"); QCOMPARE(rx.indexIn(s), 3); rx.setPatternSyntax(QRegExp::RegExp2); diff --git a/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/alwaysoptimize.pro b/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/alwaysoptimize.pro index 3ecf16918c..a27286ff20 100644 --- a/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/alwaysoptimize.pro +++ b/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/alwaysoptimize.pro @@ -1,8 +1,7 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qregularexpression_alwaysoptimize QT = core testlib HEADERS = ../tst_qregularexpression.h SOURCES = \ tst_qregularexpression_alwaysoptimize.cpp \ ../tst_qregularexpression.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/tst_qregularexpression_alwaysoptimize.cpp b/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/tst_qregularexpression_alwaysoptimize.cpp index 476b9bc1f0..6d2ae48235 100644 --- a/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/tst_qregularexpression_alwaysoptimize.cpp +++ b/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/tst_qregularexpression_alwaysoptimize.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2012 Giuseppe D'Angelo <dangelog@gmail.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/tools/qregularexpression/defaultoptimize/defaultoptimize.pro b/tests/auto/corelib/tools/qregularexpression/defaultoptimize/defaultoptimize.pro index 9e366c0f48..0b36c79c1b 100644 --- a/tests/auto/corelib/tools/qregularexpression/defaultoptimize/defaultoptimize.pro +++ b/tests/auto/corelib/tools/qregularexpression/defaultoptimize/defaultoptimize.pro @@ -1,8 +1,7 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qregularexpression_defaultoptimize QT = core testlib HEADERS = ../tst_qregularexpression.h SOURCES = \ tst_qregularexpression_defaultoptimize.cpp \ ../tst_qregularexpression.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qregularexpression/defaultoptimize/tst_qregularexpression_defaultoptimize.cpp b/tests/auto/corelib/tools/qregularexpression/defaultoptimize/tst_qregularexpression_defaultoptimize.cpp index 92718e4adb..a815c6cab9 100644 --- a/tests/auto/corelib/tools/qregularexpression/defaultoptimize/tst_qregularexpression_defaultoptimize.cpp +++ b/tests/auto/corelib/tools/qregularexpression/defaultoptimize/tst_qregularexpression_defaultoptimize.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2012 Giuseppe D'Angelo <dangelog@gmail.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/tools/qregularexpression/forceoptimize/forceoptimize.pro b/tests/auto/corelib/tools/qregularexpression/forceoptimize/forceoptimize.pro index d34bc9b93d..1db77781dd 100644 --- a/tests/auto/corelib/tools/qregularexpression/forceoptimize/forceoptimize.pro +++ b/tests/auto/corelib/tools/qregularexpression/forceoptimize/forceoptimize.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qregularexpression_forceoptimize QT = core testlib HEADERS = ../tst_qregularexpression.h diff --git a/tests/auto/corelib/tools/qregularexpression/forceoptimize/tst_qregularexpression_forceoptimize.cpp b/tests/auto/corelib/tools/qregularexpression/forceoptimize/tst_qregularexpression_forceoptimize.cpp index edc94e9736..38a3a64fa3 100644 --- a/tests/auto/corelib/tools/qregularexpression/forceoptimize/tst_qregularexpression_forceoptimize.cpp +++ b/tests/auto/corelib/tools/qregularexpression/forceoptimize/tst_qregularexpression_forceoptimize.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.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/tools/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp index 8ddd4979b6..5825bdb6d6 100644 --- a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp +++ b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp @@ -2,31 +2,26 @@ ** ** Copyright (C) 2015 Giuseppe D'Angelo <dangelog@gmail.com>. ** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.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$ ** @@ -656,7 +651,7 @@ void tst_QRegularExpression::normalMatch_data() m.captured << "c123def" << "c12" << "3" << "def"; offset = 2; for (int i = 0; i <= offset; ++i) { - QTest::newRow(QStringLiteral("match06-offset%1").arg(i).toUtf8().constData()) + QTest::newRow(("match06-offset" + QByteArray::number(i)).constData()) << QRegularExpression("(\\w*)(\\d+)(\\w*)") << QStringLiteral("abc123def").mid(offset - i) << i @@ -669,7 +664,7 @@ void tst_QRegularExpression::normalMatch_data() m.captured << QString(""); offset = 9; for (int i = 0; i <= offset; ++i) { - QTest::newRow(QStringLiteral("match07-offset%1").arg(i).toUtf8().constData()) + QTest::newRow(("match07-offset" + QByteArray::number(i)).constData()) << QRegularExpression("\\w*") << QStringLiteral("abc123def").mid(offset - i) << i @@ -747,7 +742,7 @@ void tst_QRegularExpression::normalMatch_data() m.isValid = true; offset = 1; for (int i = 0; i <= offset; ++i) { - QTest::newRow(QStringLiteral("nomatch02-offset%1").arg(i).toUtf8().constData()) + QTest::newRow(("nomatch02-offset" + QByteArray::number(i)).constData()) << QRegularExpression("(\\w+) (\\w+)") << QStringLiteral("a string").mid(offset - i) << i @@ -759,7 +754,7 @@ void tst_QRegularExpression::normalMatch_data() m.isValid = true; offset = 9; for (int i = 0; i <= offset; ++i) { - QTest::newRow(QStringLiteral("nomatch03-offset%1").arg(i).toUtf8().constData()) + QTest::newRow(("nomatch03-offset" + QByteArray::number(i)).constData()) << QRegularExpression("\\w+") << QStringLiteral("abc123def").mid(offset - i) << i @@ -930,7 +925,7 @@ void tst_QRegularExpression::partialMatch_data() m.captured << "def"; offset = 1; for (int i = 0; i <= offset; ++i) { - QTest::newRow(QStringLiteral("softmatch08-offset%1").arg(i).toUtf8().constData()) + QTest::newRow(("softmatch08-offset" + QByteArray::number(i)).constData()) << QRegularExpression("abc\\w+X|defY") << QStringLiteral("abcdef").mid(offset - i) << i @@ -1016,7 +1011,7 @@ void tst_QRegularExpression::partialMatch_data() m.captured << "def"; offset = 1; for (int i = 0; i <= offset; ++i) { - QTest::newRow(QStringLiteral("hardmatch08-offset%1").arg(i).toUtf8().constData()) + QTest::newRow(("hardmatch08-offset" + QByteArray::number(i)).constData()) << QRegularExpression("abc\\w+X|defY") << QStringLiteral("abcdef").mid(offset - i) << i diff --git a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.h b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.h index aed262d15d..8bb4aa0cce 100644 --- a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.h +++ b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.h @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2012 Giuseppe D'Angelo <dangelog@gmail.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/tools/qringbuffer/qringbuffer.pro b/tests/auto/corelib/tools/qringbuffer/qringbuffer.pro index 0618b03309..c63544035a 100644 --- a/tests/auto/corelib/tools/qringbuffer/qringbuffer.pro +++ b/tests/auto/corelib/tools/qringbuffer/qringbuffer.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qringbuffer QT = core-private testlib SOURCES = tst_qringbuffer.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp index 77fc6ad6ae..7bd732379d 100644 --- a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp +++ b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.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$ ** @@ -34,16 +29,18 @@ #include <QtTest/QtTest> #include <private/qringbuffer_p.h> +#include <qvector.h> class tst_QRingBuffer : public QObject { Q_OBJECT private slots: + void constructing(); + void usingInVector(); void readPointerAtPositionWriteRead(); void readPointerAtPositionEmptyRead(); void readPointerAtPositionWithHead(); void readPointerAtPositionReadTooMuch(); - void sizeWhenEmpty(); void sizeWhenReservedAndChopped(); void sizeWhenReserved(); void free(); @@ -57,6 +54,33 @@ private slots: void readLine(); }; +void tst_QRingBuffer::constructing() +{ + QRingBuffer ringBuffer; + + QCOMPARE(ringBuffer.size(), Q_INT64_C(0)); + QVERIFY(ringBuffer.isEmpty()); + QCOMPARE(ringBuffer.nextDataBlockSize(), Q_INT64_C(0)); + QVERIFY(ringBuffer.readPointer() == Q_NULLPTR); + QCOMPARE(ringBuffer.skip(5), Q_INT64_C(0)); + QCOMPARE(ringBuffer.read(), QByteArray()); + QCOMPARE(ringBuffer.getChar(), -1); + QVERIFY(!ringBuffer.canReadLine()); + + char buf[5]; + QCOMPARE(ringBuffer.peek(buf, sizeof(buf)), Q_INT64_C(0)); +} + +void tst_QRingBuffer::usingInVector() +{ + QRingBuffer ringBuffer; + QVector<QRingBuffer> buffers; + + ringBuffer.reserve(5); + buffers.append(ringBuffer); + QCOMPARE(buffers[0].size(), Q_INT64_C(5)); +} + void tst_QRingBuffer::sizeWhenReserved() { QRingBuffer ringBuffer; @@ -74,13 +98,6 @@ void tst_QRingBuffer::sizeWhenReservedAndChopped() QCOMPARE(ringBuffer.size(), Q_INT64_C(0)); } -void tst_QRingBuffer::sizeWhenEmpty() -{ - QRingBuffer ringBuffer; - - QCOMPARE(ringBuffer.size(), Q_INT64_C(0)); -} - void tst_QRingBuffer::readPointerAtPositionReadTooMuch() { QRingBuffer ringBuffer; @@ -140,7 +157,7 @@ void tst_QRingBuffer::readPointerAtPositionWriteRead() inData.putChar(0x23); inData.write("Qt rocks!"); for (int i = 0; i < 5000; i++) - inData.write(QString("Number %1").arg(i).toUtf8()); + inData.write("Number " + QByteArray::number(i)); inData.reset(); QVERIFY(inData.size() > 0); @@ -284,7 +301,8 @@ void tst_QRingBuffer::indexOf() for (int i = 1; i < 256; ++i) { qint64 index = ringBuffer.indexOf(char(i)); QCOMPARE(index, qint64(i - 1)); - QCOMPARE(ringBuffer.indexOf(char(i), i), index); + QCOMPARE(ringBuffer.indexOf(char(i), i, i >> 1), index); + QCOMPARE(ringBuffer.indexOf(char(i), 256, i), Q_INT64_C(-1)); QCOMPARE(ringBuffer.indexOf(char(i), i - 1), -1); // test for absent char } } diff --git a/tests/auto/corelib/tools/qscopedpointer/qscopedpointer.pro b/tests/auto/corelib/tools/qscopedpointer/qscopedpointer.pro index 5fa529e175..5248ad5528 100644 --- a/tests/auto/corelib/tools/qscopedpointer/qscopedpointer.pro +++ b/tests/auto/corelib/tools/qscopedpointer/qscopedpointer.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qscopedpointer QT = core testlib SOURCES = tst_qscopedpointer.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp b/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp index 0a9683cee5..7fde84af5d 100644 --- a/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp +++ b/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.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/tools/qscopedvaluerollback/qscopedvaluerollback.pro b/tests/auto/corelib/tools/qscopedvaluerollback/qscopedvaluerollback.pro index f823e6284b..c9c0a029d3 100644 --- a/tests/auto/corelib/tools/qscopedvaluerollback/qscopedvaluerollback.pro +++ b/tests/auto/corelib/tools/qscopedvaluerollback/qscopedvaluerollback.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qscopedvaluerollback QT = core testlib SOURCES = tst_qscopedvaluerollback.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp b/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp index 5e6f5df879..656dd6a6e3 100644 --- a/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp +++ b/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.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/tools/qset/qset.pro b/tests/auto/corelib/tools/qset/qset.pro index 8b5cdbc3f0..10ae3307d1 100644 --- a/tests/auto/corelib/tools/qset/qset.pro +++ b/tests/auto/corelib/tools/qset/qset.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qset QT = core testlib SOURCES = tst_qset.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qset/tst_qset.cpp b/tests/auto/corelib/tools/qset/tst_qset.cpp index fe4d81085c..0b60350380 100644 --- a/tests/auto/corelib/tools/qset/tst_qset.cpp +++ b/tests/auto/corelib/tools/qset/tst_qset.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$ ** @@ -753,7 +748,7 @@ void tst_QSet::stlMutableIterator() QSet<QString>::const_iterator k = set2.insert("foo"); i = reinterpret_cast<QSet<QString>::iterator &>(k); // #endif - QVERIFY(*i == "foo"); + QCOMPARE(*i, QLatin1String("foo")); } } diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp index 2128eeb164..0cccdb8262 100644 --- a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.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/tools/qsharedpointer/externaltests.h b/tests/auto/corelib/tools/qsharedpointer/externaltests.h index 8577d00321..bae6adaefe 100644 --- a/tests/auto/corelib/tools/qsharedpointer/externaltests.h +++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.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/tools/qsharedpointer/forwarddeclared.cpp b/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.cpp index 17af446a99..df343b5ebc 100644 --- a/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.cpp @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2012 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$ ** diff --git a/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.h b/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.h index e27f29375a..c72324841c 100644 --- a/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.h +++ b/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.h @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2012 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$ ** diff --git a/tests/auto/corelib/tools/qsharedpointer/nontracked.cpp b/tests/auto/corelib/tools/qsharedpointer/nontracked.cpp index a955c04bb9..e0780f8a9a 100644 --- a/tests/auto/corelib/tools/qsharedpointer/nontracked.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/nontracked.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2013 Intel Corporation. -** Contact: http://www.qt.io/licensing/ +** 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$ ** diff --git a/tests/auto/corelib/tools/qsharedpointer/nontracked.h b/tests/auto/corelib/tools/qsharedpointer/nontracked.h index 5dc8d338c0..76af80d2d7 100644 --- a/tests/auto/corelib/tools/qsharedpointer/nontracked.h +++ b/tests/auto/corelib/tools/qsharedpointer/nontracked.h @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2013 Intel Corporation. -** Contact: http://www.qt.io/licensing/ +** 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$ ** diff --git a/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro b/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro index 2e8e335472..240137d563 100644 --- a/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro +++ b/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsharedpointer QT = core testlib diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index ab5bc410f6..b5912badf2 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2012 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,6 +58,7 @@ private slots: void basics(); void operators(); void swap(); + void moveSemantics(); void useOfForwardDeclared(); void memoryManagement(); void dropLastReferenceOfForwardDeclared(); @@ -421,6 +417,66 @@ void tst_QSharedPointer::swap() QVERIFY(w2.isNull()); } +void tst_QSharedPointer::moveSemantics() +{ +#ifdef Q_COMPILER_RVALUE_REFS + QSharedPointer<int> p1, p2(new int(42)), control = p2; + QVERIFY(p1 != control); + QVERIFY(p1.isNull()); + QVERIFY(p2 == control); + QVERIFY(!p2.isNull()); + QVERIFY(*p2 == 42); + + // move assignment + p1 = std::move(p2); + QVERIFY(p1 == control); + QVERIFY(!p1.isNull()); + QVERIFY(p2 != control); + QVERIFY(p2.isNull()); + QVERIFY(*p1 == 42); + + // move construction + QSharedPointer<int> p3 = std::move(p1); + QVERIFY(p1 != control); + QVERIFY(p1.isNull()); + QVERIFY(p3 == control); + QVERIFY(!p3.isNull()); + QVERIFY(*p3 == 42); + + QWeakPointer<int> w1, w2 = control; + + QVERIFY(w1.isNull()); + QVERIFY(!w2.isNull()); + QVERIFY(w2.lock() == control); + QVERIFY(!w1.lock()); + + // move assignment + w1 = std::move(w2); + QVERIFY(w2.isNull()); + QVERIFY(!w1.isNull()); + QVERIFY(w1.lock() == control); + QVERIFY(!w2.lock()); + + // move construction + QWeakPointer<int> w3 = std::move(w1); + QVERIFY(w1.isNull()); + QVERIFY(!w3.isNull()); + QVERIFY(w3.lock() == control); + QVERIFY(!w1.lock()); + + p1.reset(); + p2.reset(); + p3.reset(); + control.reset(); + + QVERIFY(w1.isNull()); + QVERIFY(w2.isNull()); + QVERIFY(w3.isNull()); +#else + QSKIP("This test requires C++11 rvalue/move semantics support in the compiler."); +#endif +} + void tst_QSharedPointer::useOfForwardDeclared() { // this just a compile test: use the forward-declared class diff --git a/tests/auto/corelib/tools/qsharedpointer/wrapper.cpp b/tests/auto/corelib/tools/qsharedpointer/wrapper.cpp index f042e6500c..24a0cdc9c1 100644 --- a/tests/auto/corelib/tools/qsharedpointer/wrapper.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/wrapper.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/tools/qsharedpointer/wrapper.h b/tests/auto/corelib/tools/qsharedpointer/wrapper.h index 839de41732..18cea6e199 100644 --- a/tests/auto/corelib/tools/qsharedpointer/wrapper.h +++ b/tests/auto/corelib/tools/qsharedpointer/wrapper.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/tools/qsize/qsize.pro b/tests/auto/corelib/tools/qsize/qsize.pro index 310194ad12..9462e98e49 100644 --- a/tests/auto/corelib/tools/qsize/qsize.pro +++ b/tests/auto/corelib/tools/qsize/qsize.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qsize QT = core testlib SOURCES = tst_qsize.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qsize/tst_qsize.cpp b/tests/auto/corelib/tools/qsize/tst_qsize.cpp index cdd6d63544..385ff18ce5 100644 --- a/tests/auto/corelib/tools/qsize/tst_qsize.cpp +++ b/tests/auto/corelib/tools/qsize/tst_qsize.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/tools/qsizef/qsizef.pro b/tests/auto/corelib/tools/qsizef/qsizef.pro index c456e450fd..f5ba220b06 100644 --- a/tests/auto/corelib/tools/qsizef/qsizef.pro +++ b/tests/auto/corelib/tools/qsizef/qsizef.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qsizef QT = core testlib SOURCES = tst_qsizef.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp b/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp index c8fca61819..42801d63a9 100644 --- a/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp +++ b/tests/auto/corelib/tools/qsizef/tst_qsizef.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/tools/qstl/qstl.pro b/tests/auto/corelib/tools/qstl/qstl.pro index 88fb53c6c6..e57e62b828 100644 --- a/tests/auto/corelib/tools/qstl/qstl.pro +++ b/tests/auto/corelib/tools/qstl/qstl.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstl QT = core testlib SOURCES = tst_qstl.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstl/tst_qstl.cpp b/tests/auto/corelib/tools/qstl/tst_qstl.cpp index fa07953d8f..6114da55b4 100644 --- a/tests/auto/corelib/tools/qstl/tst_qstl.cpp +++ b/tests/auto/corelib/tools/qstl/tst_qstl.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/tools/qstring/double_data.h b/tests/auto/corelib/tools/qstring/double_data.h index 59ec3dd453..0d59ecb5ff 100644 --- a/tests/auto/corelib/tools/qstring/double_data.h +++ b/tests/auto/corelib/tools/qstring/double_data.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/tools/qstring/qstring.pro b/tests/auto/corelib/tools/qstring/qstring.pro index 1eda27e1ff..1ff9a4fc9e 100644 --- a/tests/auto/corelib/tools/qstring/qstring.pro +++ b/tests/auto/corelib/tools/qstring/qstring.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstring QT = core testlib SOURCES = tst_qstring.cpp @@ -7,6 +7,10 @@ contains(QT_CONFIG,icu):DEFINES += QT_USE_ICU contains(QT_CONFIG,c++11): CONFIG += c++11 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 +!contains(QT_CONFIG, doubleconversion):!contains(QT_CONFIG, system-doubleconversion) { + DEFINES += QT_NO_DOUBLECONVERSION +} + mac { OBJECTIVE_SOURCES += tst_qstring_mac.mm LIBS += -framework Foundation diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index a922e3ad27..0a81e3f6bb 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.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$ ** @@ -63,7 +59,7 @@ #include <algorithm> #define CREATE_REF(string) \ - const QString padded = QString::fromLatin1(" %1 ").arg(string); \ + const QString padded = QLatin1Char(' ') + string + QLatin1Char(' '); \ QStringRef ref = padded.midRef(1, padded.size() - 2); namespace { @@ -480,6 +476,7 @@ private slots: void indexOf3_data(); // void indexOf3(); void sprintf(); + void sprintfS(); void fill(); void truncate(); void constructor(); @@ -555,6 +552,7 @@ private slots: void nanAndInf(); void compare_data(); void compare(); + void resize(); void resizeAfterFromRawData(); void resizeAfterReserve(); void resizeWithNegative() const; @@ -970,61 +968,61 @@ void tst_QString::acc_01() QString f; f = e; f[7]='F'; - QCOMPARE(e,(QString)"String E"); + QCOMPARE(e, QLatin1String("String E")); char text[]="String f"; f = text; text[7]='!'; - QCOMPARE(f,(QString)"String f"); + QCOMPARE(f, QLatin1String("String f")); f[7]='F'; QCOMPARE(text[7],'!'); a=""; a[0]='A'; - QCOMPARE(a,(QString)"A"); + QCOMPARE(a, QLatin1String("A")); QCOMPARE(a.length(),1); a[1]='B'; - QCOMPARE(a,(QString)"AB"); + QCOMPARE(a, QLatin1String("AB")); QCOMPARE(a.length(),2); a[2]='C'; - QCOMPARE(a,(QString)"ABC"); + QCOMPARE(a, QLatin1String("ABC")); QCOMPARE(a.length(),3); a = QString(); QVERIFY(a.isNull()); a[0]='A'; - QCOMPARE(a,(QString)"A"); + QCOMPARE(a, QLatin1String("A")); QCOMPARE(a.length(),1); a[1]='B'; - QCOMPARE(a,(QString)"AB"); + QCOMPARE(a, QLatin1String("AB")); QCOMPARE(a.length(),2); a[2]='C'; - QCOMPARE(a,(QString)"ABC"); + QCOMPARE(a, QLatin1String("ABC")); QCOMPARE(a.length(),3); a="123"; b="456"; a[0]=a[1]; - QCOMPARE(a,(QString)"223"); + QCOMPARE(a, QLatin1String("223")); a[1]=b[1]; - QCOMPARE(b,(QString)"456"); - QCOMPARE(a,(QString)"253"); + QCOMPARE(b, QLatin1String("456")); + QCOMPARE(a, QLatin1String("253")); char t[]="TEXT"; a="A"; a=t; - QCOMPARE(a,(QString)"TEXT"); + QCOMPARE(a, QLatin1String("TEXT")); QCOMPARE(a,(QString)t); a[0]='X'; - QCOMPARE(a,(QString)"XEXT"); + QCOMPARE(a, QLatin1String("XEXT")); QCOMPARE(t[0],'T'); t[0]='Z'; - QCOMPARE(a,(QString)"XEXT"); + QCOMPARE(a, QLatin1String("XEXT")); a="ABC"; QCOMPARE(char(a.toLatin1()[1]),'B'); - QCOMPARE(strcmp(a.toLatin1(),((QString)"ABC").toLatin1()),0); - QCOMPARE(a+="DEF",(QString)"ABCDEF"); - QCOMPARE(a+='G',(QString)"ABCDEFG"); - QCOMPARE(a+=((const char*)(0)),(QString)"ABCDEFG"); + QCOMPARE(strcmp(a.toLatin1(), QByteArrayLiteral("ABC")), 0); + QCOMPARE(a+="DEF", QLatin1String("ABCDEF")); + QCOMPARE(a+='G', QLatin1String("ABCDEFG")); + QCOMPARE(a+=((const char*)(0)), QLatin1String("ABCDEFG")); // non-member operators @@ -1046,11 +1044,11 @@ void tst_QString::acc_01() QVERIFY(a<=c); QVERIFY(!(c<=a)); QVERIFY(!(d<=a)); - QCOMPARE(QString(a+b),(QString)"ABCABC"); - QCOMPARE(QString(a+"XXXX"),(QString)"ABCXXXX"); - QCOMPARE(QString(a+'X'),(QString)"ABCX"); - QCOMPARE(QString("XXXX"+a),(QString)"XXXXABC"); - QCOMPARE(QString('X'+a),(QString)"XABC"); + QCOMPARE(QString(a+b), QLatin1String("ABCABC")); + QCOMPARE(QString(a+"XXXX"), QLatin1String("ABCXXXX")); + QCOMPARE(QString(a+'X'), QLatin1String("ABCX")); + QCOMPARE(QString("XXXX"+a), QLatin1String("XXXXABC")); + QCOMPARE(QString('X'+a), QLatin1String("XABC")); a = (const char*)0; QVERIFY(a.isNull()); QVERIFY(*a.toLatin1().constData() == '\0'); @@ -1116,7 +1114,7 @@ void tst_QString::constructor() QVERIFY(a == (QString)""); QCOMPARE(b,cb); QCOMPARE(c,cc); - QCOMPARE(d,(QString)"String D"); + QCOMPARE(d, QLatin1String("String D")); QString nullStr; QVERIFY( nullStr.isNull() ); @@ -1211,11 +1209,11 @@ void tst_QString::truncate() { QString e("String E"); e.truncate(4); - QCOMPARE(e,(QString)"Stri"); + QCOMPARE(e, QLatin1String("Stri")); e = "String E"; e.truncate(0); - QCOMPARE(e,(QString)""); + QCOMPARE(e, QLatin1String("")); QVERIFY(e.isEmpty()); QVERIFY(!e.isNull()); @@ -1225,25 +1223,25 @@ void tst_QString::fill() { QString e; e.fill('e',1); - QCOMPARE(e,(QString)"e"); + QCOMPARE(e, QLatin1String("e")); QString f; f.fill('f',3); - QCOMPARE(f,(QString)"fff"); + QCOMPARE(f, QLatin1String("fff")); f.fill('F'); - QCOMPARE(f,(QString)"FFF"); + QCOMPARE(f, QLatin1String("FFF")); } void tst_QString::sprintf() { QString a; a.sprintf("COMPARE"); - QCOMPARE(a,(QString)"COMPARE"); + QCOMPARE(a, QLatin1String("COMPARE")); a.sprintf("%%%d",1); - QCOMPARE(a,(QString)"%1"); - QCOMPARE(a.sprintf("X%dY",2),(QString)"X2Y"); - QCOMPARE(a.sprintf("X%9iY", 50000 ),(QString)"X 50000Y"); - QCOMPARE(a.sprintf("X%-9sY","hello"),(QString)"Xhello Y"); - QCOMPARE(a.sprintf("X%-9iY", 50000 ),(QString)"X50000 Y"); + QCOMPARE(a, QLatin1String("%1")); + QCOMPARE(a.sprintf("X%dY",2), QLatin1String("X2Y")); + QCOMPARE(a.sprintf("X%9iY", 50000 ), QLatin1String("X 50000Y")); + QCOMPARE(a.sprintf("X%-9sY","hello"), QLatin1String("Xhello Y")); + QCOMPARE(a.sprintf("X%-9iY", 50000 ), QLatin1String("X50000 Y")); QCOMPARE(a.sprintf("%lf", 1.23), QString("1.230000")); QCOMPARE(a.sprintf("%lf", 1.23456789), QString("1.234568")); QCOMPARE(a.sprintf("%p", (void *)0xbfffd350), QString("0xbfffd350")); @@ -1259,14 +1257,18 @@ void tst_QString::sprintf() double d = -514.25683; S1.sprintf("%f",d); QCOMPARE(S1, QString("-514.256830")); +} - QCOMPARE(a.sprintf("%.3s", "Hello" ),(QString)"Hel"); - QCOMPARE(a.sprintf("%10.3s", "Hello" ),(QString)" Hel"); - QCOMPARE(a.sprintf("%.10s", "Hello" ),(QString)"Hello"); - QCOMPARE(a.sprintf("%10.10s", "Hello" ),(QString)" Hello"); - QCOMPARE(a.sprintf("%-10.10s", "Hello" ),(QString)"Hello "); - QCOMPARE(a.sprintf("%-10.3s", "Hello" ),(QString)"Hel "); - QCOMPARE(a.sprintf("%-5.5s", "Hello" ),(QString)"Hello"); +void tst_QString::sprintfS() +{ + QString a; + QCOMPARE(a.sprintf("%.3s", "Hello" ), QLatin1String("Hel")); + QCOMPARE(a.sprintf("%10.3s", "Hello" ), QLatin1String(" Hel")); + QCOMPARE(a.sprintf("%.10s", "Hello" ), QLatin1String("Hello")); + QCOMPARE(a.sprintf("%10.10s", "Hello" ), QLatin1String(" Hello")); + QCOMPARE(a.sprintf("%-10.10s", "Hello" ), QLatin1String("Hello ")); + QCOMPARE(a.sprintf("%-10.3s", "Hello" ), QLatin1String("Hel ")); + QCOMPARE(a.sprintf("%-5.5s", "Hello" ), QLatin1String("Hello")); // Check utf8 conversion for %s QCOMPARE(a.sprintf("%s", "\303\266\303\244\303\274\303\226\303\204\303\234\303\270\303\246\303\245\303\230\303\206\303\205"), QString::fromLatin1("\366\344\374\326\304\334\370\346\345\330\306\305")); @@ -1275,12 +1277,30 @@ void tst_QString::sprintf() a.sprintf("%s%n%s", "hello", &n1, "goodbye"); QCOMPARE(n1, 5); QCOMPARE(a, QString("hellogoodbye")); -#ifndef Q_CC_MINGW // does not know %ll qlonglong n2; a.sprintf("%s%s%lln%s", "foo", "bar", &n2, "whiz"); QCOMPARE((int)n2, 6); QCOMPARE(a, QString("foobarwhiz")); -#endif + + { // %ls + QCOMPARE(a.sprintf("%.3ls", qUtf16Printable("Hello")), QLatin1String("Hel")); + QCOMPARE(a.sprintf("%10.3ls", qUtf16Printable("Hello")), QLatin1String(" Hel")); + QCOMPARE(a.sprintf("%.10ls", qUtf16Printable("Hello")), QLatin1String("Hello")); + QCOMPARE(a.sprintf("%10.10ls", qUtf16Printable("Hello")), QLatin1String(" Hello")); + QCOMPARE(a.sprintf("%-10.10ls", qUtf16Printable("Hello")), QLatin1String("Hello ")); + QCOMPARE(a.sprintf("%-10.3ls", qUtf16Printable("Hello")), QLatin1String("Hel ")); + QCOMPARE(a.sprintf("%-5.5ls", qUtf16Printable("Hello")), QLatin1String("Hello")); + + // Check utf16 is preserved for %ls + QCOMPARE(a.sprintf("%ls", + qUtf16Printable("\303\266\303\244\303\274\303\226\303\204\303\234\303\270\303\246\303\245\303\230\303\206\303\205")), + QLatin1String("\366\344\374\326\304\334\370\346\345\330\306\305")); + + int n; + a.sprintf("%ls%n%s", qUtf16Printable("hello"), &n, "goodbye"); + QCOMPARE(n, 5); + QCOMPARE(a, QLatin1String("hellogoodbye")); + } } /* @@ -1369,7 +1389,7 @@ void tst_QString::indexOf_data() QString s2; s2 += QChar(0x3bc); QTest::newRow( "data58" ) << s1 << s2 << 0 << false << 3; - s2.prepend("C"); + s2.prepend(QLatin1Char('C')); QTest::newRow( "data59" ) << s1 << s2 << 0 << false << 2; QString veryBigHaystack(500, 'a'); @@ -1816,9 +1836,9 @@ void tst_QString::left() { QString a; a="ABCDEFGHIEfGEFG"; // 15 chars - QCOMPARE(a.left(3),(QString)"ABC"); + QCOMPARE(a.left(3), QLatin1String("ABC")); QVERIFY(!a.left(0).isNull()); - QCOMPARE(a.left(0),(QString)""); + QCOMPARE(a.left(0), QLatin1String("")); QString n; QVERIFY(n.left(3).isNull()); @@ -1834,10 +1854,10 @@ void tst_QString::leftRef() { QString a; a="ABCDEFGHIEfGEFG"; // 15 chars - QCOMPARE(a.leftRef(3).toString(),(QString)"ABC"); + QCOMPARE(a.leftRef(3).toString(), QLatin1String("ABC")); QVERIFY(a.leftRef(0).toString().isEmpty()); - QCOMPARE(a.leftRef(0).toString(),(QString)""); + QCOMPARE(a.leftRef(0).toString(), QLatin1String("")); QString n; QVERIFY(n.leftRef(3).toString().isEmpty()); @@ -1853,8 +1873,8 @@ void tst_QString::right() { QString a; a="ABCDEFGHIEfGEFG"; // 15 chars - QCOMPARE(a.right(3),(QString)"EFG"); - QCOMPARE(a.right(0),(QString)""); + QCOMPARE(a.right(3), QLatin1String("EFG")); + QCOMPARE(a.right(0), QLatin1String("")); QString n; QVERIFY(n.right(3).isNull()); @@ -1869,8 +1889,8 @@ void tst_QString::rightRef() { QString a; a="ABCDEFGHIEfGEFG"; // 15 chars - QCOMPARE(a.rightRef(3).toString(),(QString)"EFG"); - QCOMPARE(a.rightRef(0).toString(),(QString)""); + QCOMPARE(a.rightRef(3).toString(), QLatin1String("EFG")); + QCOMPARE(a.rightRef(0).toString(), QLatin1String("")); QString n; QVERIFY(n.rightRef(3).toString().isEmpty()); @@ -1886,8 +1906,8 @@ void tst_QString::mid() QString a; a="ABCDEFGHIEfGEFG"; // 15 chars - QCOMPARE(a.mid(3,3),(QString)"DEF"); - QCOMPARE(a.mid(0,0),(QString)""); + QCOMPARE(a.mid(3,3), QLatin1String("DEF")); + QCOMPARE(a.mid(0,0), QLatin1String("")); QVERIFY(!a.mid(15,0).isNull()); QVERIFY(a.mid(15,0).isEmpty()); QVERIFY(!a.mid(15,1).isNull()); @@ -1965,8 +1985,8 @@ void tst_QString::midRef() QString a; a="ABCDEFGHIEfGEFG"; // 15 chars - QCOMPARE(a.midRef(3,3).toString(),(QString)"DEF"); - QCOMPARE(a.midRef(0,0).toString(),(QString)""); + QCOMPARE(a.midRef(3,3).toString(), QLatin1String("DEF")); + QCOMPARE(a.midRef(0,0).toString(), QLatin1String("")); QVERIFY(!a.midRef(15,0).toString().isNull()); QVERIFY(a.midRef(15,0).toString().isEmpty()); QVERIFY(!a.midRef(15,1).toString().isNull()); @@ -2090,44 +2110,44 @@ void tst_QString::leftJustified() { QString a; a="ABC"; - QCOMPARE(a.leftJustified(5,'-'),(QString)"ABC--"); - QCOMPARE(a.leftJustified(4,'-'),(QString)"ABC-"); - QCOMPARE(a.leftJustified(4),(QString)"ABC "); - QCOMPARE(a.leftJustified(3),(QString)"ABC"); - QCOMPARE(a.leftJustified(2),(QString)"ABC"); - QCOMPARE(a.leftJustified(1),(QString)"ABC"); - QCOMPARE(a.leftJustified(0),(QString)"ABC"); + QCOMPARE(a.leftJustified(5,'-'), QLatin1String("ABC--")); + QCOMPARE(a.leftJustified(4,'-'), QLatin1String("ABC-")); + QCOMPARE(a.leftJustified(4), QLatin1String("ABC ")); + QCOMPARE(a.leftJustified(3), QLatin1String("ABC")); + QCOMPARE(a.leftJustified(2), QLatin1String("ABC")); + QCOMPARE(a.leftJustified(1), QLatin1String("ABC")); + QCOMPARE(a.leftJustified(0), QLatin1String("ABC")); QString n; QVERIFY(!n.leftJustified(3).isNull()); - QCOMPARE(a.leftJustified(4,' ',true),(QString)"ABC "); - QCOMPARE(a.leftJustified(3,' ',true),(QString)"ABC"); - QCOMPARE(a.leftJustified(2,' ',true),(QString)"AB"); - QCOMPARE(a.leftJustified(1,' ',true),(QString)"A"); - QCOMPARE(a.leftJustified(0,' ',true),(QString)""); + QCOMPARE(a.leftJustified(4,' ',true), QLatin1String("ABC ")); + QCOMPARE(a.leftJustified(3,' ',true), QLatin1String("ABC")); + QCOMPARE(a.leftJustified(2,' ',true), QLatin1String("AB")); + QCOMPARE(a.leftJustified(1,' ',true), QLatin1String("A")); + QCOMPARE(a.leftJustified(0,' ',true), QLatin1String("")); } void tst_QString::rightJustified() { QString a; a="ABC"; - QCOMPARE(a.rightJustified(5,'-'),(QString)"--ABC"); - QCOMPARE(a.rightJustified(4,'-'),(QString)"-ABC"); - QCOMPARE(a.rightJustified(4),(QString)" ABC"); - QCOMPARE(a.rightJustified(3),(QString)"ABC"); - QCOMPARE(a.rightJustified(2),(QString)"ABC"); - QCOMPARE(a.rightJustified(1),(QString)"ABC"); - QCOMPARE(a.rightJustified(0),(QString)"ABC"); + QCOMPARE(a.rightJustified(5,'-'), QLatin1String("--ABC")); + QCOMPARE(a.rightJustified(4,'-'), QLatin1String("-ABC")); + QCOMPARE(a.rightJustified(4), QLatin1String(" ABC")); + QCOMPARE(a.rightJustified(3), QLatin1String("ABC")); + QCOMPARE(a.rightJustified(2), QLatin1String("ABC")); + QCOMPARE(a.rightJustified(1), QLatin1String("ABC")); + QCOMPARE(a.rightJustified(0), QLatin1String("ABC")); QString n; QVERIFY(!n.rightJustified(3).isNull()); - QCOMPARE(a.rightJustified(4,'-',true),(QString)"-ABC"); - QCOMPARE(a.rightJustified(4,' ',true),(QString)" ABC"); - QCOMPARE(a.rightJustified(3,' ',true),(QString)"ABC"); - QCOMPARE(a.rightJustified(2,' ',true),(QString)"AB"); - QCOMPARE(a.rightJustified(1,' ',true),(QString)"A"); - QCOMPARE(a.rightJustified(0,' ',true),(QString)""); - QCOMPARE(a,(QString)"ABC"); + QCOMPARE(a.rightJustified(4,'-',true), QLatin1String("-ABC")); + QCOMPARE(a.rightJustified(4,' ',true), QLatin1String(" ABC")); + QCOMPARE(a.rightJustified(3,' ',true), QLatin1String("ABC")); + QCOMPARE(a.rightJustified(2,' ',true), QLatin1String("AB")); + QCOMPARE(a.rightJustified(1,' ',true), QLatin1String("A")); + QCOMPARE(a.rightJustified(0,' ',true), QLatin1String("")); + QCOMPARE(a, QLatin1String("ABC")); } void tst_QString::toUpper() @@ -2325,21 +2345,21 @@ void tst_QString::trimmed() { QString a; a="Text"; - QCOMPARE(a,(QString)"Text"); - QCOMPARE(a.trimmed(),(QString)"Text"); - QCOMPARE(a,(QString)"Text"); + QCOMPARE(a, QLatin1String("Text")); + QCOMPARE(a.trimmed(), QLatin1String("Text")); + QCOMPARE(a, QLatin1String("Text")); a=" "; - QCOMPARE(a.trimmed(),(QString)""); - QCOMPARE(a,(QString)" "); + QCOMPARE(a.trimmed(), QLatin1String("")); + QCOMPARE(a, QLatin1String(" ")); a=" a "; - QCOMPARE(a.trimmed(),(QString)"a"); + QCOMPARE(a.trimmed(), QLatin1String("a")); a="Text"; - QCOMPARE(qMove(a).trimmed(),(QString)"Text"); + QCOMPARE(qMove(a).trimmed(), QLatin1String("Text")); a=" "; - QCOMPARE(qMove(a).trimmed(),(QString)""); + QCOMPARE(qMove(a).trimmed(), QLatin1String("")); a=" a "; - QCOMPARE(qMove(a).trimmed(),(QString)"a"); + QCOMPARE(qMove(a).trimmed(), QLatin1String("a")); } void tst_QString::simplified_data() @@ -2465,12 +2485,13 @@ void tst_QString::insert_special_cases() QCOMPARE(a.insert(1,'>'), QString("<>ABCABCABCABC")); a = "Meal"; - QCOMPARE(a.insert(1, QLatin1String("ontr")), QString("Montreal")); - QCOMPARE(a.insert(4, ""), QString("Montreal")); - QCOMPARE(a.insert(3, QLatin1String("")), QString("Montreal")); - QCOMPARE(a.insert(3, QLatin1String(0)), QString("Montreal")); - QCOMPARE(a.insert(3, static_cast<const char *>(0)), QString("Montreal")); - QCOMPARE(a.insert(0, QLatin1String("a")), QString("aMontreal")); + const QString montreal = QStringLiteral("Montreal"); + QCOMPARE(a.insert(1, QLatin1String("ontr")), montreal); + QCOMPARE(a.insert(4, ""), montreal); + QCOMPARE(a.insert(3, QLatin1String("")), montreal); + QCOMPARE(a.insert(3, QLatin1String(0)), montreal); + QCOMPARE(a.insert(3, static_cast<const char *>(0)), montreal); + QCOMPARE(a.insert(0, QLatin1String("a")), QLatin1String("aMontreal")); } void tst_QString::append_data(bool emptyIsNoop) @@ -3610,12 +3631,12 @@ void tst_QString::toDouble() void tst_QString::setNum() { QString a; - QCOMPARE(a.setNum(123),(QString)"123"); - QCOMPARE(a.setNum(-123),(QString)"-123"); - QCOMPARE(a.setNum(0x123,16),(QString)"123"); - QCOMPARE(a.setNum((short)123),(QString)"123"); - QCOMPARE(a.setNum(123L),(QString)"123"); - QCOMPARE(a.setNum(123UL),(QString)"123"); + QCOMPARE(a.setNum(123), QLatin1String("123")); + QCOMPARE(a.setNum(-123), QLatin1String("-123")); + QCOMPARE(a.setNum(0x123,16), QLatin1String("123")); + QCOMPARE(a.setNum((short)123), QLatin1String("123")); + QCOMPARE(a.setNum(123L), QLatin1String("123")); + QCOMPARE(a.setNum(123UL), QLatin1String("123")); QCOMPARE(a.setNum(2147483647L), QString("2147483647")); // 32 bit LONG_MAX QCOMPARE(a.setNum(-2147483647L), QString("-2147483647")); // LONG_MIN + 1 QCOMPARE(a.setNum(-2147483647L-1L), QString("-2147483648")); // LONG_MIN @@ -3872,7 +3893,7 @@ void tst_QString::check_QDataStream() { QDataStream in(&ar,QIODevice::ReadOnly); in >> a; - QCOMPARE(a,(QString)"COMPARE Text"); + QCOMPARE(a, QLatin1String("COMPARE Text")); } } @@ -3887,7 +3908,7 @@ void tst_QString::check_QTextStream() { QTextStream in(&ar,QIODevice::ReadOnly); in >> a; - QCOMPARE(a,(QString)"This"); + QCOMPARE(a, QLatin1String("This")); } } @@ -4580,100 +4601,100 @@ void tst_QString::arg() QString s13( "%1% %x%c%2 %d%2-%" ); QString s14( "%1%2%3" ); - QCOMPARE( s4.arg("foo"), QString("[foo]") ); - QCOMPARE( s5.arg("foo"), QString("[foo]") ); - QCOMPARE( s6.arg("foo"), QString("[foo]") ); - QCOMPARE( s7.arg("foo"), QString("[foo]") ); - QCOMPARE( s8.arg("foo"), QString("[foo %1]") ); - QCOMPARE( s8.arg("foo").arg("bar"), QString("[foo bar]") ); - QCOMPARE( s8.arg("foo", "bar"), QString("[foo bar]") ); - QCOMPARE( s9.arg("foo"), QString("[foo %3]") ); - QCOMPARE( s9.arg("foo").arg("bar"), QString("[foo bar]") ); - QCOMPARE( s9.arg("foo", "bar"), QString("[foo bar]") ); - QCOMPARE( s10.arg("foo"), QString("[foo %2 %3]") ); - QCOMPARE( s10.arg("foo").arg("bar"), QString("[foo bar %3]") ); - QCOMPARE( s10.arg("foo", "bar"), QString("[foo bar %3]") ); - QCOMPARE( s10.arg("foo").arg("bar").arg("baz"), QString("[foo bar baz]") ); - QCOMPARE( s10.arg("foo", "bar", "baz"), QString("[foo bar baz]") ); - QCOMPARE( s11.arg("foo"), QString("[%9 %3 foo]") ); - QCOMPARE( s11.arg("foo").arg("bar"), QString("[%9 bar foo]") ); - QCOMPARE( s11.arg("foo", "bar"), QString("[%9 bar foo]") ); - QCOMPARE( s11.arg("foo").arg("bar").arg("baz"), QString("[baz bar foo]") ); - QCOMPARE( s11.arg("foo", "bar", "baz"), QString("[baz bar foo]") ); + QCOMPARE( s4.arg("foo"), QLatin1String("[foo]") ); + QCOMPARE( s5.arg("foo"), QLatin1String("[foo]") ); + QCOMPARE( s6.arg("foo"), QLatin1String("[foo]") ); + QCOMPARE( s7.arg("foo"), QLatin1String("[foo]") ); + QCOMPARE( s8.arg("foo"), QLatin1String("[foo %1]") ); + QCOMPARE( s8.arg("foo").arg("bar"), QLatin1String("[foo bar]") ); + QCOMPARE( s8.arg("foo", "bar"), QLatin1String("[foo bar]") ); + QCOMPARE( s9.arg("foo"), QLatin1String("[foo %3]") ); + QCOMPARE( s9.arg("foo").arg("bar"), QLatin1String("[foo bar]") ); + QCOMPARE( s9.arg("foo", "bar"), QLatin1String("[foo bar]") ); + QCOMPARE( s10.arg("foo"), QLatin1String("[foo %2 %3]") ); + QCOMPARE( s10.arg("foo").arg("bar"), QLatin1String("[foo bar %3]") ); + QCOMPARE( s10.arg("foo", "bar"), QLatin1String("[foo bar %3]") ); + QCOMPARE( s10.arg("foo").arg("bar").arg("baz"), QLatin1String("[foo bar baz]") ); + QCOMPARE( s10.arg("foo", "bar", "baz"), QLatin1String("[foo bar baz]") ); + QCOMPARE( s11.arg("foo"), QLatin1String("[%9 %3 foo]") ); + QCOMPARE( s11.arg("foo").arg("bar"), QLatin1String("[%9 bar foo]") ); + QCOMPARE( s11.arg("foo", "bar"), QLatin1String("[%9 bar foo]") ); + QCOMPARE( s11.arg("foo").arg("bar").arg("baz"), QLatin1String("[baz bar foo]") ); + QCOMPARE( s11.arg("foo", "bar", "baz"), QLatin1String("[baz bar foo]") ); QCOMPARE( s12.arg("a").arg("b").arg("c").arg("d").arg("e"), - QString("[e b c e a d]") ); - QCOMPARE( s12.arg("a", "b", "c", "d").arg("e"), QString("[e b c e a d]") ); - QCOMPARE( s12.arg("a").arg("b", "c", "d", "e"), QString("[e b c e a d]") ); + QLatin1String("[e b c e a d]") ); + QCOMPARE( s12.arg("a", "b", "c", "d").arg("e"), QLatin1String("[e b c e a d]") ); + QCOMPARE( s12.arg("a").arg("b", "c", "d", "e"), QLatin1String("[e b c e a d]") ); QCOMPARE( s13.arg("alpha").arg("beta"), - QString("alpha% %x%cbeta %dbeta-%") ); - QCOMPARE( s13.arg("alpha", "beta"), QString("alpha% %x%cbeta %dbeta-%") ); - QCOMPARE( s14.arg("a", "b", "c"), QString("abc") ); - QCOMPARE( s8.arg("%1").arg("foo"), QString("[foo foo]") ); - QCOMPARE( s8.arg("%1", "foo"), QString("[%1 foo]") ); - QCOMPARE( s4.arg("foo", 2), QString("[foo]") ); - QCOMPARE( s4.arg("foo", -2), QString("[foo]") ); - QCOMPARE( s4.arg("foo", 10), QString("[ foo]") ); - QCOMPARE( s4.arg("foo", -10), QString("[foo ]") ); + QLatin1String("alpha% %x%cbeta %dbeta-%") ); + QCOMPARE( s13.arg("alpha", "beta"), QLatin1String("alpha% %x%cbeta %dbeta-%") ); + QCOMPARE( s14.arg("a", "b", "c"), QLatin1String("abc") ); + QCOMPARE( s8.arg("%1").arg("foo"), QLatin1String("[foo foo]") ); + QCOMPARE( s8.arg("%1", "foo"), QLatin1String("[%1 foo]") ); + QCOMPARE( s4.arg("foo", 2), QLatin1String("[foo]") ); + QCOMPARE( s4.arg("foo", -2), QLatin1String("[foo]") ); + QCOMPARE( s4.arg("foo", 10), QLatin1String("[ foo]") ); + QCOMPARE( s4.arg("foo", -10), QLatin1String("[foo ]") ); QString firstName( "James" ); QString lastName( "Bond" ); QString fullName = QString( "My name is %2, %1 %2" ) .arg( firstName ).arg( lastName ); - QCOMPARE( fullName, QString("My name is Bond, James Bond") ); + QCOMPARE( fullName, QLatin1String("My name is Bond, James Bond") ); // number overloads - QCOMPARE( s4.arg(0), QString("[0]") ); - QCOMPARE( s4.arg(-1), QString("[-1]") ); - QCOMPARE( s4.arg(4294967295UL), QString("[4294967295]") ); // ULONG_MAX 32 + QCOMPARE( s4.arg(0), QLatin1String("[0]") ); + QCOMPARE( s4.arg(-1), QLatin1String("[-1]") ); + QCOMPARE( s4.arg(4294967295UL), QLatin1String("[4294967295]") ); // ULONG_MAX 32 QCOMPARE( s4.arg(Q_INT64_C(9223372036854775807)), // LLONG_MAX - QString("[9223372036854775807]") ); + QLatin1String("[9223372036854775807]") ); QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \"\" , 0"); QCOMPARE( QString().arg(0), QString() ); QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \"\" , 0"); QCOMPARE( QString("").arg(0), QString("") ); QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \" \" , 0"); - QCOMPARE( QString(" ").arg(0), QString(" ") ); + QCOMPARE( QString(" ").arg(0), QLatin1String(" ") ); QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \"%\" , 0"); - QCOMPARE( QString("%").arg(0), QString("%") ); + QCOMPARE( QString("%").arg(0), QLatin1String("%") ); QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \"%%\" , 0"); - QCOMPARE( QString("%%").arg(0), QString("%%") ); + QCOMPARE( QString("%%").arg(0), QLatin1String("%%") ); QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \"%%%\" , 0"); - QCOMPARE( QString("%%%").arg(0), QString("%%%") ); - QCOMPARE( QString("%%%1%%%2").arg("foo").arg("bar"), QString("%%foo%%bar") ); - - QCOMPARE( QString("%1").arg("hello", -10), QString("hello ") ); - QCOMPARE( QString("%1").arg("hello", -5), QString("hello") ); - QCOMPARE( QString("%1").arg("hello", -2), QString("hello") ); - QCOMPARE( QString("%1").arg("hello", 0), QString("hello") ); - QCOMPARE( QString("%1").arg("hello", 2), QString("hello") ); - QCOMPARE( QString("%1").arg("hello", 5), QString("hello") ); - QCOMPARE( QString("%1").arg("hello", 10), QString(" hello") ); - QCOMPARE( QString("%1%1").arg("hello"), QString("hellohello") ); - QCOMPARE( QString("%2%1").arg("hello"), QString("%2hello") ); - QCOMPARE( QString("%1%1").arg(QString::null), QString("") ); - QCOMPARE( QString("%2%1").arg(""), QString("%2") ); + QCOMPARE( QString("%%%").arg(0), QLatin1String("%%%") ); + QCOMPARE( QString("%%%1%%%2").arg("foo").arg("bar"), QLatin1String("%%foo%%bar") ); + + QCOMPARE( QString("%1").arg("hello", -10), QLatin1String("hello ") ); + QCOMPARE( QString("%1").arg("hello", -5), QLatin1String("hello") ); + QCOMPARE( QString("%1").arg("hello", -2), QLatin1String("hello") ); + QCOMPARE( QString("%1").arg("hello", 0), QLatin1String("hello") ); + QCOMPARE( QString("%1").arg("hello", 2), QLatin1String("hello") ); + QCOMPARE( QString("%1").arg("hello", 5), QLatin1String("hello") ); + QCOMPARE( QString("%1").arg("hello", 10), QLatin1String(" hello") ); + QCOMPARE( QString("%1%1").arg("hello"), QLatin1String("hellohello") ); + QCOMPARE( QString("%2%1").arg("hello"), QLatin1String("%2hello") ); + QCOMPARE( QString("%1%1").arg(QString::null), QLatin1String("") ); + QCOMPARE( QString("%2%1").arg(""), QLatin1String("%2") ); QCOMPARE( QString("%2 %L1").arg(12345.6789).arg(12345.6789), - QString("12345.7 12.345,7") ); + QLatin1String("12345.7 12.345,7") ); QCOMPARE( QString("[%2] [%L1]").arg(12345.6789, 9).arg(12345.6789, 9), - QString("[ 12345.7] [ 12.345,7]") ); + QLatin1String("[ 12345.7] [ 12.345,7]") ); QCOMPARE( QString("[%2] [%L1]").arg(12345.6789, 9, 'g', 7).arg(12345.6789, 9, 'g', 7), - QString("[ 12345.68] [12.345,68]") ); + QLatin1String("[ 12345.68] [12.345,68]") ); QCOMPARE( QString("[%2] [%L1]").arg(12345.6789, 10, 'g', 7, QLatin1Char('0')).arg(12345.6789, 10, 'g', 7, QLatin1Char('0')), - QString("[0012345.68] [012.345,68]") ); + QLatin1String("[0012345.68] [012.345,68]") ); QCOMPARE( QString("%2 %L1").arg(123456789).arg(123456789), - QString("123456789 123.456.789") ); + QLatin1String("123456789 123.456.789") ); QCOMPARE( QString("[%2] [%L1]").arg(123456789, 12).arg(123456789, 12), - QString("[ 123456789] [ 123.456.789]") ); + QLatin1String("[ 123456789] [ 123.456.789]") ); QCOMPARE( QString("[%2] [%L1]").arg(123456789, 13, 10, QLatin1Char('0')).arg(123456789, 12, 10, QLatin1Char('0')), - QString("[000123456789] [00123.456.789]") ); + QLatin1String("[000123456789] [00123.456.789]") ); QCOMPARE( QString("[%2] [%L1]").arg(123456789, 13, 16, QLatin1Char('0')).arg(123456789, 12, 16, QLatin1Char('0')), - QString("[0000075bcd15] [00000075bcd15]") ); + QLatin1String("[0000075bcd15] [00000075bcd15]") ); QCOMPARE( QString("%L2 %L1 %3").arg(12345.7).arg(123456789).arg('c'), - QString("123.456.789 12.345,7 c") ); + QLatin1String("123.456.789 12.345,7 c") ); // multi-digit replacement QString input("%%%L0 %1 %02 %3 %4 %5 %L6 %7 %8 %%% %090 %10 %11 %L12 %14 %L9888 %9999 %%%%%%%L"); @@ -4683,36 +4704,36 @@ void tst_QString::arg() .arg("k").arg("l").arg("m") .arg("n").arg("o").arg("p"); - QCOMPARE(input, QString("%%A B C D E f g h i %%% j0 k l m n o88 p99 %%%%%%%L")); + QCOMPARE(input, QLatin1String("%%A B C D E f g h i %%% j0 k l m n o88 p99 %%%%%%%L")); QString str("%1 %2 %3 %4 %5 %6 %7 %8 %9 foo %10 %11 bar"); str = str.arg("one", "2", "3", "4", "5", "6", "7", "8", "9"); str = str.arg("ahoy", "there"); - QCOMPARE(str, QString("one 2 3 4 5 6 7 8 9 foo ahoy there bar")); + QCOMPARE(str, QLatin1String("one 2 3 4 5 6 7 8 9 foo ahoy there bar")); QString str2("%123 %234 %345 %456 %567 %999 %1000 %1230"); str2 = str2.arg("A", "B", "C", "D", "E", "F"); - QCOMPARE(str2, QString("A B C D E F %1000 %1230")); - - QCOMPARE(QString("%1").arg(-1, 3, 10, QChar('0')), QString("-01")); - QCOMPARE(QString("%1").arg(-100, 3, 10, QChar('0')), QString("-100")); - QCOMPARE(QString("%1").arg(-1, 3, 10, QChar(' ')), QString(" -1")); - QCOMPARE(QString("%1").arg(-100, 3, 10, QChar(' ')), QString("-100")); - QCOMPARE(QString("%1").arg(1U, 3, 10, QChar(' ')), QString(" 1")); - QCOMPARE(QString("%1").arg(1000U, 3, 10, QChar(' ')), QString("1000")); - QCOMPARE(QString("%1").arg(-1, 3, 10, QChar('x')), QString("x-1")); - QCOMPARE(QString("%1").arg(-100, 3, 10, QChar('x')), QString("-100")); - QCOMPARE(QString("%1").arg(1U, 3, 10, QChar('x')), QString("xx1")); - QCOMPARE(QString("%1").arg(1000U, 3, 10, QChar('x')), QString("1000")); - - QCOMPARE(QString("%1").arg(-1., 3, 'g', -1, QChar('0')), QString("-01")); - QCOMPARE(QString("%1").arg(-100., 3, 'g', -1, QChar('0')), QString("-100")); - QCOMPARE(QString("%1").arg(-1., 3, 'g', -1, QChar(' ')), QString(" -1")); - QCOMPARE(QString("%1").arg(-100., 3, 'g', -1, QChar(' ')), QString("-100")); - QCOMPARE(QString("%1").arg(1., 3, 'g', -1, QChar('x')), QString("xx1")); - QCOMPARE(QString("%1").arg(1000., 3, 'g', -1, QChar('x')), QString("1000")); - QCOMPARE(QString("%1").arg(-1., 3, 'g', -1, QChar('x')), QString("x-1")); - QCOMPARE(QString("%1").arg(-100., 3, 'g', -1, QChar('x')), QString("-100")); + QCOMPARE(str2, QLatin1String("A B C D E F %1000 %1230")); + + QCOMPARE(QString("%1").arg(-1, 3, 10, QChar('0')), QLatin1String("-01")); + QCOMPARE(QString("%1").arg(-100, 3, 10, QChar('0')), QLatin1String("-100")); + QCOMPARE(QString("%1").arg(-1, 3, 10, QChar(' ')), QLatin1String(" -1")); + QCOMPARE(QString("%1").arg(-100, 3, 10, QChar(' ')), QLatin1String("-100")); + QCOMPARE(QString("%1").arg(1U, 3, 10, QChar(' ')), QLatin1String(" 1")); + QCOMPARE(QString("%1").arg(1000U, 3, 10, QChar(' ')), QLatin1String("1000")); + QCOMPARE(QString("%1").arg(-1, 3, 10, QChar('x')), QLatin1String("x-1")); + QCOMPARE(QString("%1").arg(-100, 3, 10, QChar('x')), QLatin1String("-100")); + QCOMPARE(QString("%1").arg(1U, 3, 10, QChar('x')), QLatin1String("xx1")); + QCOMPARE(QString("%1").arg(1000U, 3, 10, QChar('x')), QLatin1String("1000")); + + QCOMPARE(QString("%1").arg(-1., 3, 'g', -1, QChar('0')), QLatin1String("-01")); + QCOMPARE(QString("%1").arg(-100., 3, 'g', -1, QChar('0')), QLatin1String("-100")); + QCOMPARE(QString("%1").arg(-1., 3, 'g', -1, QChar(' ')), QLatin1String(" -1")); + QCOMPARE(QString("%1").arg(-100., 3, 'g', -1, QChar(' ')), QLatin1String("-100")); + QCOMPARE(QString("%1").arg(1., 3, 'g', -1, QChar('x')), QLatin1String("xx1")); + QCOMPARE(QString("%1").arg(1000., 3, 'g', -1, QChar('x')), QLatin1String("1000")); + QCOMPARE(QString("%1").arg(-1., 3, 'g', -1, QChar('x')), QLatin1String("x-1")); + QCOMPARE(QString("%1").arg(-100., 3, 'g', -1, QChar('x')), QLatin1String("-100")); QLocale::setDefault(QString("ar")); QCOMPARE( QString("%L1").arg(12345.6789, 10, 'g', 7, QLatin1Char('0')), @@ -4725,13 +4746,18 @@ void tst_QString::arg() void tst_QString::number() { - QCOMPARE( QString::number(int(0)), QString("0") ); - QCOMPARE( QString::number((unsigned int)(11)), QString("11") ); - QCOMPARE( QString::number(-22L), QString("-22") ); - QCOMPARE( QString::number(333UL), QString("333") ); - QCOMPARE( QString::number(4.4), QString("4.4") ); - QCOMPARE( QString::number(Q_INT64_C(-555)), QString("-555") ); - QCOMPARE( QString::number(Q_UINT64_C(6666)), QString("6666") ); + QCOMPARE( QString::number(int(0)), QLatin1String("0") ); + QCOMPARE( QString::number((unsigned int)(11)), QLatin1String("11") ); + QCOMPARE( QString::number(-22L), QLatin1String("-22") ); + QCOMPARE( QString::number(333UL), QLatin1String("333") ); + QCOMPARE( QString::number(4.4), QLatin1String("4.4") ); + QCOMPARE( QString::number(Q_INT64_C(-555)), QLatin1String("-555") ); + QCOMPARE( QString::number(Q_UINT64_C(6666)), QLatin1String("6666") ); + +#ifndef QT_NO_DOUBLECONVERSION // snprintf_l is too stupid for this + QCOMPARE( QString::number(12.05, 'f', 1), QString("12.1") ); + QCOMPARE( QString::number(12.5, 'f', 0), QString("13") ); +#endif } void tst_QString::capacity_data() @@ -6019,6 +6045,22 @@ void tst_QString::compare() } } +void tst_QString::resize() +{ + QString s = QLatin1String("hello world"); + + s.resize(5); + QCOMPARE(s, QLatin1String("hello")); + s.resize(8); + QCOMPARE(s.size(), 8); + QVERIFY(s.startsWith(QLatin1String("hello"))); + + s.resize(10, QLatin1Char('n')); + QCOMPARE(s.size(), 10); + QVERIFY(s.startsWith(QLatin1String("hello"))); + QCOMPARE(s.right(2), QLatin1String("nn")); +} + void tst_QString::resizeAfterFromRawData() { QString buffer("hello world"); @@ -6157,9 +6199,6 @@ void tst_QString::QCharRefDetaching() const void tst_QString::sprintfZU() const { -#ifdef Q_CC_MINGW - QSKIP("MinGW does not support '%zu'."); -#else { QString string; size_t s = 6; @@ -6188,7 +6227,6 @@ void tst_QString::sprintfZU() const string.sprintf("%zu %s\n", s, "foo"); QCOMPARE(string, QString::fromLatin1("6 foo\n")); } -#endif // !Q_CC_MINGW } void tst_QString::repeatedSignature() const diff --git a/tests/auto/corelib/tools/qstring/tst_qstring_mac.mm b/tests/auto/corelib/tools/qstring/tst_qstring_mac.mm index 550f835bea..60bd3f9b15 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring_mac.mm +++ b/tests/auto/corelib/tools/qstring/tst_qstring_mac.mm @@ -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/tools/qstring_no_cast_from_bytearray/qstring_no_cast_from_bytearray.pro b/tests/auto/corelib/tools/qstring_no_cast_from_bytearray/qstring_no_cast_from_bytearray.pro index 1719af631d..14dbe779db 100644 --- a/tests/auto/corelib/tools/qstring_no_cast_from_bytearray/qstring_no_cast_from_bytearray.pro +++ b/tests/auto/corelib/tools/qstring_no_cast_from_bytearray/qstring_no_cast_from_bytearray.pro @@ -1,7 +1,6 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstring_no_cast_from_bytearray QT = core testlib SOURCES = tst_qstring_no_cast_from_bytearray.cpp DEFINES += QT_NO_CAST_FROM_BYTEARRAY -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstring_no_cast_from_bytearray/tst_qstring_no_cast_from_bytearray.cpp b/tests/auto/corelib/tools/qstring_no_cast_from_bytearray/tst_qstring_no_cast_from_bytearray.cpp index ab7eff6b2f..47fbeb6069 100644 --- a/tests/auto/corelib/tools/qstring_no_cast_from_bytearray/tst_qstring_no_cast_from_bytearray.cpp +++ b/tests/auto/corelib/tools/qstring_no_cast_from_bytearray/tst_qstring_no_cast_from_bytearray.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/tools/qstringbuilder/qstringbuilder1/qstringbuilder1.pro b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/qstringbuilder1.pro index 64ce377c29..d9cdad1bf5 100644 --- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/qstringbuilder1.pro +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/qstringbuilder1.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstringbuilder1 QT = core testlib SOURCES = tst_qstringbuilder1.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp index e3b25c4c81..4ccc903e32 100644 --- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.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/tools/qstringbuilder/qstringbuilder1/tst_qstringbuilder1.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/tst_qstringbuilder1.cpp index fc502fcd4c..2d320748f2 100644 --- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/tst_qstringbuilder1.cpp +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/tst_qstringbuilder1.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 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$ ** diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/qstringbuilder2.pro b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/qstringbuilder2.pro index 56ed7707d0..e134c5d934 100644 --- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/qstringbuilder2.pro +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/qstringbuilder2.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstringbuilder2 QT = core testlib SOURCES = tst_qstringbuilder2.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/tst_qstringbuilder2.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/tst_qstringbuilder2.cpp index 67f6346b6a..669990c9bc 100644 --- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/tst_qstringbuilder2.cpp +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/tst_qstringbuilder2.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 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$ ** diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/qstringbuilder3.pro b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/qstringbuilder3.pro index 2be2c24de4..29607551c3 100644 --- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/qstringbuilder3.pro +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/qstringbuilder3.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstringbuilder3 QT = core testlib SOURCES = tst_qstringbuilder3.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/tst_qstringbuilder3.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/tst_qstringbuilder3.cpp index 4d4209a60a..397e3326bf 100644 --- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/tst_qstringbuilder3.cpp +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/tst_qstringbuilder3.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 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$ ** diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/qstringbuilder4.pro b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/qstringbuilder4.pro index 3a97d49483..e55848e4bd 100644 --- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/qstringbuilder4.pro +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/qstringbuilder4.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstringbuilder4 QT = core testlib SOURCES = tst_qstringbuilder4.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/tst_qstringbuilder4.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/tst_qstringbuilder4.cpp index 4cf30e291b..05ce334c82 100644 --- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/tst_qstringbuilder4.cpp +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/tst_qstringbuilder4.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 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$ ** diff --git a/tests/auto/corelib/tools/qstringiterator/qstringiterator.pro b/tests/auto/corelib/tools/qstringiterator/qstringiterator.pro index e5e625d520..3a1678b5f3 100644 --- a/tests/auto/corelib/tools/qstringiterator/qstringiterator.pro +++ b/tests/auto/corelib/tools/qstringiterator/qstringiterator.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstringiterator QT = core core-private testlib SOURCES = tst_qstringiterator.cpp diff --git a/tests/auto/corelib/tools/qstringiterator/tst_qstringiterator.cpp b/tests/auto/corelib/tools/qstringiterator/tst_qstringiterator.cpp index f05caf0033..319f772516 100644 --- a/tests/auto/corelib/tools/qstringiterator/tst_qstringiterator.cpp +++ b/tests/auto/corelib/tools/qstringiterator/tst_qstringiterator.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@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$ ** diff --git a/tests/auto/corelib/tools/qstringlist/qstringlist.pro b/tests/auto/corelib/tools/qstringlist/qstringlist.pro index c3b2fe07c0..a87257decb 100644 --- a/tests/auto/corelib/tools/qstringlist/qstringlist.pro +++ b/tests/auto/corelib/tools/qstringlist/qstringlist.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstringlist QT = core testlib SOURCES = tst_qstringlist.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp index 3d44c7051d..dc3547f9ba 100644 --- a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp +++ b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.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/tools/qstringmatcher/qstringmatcher.pro b/tests/auto/corelib/tools/qstringmatcher/qstringmatcher.pro index 3a6e22b469..e34928776f 100644 --- a/tests/auto/corelib/tools/qstringmatcher/qstringmatcher.pro +++ b/tests/auto/corelib/tools/qstringmatcher/qstringmatcher.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstringmatcher QT = core testlib SOURCES = tst_qstringmatcher.cpp DEFINES += QT_NO_CAST_TO_ASCII -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp b/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp index a21e15aac4..0c098cb1c3 100644 --- a/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp +++ b/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.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/tools/qstringref/qstringref.pro b/tests/auto/corelib/tools/qstringref/qstringref.pro index edb5ef995c..04f3ba6a92 100644 --- a/tests/auto/corelib/tools/qstringref/qstringref.pro +++ b/tests/auto/corelib/tools/qstringref/qstringref.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstringref QT = core testlib SOURCES = tst_qstringref.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp index 82d103c460..b98c2fb4de 100644 --- a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp +++ b/tests/auto/corelib/tools/qstringref/tst_qstringref.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$ ** @@ -45,6 +41,7 @@ class tst_QStringRef : public QObject public slots: void cleanup(); private slots: + void at(); void endsWith(); void startsWith(); void contains(); @@ -97,7 +94,7 @@ static QStringRef emptyRef() } #define CREATE_REF(string) \ - const QString padded = QString::fromLatin1(" %1 ").arg(string); \ + const QString padded = QLatin1Char(' ') + string + QLatin1Char(' '); \ QStringRef ref = padded.midRef(1, padded.size() - 2); typedef QList<int> IntList; @@ -176,6 +173,16 @@ void tst_QStringRef::cleanup() QLocale::setDefault(QString(QLatin1Char('C'))); } +void tst_QStringRef::at() +{ + const QString hw = QStringLiteral("Hello World"); + const QStringRef ref = hw.midRef(6); + QCOMPARE(ref.at(0), QChar('W')); + QCOMPARE(ref.at(4), QChar('d')); + QCOMPARE(ref[0], QChar('W')); + QCOMPARE(ref[4], QChar('d')); +} + void tst_QStringRef::length_data() { QTest::addColumn<QString>("s1"); @@ -292,7 +299,7 @@ void tst_QStringRef::indexOf_data() QString s2; s2 += QChar(0x3bc); QTest::newRow("data58") << QString(s1) << QString(s2) << 0 << false << 3; - s2.prepend("C"); + s2.prepend(QLatin1Char('C')); QTest::newRow("data59") << QString(s1) << QString(s2) << 0 << false << 2; QString veryBigHaystack(500, 'a'); @@ -317,8 +324,8 @@ void tst_QStringRef::indexOf() QFETCH(bool, bcs); QFETCH(int, resultpos); - const QString haystackPadded = QString::fromLatin1(" %1 ").arg(haystack); - const QString needlePadded = QString::fromLatin1(" %1 ").arg(needle); + const QString haystackPadded = QLatin1Char(' ') + haystack + QLatin1Char(' '); + const QString needlePadded = QLatin1Char(' ') + needle + QLatin1Char(' '); const QStringRef haystackRef(&haystackPadded, 1, haystack.size()); const QStringRef needleRef(&needlePadded, 1, needle.size()); @@ -407,8 +414,8 @@ void tst_QStringRef::indexOf2() QFETCH(QString, needle); QFETCH(int, resultpos); - const QString haystackPadded = QString::fromLatin1(" %1 ").arg(haystack); - const QString needlePadded = QString::fromLatin1(" %1 ").arg(needle); + const QString haystackPadded = QLatin1Char(' ') + haystack + QLatin1Char(' '); + const QString needlePadded = QLatin1Char(' ') + needle + QLatin1Char(' '); const QStringRef haystackRef(&haystackPadded, 1, haystack.size()); const QStringRef needleRef(&needlePadded, 1, needle.size()); @@ -490,8 +497,8 @@ void tst_QStringRef::lastIndexOf() QFETCH(int, expected); QFETCH(bool, caseSensitive); - const QString haystackPadded = QString::fromLatin1(" %1 ").arg(haystack); - const QString needlePadded = QString::fromLatin1(" %1 ").arg(needle); + const QString haystackPadded = QLatin1Char(' ') + haystack + QLatin1Char(' '); + const QString needlePadded = QLatin1Char(' ') + needle + QLatin1Char(' '); const QStringRef haystackRef(&haystackPadded, 1, haystack.size()); const QStringRef needleRef(&needlePadded, 1, needle.size()); diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro index 29b9854ebb..9d26ec1fd5 100644 --- a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro +++ b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro @@ -1,10 +1,9 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtextboundaryfinder QT = core testlib SOURCES = tst_qtextboundaryfinder.cpp TESTDATA += data -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 android: !android-no-sdk { RESOURCES += \ diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp b/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp index 753d61f02c..4c9916cc52 100644 --- a/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp +++ b/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.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$ ** @@ -166,8 +161,8 @@ static void generateDataFromFile(const QString &fname) } } - QString nm = QString("line #%1: %2").arg(linenum).arg(comments); - QTest::newRow(nm.toLatin1()) << testString << expectedBreakPositions; + const QByteArray nm = "line #" + QByteArray::number(linenum) + ": " + comments.toLatin1(); + QTest::newRow(nm.constData()) << testString << expectedBreakPositions; } } #endif diff --git a/tests/auto/corelib/tools/qtime/qtime.pro b/tests/auto/corelib/tools/qtime/qtime.pro index 48db4c6664..0973b7a9ef 100644 --- a/tests/auto/corelib/tools/qtime/qtime.pro +++ b/tests/auto/corelib/tools/qtime/qtime.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtime QT = core testlib SOURCES = tst_qtime.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qtime/tst_qtime.cpp b/tests/auto/corelib/tools/qtime/tst_qtime.cpp index 213b817c3d..45af10c3ab 100644 --- a/tests/auto/corelib/tools/qtime/tst_qtime.cpp +++ b/tests/auto/corelib/tools/qtime/tst_qtime.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/tools/qtimeline/qtimeline.pro b/tests/auto/corelib/tools/qtimeline/qtimeline.pro index ca8eba41fb..9424cf8fd2 100644 --- a/tests/auto/corelib/tools/qtimeline/qtimeline.pro +++ b/tests/auto/corelib/tools/qtimeline/qtimeline.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtimeline QT = core testlib SOURCES = tst_qtimeline.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp index b588e1fe82..83838570be 100644 --- a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp +++ b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.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/tools/qtimezone/qtimezone.pro b/tests/auto/corelib/tools/qtimezone/qtimezone.pro index fa2397a6bb..4459ed6020 100644 --- a/tests/auto/corelib/tools/qtimezone/qtimezone.pro +++ b/tests/auto/corelib/tools/qtimezone/qtimezone.pro @@ -1,8 +1,7 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtimezone QT = core-private testlib SOURCES = tst_qtimezone.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 contains(QT_CONFIG,icu) { DEFINES += QT_USE_ICU } diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp index b511abf670..1879543581 100644 --- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.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/tools/qvarlengtharray/qvarlengtharray.pro b/tests/auto/corelib/tools/qvarlengtharray/qvarlengtharray.pro index 4fb8a1cf30..108fb33db5 100644 --- a/tests/auto/corelib/tools/qvarlengtharray/qvarlengtharray.pro +++ b/tests/auto/corelib/tools/qvarlengtharray/qvarlengtharray.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qvarlengtharray QT = core testlib SOURCES = tst_qvarlengtharray.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp index 82f78b2b0b..7fc44343a5 100644 --- a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp +++ b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.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$ ** @@ -148,14 +143,14 @@ void tst_QVarLengthArray::oldTests() QVarLengthArray<QString> sa(10); sa[0] = "Hello"; sa[9] = "World"; - QVERIFY(*sa.data() == "Hello"); - QVERIFY(sa[9] == "World"); + QCOMPARE(*sa.data(), QLatin1String("Hello")); + QCOMPARE(sa[9], QLatin1String("World")); sa.reserve(512); - QVERIFY(*sa.data() == "Hello"); - QVERIFY(sa[9] == "World"); + QCOMPARE(*sa.data(), QLatin1String("Hello")); + QCOMPARE(sa[9], QLatin1String("World")); sa.resize(512); - QVERIFY(*sa.data() == "Hello"); - QVERIFY(sa[9] == "World"); + QCOMPARE(*sa.data(), QLatin1String("Hello")); + QCOMPARE(sa[9], QLatin1String("World")); } { int arr[2] = {1, 2}; diff --git a/tests/auto/corelib/tools/qvector/qvector.pro b/tests/auto/corelib/tools/qvector/qvector.pro index c1e0564915..d49516923f 100644 --- a/tests/auto/corelib/tools/qvector/qvector.pro +++ b/tests/auto/corelib/tools/qvector/qvector.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase contains(QT_CONFIG, c++11):CONFIG += c++11 TARGET = tst_qvector QT = core testlib SOURCES = $$PWD/tst_qvector.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp index 87822bca6f..eb37d6b8e6 100644 --- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp +++ b/tests/auto/corelib/tools/qvector/tst_qvector.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$ ** @@ -739,10 +734,11 @@ void tst_QVector::clear() const QVector<T> myvec; myvec << SimpleValue<T>::at(0) << SimpleValue<T>::at(1) << SimpleValue<T>::at(2); - QVERIFY(myvec.size() == 3); + const auto oldCapacity = myvec.capacity(); + QCOMPARE(myvec.size(), 3); myvec.clear(); - QVERIFY(myvec.size() == 0); - QVERIFY(myvec.capacity() == 0); + QCOMPARE(myvec.size(), 0); + QCOMPARE(myvec.capacity(), oldCapacity); } void tst_QVector::clearInt() const @@ -1950,7 +1946,7 @@ void tst_QVector::resizePOD() const const int capacity = vector.capacity(); - vector.resize(0); + vector.clear(); QCOMPARE(vector.size(), 0); QVERIFY(vector.capacity() <= capacity); } @@ -2391,6 +2387,7 @@ void tst_QVector::reallocAfterCopy_data() int result1, result2, result3, result4; int fill_size; for (int i = 70; i <= 100; i += 10) { + const QByteArray prefix = "reallocAfterCopy:" + QByteArray::number(i) + ','; fill_size = i - 20; for (int j = 0; j <= 3; j++) { if (j == 0) { // append @@ -2414,7 +2411,8 @@ void tst_QVector::reallocAfterCopy_data() result3 = i - 10; result4 = i - 20; } - QTest::newRow(qPrintable(QString("reallocAfterCopy:%1,%2").arg(i).arg(j))) << i << fill_size << j << result1 << result2 << result3 << result4; + QTest::newRow((prefix + QByteArray::number(j)).constData()) + << i << fill_size << j << result1 << result2 << result3 << result4; } } } diff --git a/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro b/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro index e83a2b507c..834fc85a29 100644 --- a/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro +++ b/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase contains(QT_CONFIG, c++11):CONFIG += c++11 contains(QT_CONFIG, c++14):CONFIG += c++14 TARGET = tst_qversionnumber diff --git a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp index 0b8b63a1e8..34d9256244 100644 --- a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp +++ b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2014 Keith Gardner <kreios4004@gmail.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$ ** |