aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
diff options
context:
space:
mode:
authorAurindam Jana <aurindam.jana@nokia.com>2012-05-09 11:30:27 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-09 12:23:11 +0200
commitc6c3673143ee1ceef686a014373bd99da1bddabd (patch)
tree149895f624257f3050cef2e45509805c0959dc54 /tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
parente211cedddefb7c7d29987d63cc2dac6491ec7ce6 (diff)
QQmlEngineDebugService: Query Expression
If the scope object is null or if there no QML context for the scope object, try to use the root context of the engine. Change-Id: I0068ea36f18a179b44791b81a2f6b8ec5423f615 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Diffstat (limited to 'tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp')
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
index cc1193b0f1..17b22b43a2 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -120,6 +120,9 @@ private slots:
void queryObject_data();
void queryExpressionResult();
void queryExpressionResult_data();
+ void queryExpressionResultInRootContext();
+ void queryExpressionResultBC();
+ void queryExpressionResultBC_data();
void setBindingForObject();
void setMethodBody();
@@ -721,6 +724,53 @@ void tst_QQmlEngineDebugService::queryExpressionResult_data()
QTest::newRow("varObjMap") << "varObjMap" << qVariantFromValue(map);
}
+void tst_QQmlEngineDebugService::queryExpressionResultInRootContext()
+{
+ bool success;
+ const QString exp = QLatin1String("1");
+ m_dbg->queryExpressionResult(-1, exp, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ QCOMPARE(m_dbg->resultExpr().toString(), exp);
+}
+
+void tst_QQmlEngineDebugService::queryExpressionResultBC()
+{
+ QFETCH(QString, expr);
+ QFETCH(QVariant, result);
+
+ int objectId = findRootObject().debugId;
+
+ bool success;
+
+ QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0);
+ unconnected->queryExpressionResultBC(objectId, expr, &success);
+ QVERIFY(!success);
+ delete unconnected;
+
+ m_dbg->queryExpressionResultBC(objectId, expr, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ QCOMPARE(m_dbg->resultExpr(), result);
+}
+
+void tst_QQmlEngineDebugService::queryExpressionResultBC_data()
+{
+ QTest::addColumn<QString>("expr");
+ QTest::addColumn<QVariant>("result");
+
+ QTest::newRow("width + 50") << "width + 50" << qVariantFromValue(60);
+ QTest::newRow("blueRect.width") << "blueRect.width" << qVariantFromValue(500);
+ QTest::newRow("bad expr") << "aeaef" << qVariantFromValue(QString("<undefined>"));
+ QTest::newRow("QObject*") << "varObj" << qVariantFromValue(QString("<unnamed object>"));
+ QTest::newRow("list of QObject*") << "varObjList" << qVariantFromValue(QString("<unknown value>"));
+ QVariantMap map;
+ map.insert(QLatin1String("rect"), QVariant(QLatin1String("<unnamed object>")));
+ QTest::newRow("varObjMap") << "varObjMap" << qVariantFromValue(map);
+}
+
void tst_QQmlEngineDebugService::setBindingForObject()
{
QmlDebugObjectReference rootObject = findRootObject();