aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/debugger
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-01-14 21:52:09 +0100
committerLiang Qi <liang.qi@qt.io>2017-01-14 22:17:32 +0100
commit60300fda463ae0f31c1e66ca253a2a976a88ee20 (patch)
treeb2264433418280ccbb7ed173892456fce4fab43a /tests/auto/qml/debugger
parentdb462cce86dba0be80239d4aaaea668ef173af3d (diff)
parent0e3380f9c6ab6e3ea7398caccf5aa84f1575f1cd (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: .qmake.conf Change-Id: I9d87ed86e95b5901a86cc3aa65d7ac39b0b708c2
Diffstat (limited to 'tests/auto/qml/debugger')
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp28
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp4
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebugclient.h2
3 files changed, 32 insertions, 2 deletions
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
index 40e19d375d..8c30a82317 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -45,6 +45,7 @@
#include <QtQml/qqmlcomponent.h>
#include <QtQml/qqmlexpression.h>
#include <QtQml/qqmlproperty.h>
+#include <QtQml/qqmlincubator.h>
#include <QtQuick/qquickitem.h>
#include <QtNetwork/qhostaddress.h>
@@ -136,6 +137,7 @@ private slots:
void regression_QTCREATORBUG_7451();
void queryObjectWithNonStreamableTypes();
+ void asynchronousCreate();
};
QmlDebugObjectReference tst_QQmlEngineDebugService::findRootObject(
@@ -1220,6 +1222,32 @@ void tst_QQmlEngineDebugService::queryObjectTree()
QCOMPARE(findProperty(animation.properties,"duration").value.toInt(), 100);
}
+void tst_QQmlEngineDebugService::asynchronousCreate() {
+ QmlDebugObjectReference object;
+ auto connection = connect(m_dbg, &QQmlEngineDebugClient::newObject, this, [&](int objectId) {
+ object.debugId = objectId;
+ });
+
+ QByteArray asynchronousComponent = "import QtQuick 2.5\n"
+ "Rectangle { id: asyncRect }";
+ QQmlComponent component(m_engine);
+ component.setData(asynchronousComponent, QUrl::fromLocalFile(""));
+ QVERIFY(component.isReady()); // fails if bad syntax
+ QQmlIncubator incubator(QQmlIncubator::Asynchronous);
+ component.create(incubator);
+
+ QVERIFY(m_dbg->object().idString != QLatin1String("asyncRect"));
+
+ QTRY_VERIFY(object.debugId != -1);
+ disconnect(connection);
+
+ bool success = false;
+ m_dbg->queryObject(object, &success);
+ QVERIFY(success);
+
+ QTRY_COMPARE(m_dbg->object().idString, QLatin1String("asyncRect"));
+}
+
int main(int argc, char *argv[])
{
int _argc = argc + 1;
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
index 3ad7beb7ff..3e27951d78 100644
--- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
@@ -489,7 +489,9 @@ void QQmlEngineDebugClient::messageReceived(const QByteArray &data)
return;
} else if (type == "OBJECT_CREATED") {
- emit newObjects();
+ int engineId, objectId, parentId;
+ ds >> engineId >> objectId >> parentId;
+ emit newObject(objectId);
return;
} else if (type == "SET_BINDING_R") {
ds >> m_valid;
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
index a64a77e13e..5d74f2d43c 100644
--- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
@@ -213,7 +213,7 @@ public:
bool valid() { return m_valid; }
signals:
- void newObjects();
+ void newObject(int objectId);
void valueChanged(QByteArray,QVariant);
void result();