diff options
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 63 |
1 files changed, 28 insertions, 35 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 1d335f1f6a..26a15d730c 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.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$ ** @@ -4929,7 +4924,7 @@ void tst_qqmlecmascript::propertyVarImplicitOwnership() QCOMPARE(rootObject->property("rectCanary").toInt(), 5); QCOMPARE(childObject->property("textCanary").toInt(), 10); QMetaObject::invokeMethod(childObject, "constructQObject"); // creates a reference to a constructed QObject. - QWeakPointer<QObject> qobjectGuard(childObject->property("vp").value<QObject*>()); // get the pointer prior to processing deleteLater events. + QPointer<QObject> qobjectGuard(childObject->property("vp").value<QObject*>()); // get the pointer prior to processing deleteLater events. QVERIFY(!qobjectGuard.isNull()); QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); @@ -4952,9 +4947,9 @@ void tst_qqmlecmascript::propertyVarReparent() QObject *rect = object->property("vp").value<QObject*>(); QObject *text = rect->findChild<QObject*>("textOne"); QObject *text2 = rect->findChild<QObject*>("textTwo"); - QWeakPointer<QObject> rectGuard(rect); - QWeakPointer<QObject> textGuard(text); - QWeakPointer<QObject> text2Guard(text2); + QPointer<QObject> rectGuard(rect); + QPointer<QObject> textGuard(text); + QPointer<QObject> text2Guard(text2); QVERIFY(!rectGuard.isNull()); QVERIFY(!textGuard.isNull()); QVERIFY(!text2Guard.isNull()); @@ -4963,7 +4958,7 @@ void tst_qqmlecmascript::propertyVarReparent() // now construct an image which we will reparent. QMetaObject::invokeMethod(text2, "constructQObject"); QObject *image = text2->property("vp").value<QObject*>(); - QWeakPointer<QObject> imageGuard(image); + QPointer<QObject> imageGuard(image); QVERIFY(!imageGuard.isNull()); QCOMPARE(image->property("imageCanary").toInt(), 13); // now reparent the "Image" object (currently, it has JS ownership) @@ -4994,9 +4989,9 @@ void tst_qqmlecmascript::propertyVarReparentNullContext() QObject *rect = object->property("vp").value<QObject*>(); QObject *text = rect->findChild<QObject*>("textOne"); QObject *text2 = rect->findChild<QObject*>("textTwo"); - QWeakPointer<QObject> rectGuard(rect); - QWeakPointer<QObject> textGuard(text); - QWeakPointer<QObject> text2Guard(text2); + QPointer<QObject> rectGuard(rect); + QPointer<QObject> textGuard(text); + QPointer<QObject> text2Guard(text2); QVERIFY(!rectGuard.isNull()); QVERIFY(!textGuard.isNull()); QVERIFY(!text2Guard.isNull()); @@ -5005,7 +5000,7 @@ void tst_qqmlecmascript::propertyVarReparentNullContext() // now construct an image which we will reparent. QMetaObject::invokeMethod(text2, "constructQObject"); QObject *image = text2->property("vp").value<QObject*>(); - QWeakPointer<QObject> imageGuard(image); + QPointer<QObject> imageGuard(image); QVERIFY(!imageGuard.isNull()); QCOMPARE(image->property("imageCanary").toInt(), 13); // now reparent the "Image" object (currently, it has JS ownership) @@ -5063,9 +5058,9 @@ void tst_qqmlecmascript::propertyVarCircular2() QVERIFY(rootObject != 0); QObject *childObject = rootObject->findChild<QObject*>("text"); QVERIFY(childObject != 0); - QWeakPointer<QObject> rootObjectTracker(rootObject); + QPointer<QObject> rootObjectTracker(rootObject); QVERIFY(!rootObjectTracker.isNull()); - QWeakPointer<QObject> childObjectTracker(childObject); + QPointer<QObject> childObjectTracker(childObject); QVERIFY(!childObjectTracker.isNull()); gc(engine); QCOMPARE(rootObject->property("rectCanary").toInt(), 5); @@ -6641,8 +6636,7 @@ void tst_qqmlecmascript::urlPropertyWithEncoding() MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); QVERIFY(object != 0); object->setStringProperty("http://qt-project.org"); - QUrl encoded; - encoded.setEncodedUrl("http://qt-project.org/?get%3cDATA%3e", QUrl::TolerantMode); + const QUrl encoded = QUrl::fromEncoded("http://qt-project.org/?get%3cDATA%3e", QUrl::TolerantMode); QCOMPARE(object->urlProperty(), encoded); QCOMPARE(object->value(), 0); // Interpreting URL as string yields canonicalised version QCOMPARE(object->property("result").toBool(), true); @@ -6660,8 +6654,7 @@ void tst_qqmlecmascript::urlListPropertyWithEncoding() MySequenceConversionObject *msco3 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco3")); MySequenceConversionObject *msco4 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco4")); QVERIFY(msco1 != 0 && msco2 != 0 && msco3 != 0 && msco4 != 0); - QUrl encoded; - encoded.setEncodedUrl("http://qt-project.org/?get%3cDATA%3e", QUrl::TolerantMode); + const QUrl encoded = QUrl::fromEncoded("http://qt-project.org/?get%3cDATA%3e", QUrl::TolerantMode); QCOMPARE(msco1->urlListProperty(), (QList<QUrl>() << encoded)); QCOMPARE(msco2->urlListProperty(), (QList<QUrl>() << encoded)); QCOMPARE(msco3->urlListProperty(), (QList<QUrl>() << encoded << encoded)); @@ -7449,7 +7442,7 @@ void tst_qqmlecmascript::sequenceSort_data() QTest::newRow("qtbug_25269") << "test_qtbug_25269" << false; - const char *types[] = { "alphabet", "numbers", "reals" }; + const char *types[] = { "alphabet", "numbers", "reals", "number_vector", "real_vector" }; const char *sort[] = { "insertionSort", "quickSort" }; for (size_t t=0 ; t < sizeof(types)/sizeof(types[0]) ; ++t) { @@ -7459,7 +7452,7 @@ void tst_qqmlecmascript::sequenceSort_data() QString fnName = QLatin1String("test_") + testName; bool useComparer = c != 0; testName += useComparer ? QLatin1String("[custom]") : QLatin1String("[default]"); - QTest::newRow(testName.toAscii().constData()) << fnName << useComparer; + QTest::newRow(testName.toLatin1().constData()) << fnName << useComparer; } } } @@ -7478,7 +7471,7 @@ void tst_qqmlecmascript::sequenceSort() QVERIFY(object != 0); QVariant q; - QMetaObject::invokeMethod(object, function.toAscii().constData(), Q_RETURN_ARG(QVariant, q), Q_ARG(QVariant, useComparer)); + QMetaObject::invokeMethod(object, function.toLatin1().constData(), Q_RETURN_ARG(QVariant, q), Q_ARG(QVariant, useComparer)); QVERIFY(q.toBool()); delete object; |