aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml')
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.h2
-rw-r--r--tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp52
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/json.data6
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/receiveJsonData.qml22
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/receive_json_data.expect7
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/receive_json_data.reply3
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp18
-rw-r--r--tests/auto/qml/qv4debugger/tst_qv4debugger.cpp4
8 files changed, 85 insertions, 29 deletions
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h
index bbccf7b94b..eb4a3147d3 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.h
+++ b/tests/auto/qml/qqmlecmascript/testtypes.h
@@ -1253,7 +1253,7 @@ public:
Q_INVOKABLE void addReference(QObject *other)
{
QQmlData *ddata = QQmlData::get(this);
- assert(ddata);
+ Q_ASSERT(ddata);
QV4::ExecutionEngine *v4 = ddata->jsWrapper.engine();
Q_ASSERT(v4);
QV4::Scope scope(v4);
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
index c4b2325843..84f03f6647 100644
--- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
+++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
@@ -161,7 +161,7 @@ void tst_qqmlproperty::qmlmetaproperty()
QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
QVERIFY(binding != 0);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(obj, QObjectPrivate::get(obj)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
- QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
QCOMPARE(prop.name(), QString());
@@ -189,7 +189,7 @@ void tst_qqmlproperty::qmlmetaproperty()
QCOMPARE(prop.propertyTypeName(), (const char *)0);
QVERIFY(prop.property().name() == 0);
QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
- QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QQmlPropertyPrivate::setBinding(prop, binding.data());
QVERIFY(binding == 0);
QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
@@ -410,7 +410,7 @@ void tst_qqmlproperty::qmlmetaproperty_object()
QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
QVERIFY(binding != 0);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
- QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
QObject *obj = new QObject;
@@ -440,7 +440,7 @@ void tst_qqmlproperty::qmlmetaproperty_object()
QCOMPARE(prop.propertyTypeName(), (const char *)0);
QVERIFY(prop.property().name() == 0);
QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
- QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QQmlPropertyPrivate::setBinding(prop, binding.data());
QVERIFY(binding == 0);
QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
@@ -458,7 +458,7 @@ void tst_qqmlproperty::qmlmetaproperty_object()
static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding != 0);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
- QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
QObject *obj = new QObject;
@@ -489,7 +489,7 @@ void tst_qqmlproperty::qmlmetaproperty_object()
QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Unable to assign null to int");
- QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QQmlPropertyPrivate::setBinding(prop, binding.data());
QVERIFY(binding != 0);
QVERIFY(QQmlPropertyPrivate::binding(prop) == binding.data());
QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
@@ -513,7 +513,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string()
QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
QVERIFY(binding != 0);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
- QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
QObject *obj = new QObject;
@@ -543,7 +543,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string()
QCOMPARE(prop.propertyTypeName(), (const char *)0);
QVERIFY(prop.property().name() == 0);
QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
- QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QQmlPropertyPrivate::setBinding(prop, binding.data());
QVERIFY(binding == 0);
QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
@@ -561,7 +561,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string()
static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding != 0);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
- QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
QObject *obj = new QObject;
@@ -592,7 +592,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string()
QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Unable to assign null to int");
- QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QQmlPropertyPrivate::setBinding(prop, binding.data());
QVERIFY(binding != 0);
QVERIFY(QQmlPropertyPrivate::binding(prop) == binding.data());
QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
@@ -611,7 +611,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string()
static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding != 0);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
- QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
QObject *obj = new QObject;
@@ -641,7 +641,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string()
QCOMPARE(prop.propertyTypeName(), (const char *)0);
QCOMPARE(prop.property().name(), (const char *)0);
QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
- QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QQmlPropertyPrivate::setBinding(prop, binding.data());
QVERIFY(binding == 0);
QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
@@ -660,7 +660,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string()
static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding != 0);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
- QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
QObject *obj = new QObject;
@@ -690,7 +690,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string()
QCOMPARE(prop.propertyTypeName(), (const char *)0);
QCOMPARE(prop.property().name(), (const char *)0);
QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
- QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QQmlPropertyPrivate::setBinding(prop, binding.data());
QVERIFY(binding == 0);
QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
@@ -714,7 +714,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_context()
QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
QVERIFY(binding != 0);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
- QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
QObject *obj = new QObject;
@@ -744,7 +744,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_context()
QCOMPARE(prop.propertyTypeName(), (const char *)0);
QVERIFY(prop.property().name() == 0);
QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
- QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QQmlPropertyPrivate::setBinding(prop, binding.data());
QVERIFY(binding == 0);
QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
@@ -762,7 +762,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_context()
static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding != 0);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
- QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
QObject *obj = new QObject;
@@ -793,7 +793,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_context()
QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Unable to assign null to int");
- QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QQmlPropertyPrivate::setBinding(prop, binding.data());
QVERIFY(binding != 0);
QVERIFY(QQmlPropertyPrivate::binding(prop) == binding.data());
QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
@@ -817,7 +817,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context()
QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
QVERIFY(binding != 0);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
- QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
QObject *obj = new QObject;
@@ -847,7 +847,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context()
QCOMPARE(prop.propertyTypeName(), (const char *)0);
QVERIFY(prop.property().name() == 0);
QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
- QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QQmlPropertyPrivate::setBinding(prop, binding.data());
QVERIFY(binding == 0);
QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
@@ -865,7 +865,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context()
static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding != 0);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
- QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
QObject *obj = new QObject;
@@ -896,7 +896,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context()
QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Unable to assign null to int");
- QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QQmlPropertyPrivate::setBinding(prop, binding.data());
QVERIFY(binding != 0);
QVERIFY(QQmlPropertyPrivate::binding(prop) == binding.data());
QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
@@ -915,7 +915,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context()
static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding != 0);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
- QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
QObject *obj = new QObject;
@@ -945,7 +945,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context()
QCOMPARE(prop.propertyTypeName(), (const char *)0);
QCOMPARE(prop.property().name(), (const char *)0);
QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
- QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QQmlPropertyPrivate::setBinding(prop, binding.data());
QVERIFY(binding == 0);
QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
@@ -964,7 +964,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context()
static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
QVERIFY(binding != 0);
QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1);
- QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr);
QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
QObject *obj = new QObject;
@@ -994,7 +994,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context()
QCOMPARE(prop.propertyTypeName(), (const char *)0);
QCOMPARE(prop.property().name(), (const char *)0);
QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
- QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QQmlPropertyPrivate::setBinding(prop, binding.data());
QVERIFY(binding == 0);
QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/json.data b/tests/auto/qml/qqmlxmlhttprequest/data/json.data
new file mode 100644
index 0000000000..7925375293
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/json.data
@@ -0,0 +1,6 @@
+{"widget": {
+ "debug": "on",
+ "window": {
+ "name": "main_window",
+ "width": 500
+}}}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/receiveJsonData.qml b/tests/auto/qml/qqmlxmlhttprequest/data/receiveJsonData.qml
new file mode 100644
index 0000000000..3fc116e675
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/receiveJsonData.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url;
+ property bool result: false
+ property string correctjsondata : "{\"widget\":{\"debug\":\"on\",\"window\":{\"name\":\"main_window\",\"width\":500}}}"
+
+ Component.onCompleted: {
+ var request = new XMLHttpRequest();
+ request.open("GET", url, true);
+ request.responseType = "json";
+
+ request.onreadystatechange = function() {
+ if (request.readyState == XMLHttpRequest.DONE) {
+ var jsonData = JSON.stringify(request.response);
+ result = (correctjsondata == jsonData);
+ }
+ }
+
+ request.send(null);
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/receive_json_data.expect b/tests/auto/qml/qqmlxmlhttprequest/data/receive_json_data.expect
new file mode 100644
index 0000000000..97b016f50a
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/receive_json_data.expect
@@ -0,0 +1,7 @@
+GET /json.data HTTP/1.1
+Accept-Language: en-US,*
+Content-Type: application/jsonrequest
+Connection: Keep-Alive
+Accept-Encoding: gzip, deflate
+User-Agent: Mozilla/5.0
+Host: {{ServerHostUrl}}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/receive_json_data.reply b/tests/auto/qml/qqmlxmlhttprequest/data/receive_json_data.reply
new file mode 100644
index 0000000000..f1ee73d623
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/receive_json_data.reply
@@ -0,0 +1,3 @@
+HTTP/1.1 200 OK
+Connection: close
+Content-Type: application/jsonrequest
diff --git a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
index c159dc8420..ad78fafc67 100644
--- a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
+++ b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
@@ -88,6 +88,7 @@ private slots:
void getAllResponseHeaders_sent();
void getAllResponseHeaders_args();
void getBinaryData();
+ void getJsonData();
void status();
void status_data();
void statusText();
@@ -848,6 +849,23 @@ void tst_qqmlxmlhttprequest::getBinaryData()
QTRY_VERIFY(object->property("readSize").toInt() == fileInfo.size());
}
+void tst_qqmlxmlhttprequest::getJsonData()
+{
+ TestHTTPServer server;
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
+ QVERIFY(server.wait(testFileUrl("receive_json_data.expect"),
+ testFileUrl("receive_binary_data.reply"),
+ testFileUrl("json.data")));
+
+ QQmlComponent component(&engine, testFileUrl("receiveJsonData.qml"));
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QVERIFY(!object.isNull());
+ object->setProperty("url", server.urlString("/json.data"));
+ component.completeCreate();
+
+ QTRY_VERIFY(object->property("result").toBool());
+}
+
void tst_qqmlxmlhttprequest::status()
{
QFETCH(QUrl, replyUrl);
diff --git a/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp
index 056b24d167..ee0f55813d 100644
--- a/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp
+++ b/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp
@@ -85,7 +85,7 @@ public:
QV4::ScopedString name(scope, v4->newString(functionName));
QV4::ScopedContext ctx(scope, v4->rootContext());
QV4::ScopedValue function(scope, BuiltinFunction::create(ctx, name, injectedFunction));
- v4->globalObject()->put(name, function);
+ v4->globalObject->put(name, function);
}
signals:
@@ -131,7 +131,7 @@ protected:
virtual void addObject(const QString &name, const QV4::Value &value)
{
QV4::Scope scope(engine());
- QV4::ScopedObject obj(scope, value.asObject());
+ QV4::ScopedObject obj(scope, value.as<Object>());
QVariantMap props, *prev = &props;
qSwap(destination, prev);