aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-08-24 14:11:03 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-09-02 04:19:22 +0000
commit06f11da5e17d292eab510b3d9f7c7455108bb91c (patch)
treecb87a617222cfb0f1cef177294a523115b3d5783 /tests/auto/qml/qqmlecmascript
parent9713146cbc91d7e41af73ac5af1ec09bce028e1b (diff)
Tests: Remove QT_DISABLE_DEPRECATED_BEFORE=0 for simple cases.
Fix usage of API that is marked deprecated. Change-Id: Ia887437f99b9ce207891ca19bc49294acb7d629d Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript')
-rw-r--r--tests/auto/qml/qqmlecmascript/qqmlecmascript.pro2
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp32
2 files changed, 15 insertions, 19 deletions
diff --git a/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro b/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro
index 6f3f765aba..101181bba0 100644
--- a/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro
+++ b/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro
@@ -20,5 +20,3 @@ TESTDATA = data/*
QT += core-private gui-private qml-private network testlib
qtHaveModule(widgets): QT += widgets
-
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 222e594d1a..a1038b0f52 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -4911,7 +4911,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();
@@ -4934,9 +4934,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());
@@ -4945,7 +4945,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)
@@ -4976,9 +4976,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());
@@ -4987,7 +4987,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)
@@ -5045,9 +5045,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);
@@ -6614,8 +6614,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);
@@ -6633,8 +6632,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));
@@ -7331,7 +7329,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;
}
}
}
@@ -7350,7 +7348,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;