aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
diff options
context:
space:
mode:
authorSimjees Abraham <simjees.abraham@nokia.com>2012-05-16 15:20:59 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-21 12:40:55 +0200
commitfe652f6cfb6b8eef57854e90ee6d8a9d51573722 (patch)
tree19b62756526bc85cb15c45920984680eb634efa0 /tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
parentd3ee501379c744206ce499a8f6697c7b547fdaeb (diff)
Qml : Resetting binding corrected
Resetting the binding for property corrected in case the property is nested (eg: font.bold) Task-number: QTCREATORBUG-6294 Change-Id: I39cca54c17860c4e6df1cf864cc2f70214d50c8f Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
Diffstat (limited to 'tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp')
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp61
1 files changed, 46 insertions, 15 deletions
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
index 3c57c36f96..b0070b718c 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -127,6 +127,7 @@ private slots:
void queryExpressionResultBC_data();
void setBindingForObject();
+ void resetBindingForObject();
void setMethodBody();
void queryObjectTree();
void setBindingInStates();
@@ -258,7 +259,7 @@ void tst_QQmlEngineDebugService::initTestCase()
"id: root\n"
"width: 10; height: 20; scale: blueRect.scale;"
"Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }"
- "Text { color: blueRect.color; }"
+ "Text { font.bold: true; color: blueRect.color; }"
"MouseArea {"
"onEntered: { console.log('hello') }"
"}"
@@ -886,20 +887,6 @@ void tst_QQmlEngineDebugService::setBindingForObject()
QCOMPARE(widthPropertyRef.binding, QString("height"));
//
- // reset
- //
- m_dbg->resetBindingForObject(rootObject.debugId, "width", &success);
- QVERIFY(success);
- QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
- QCOMPARE(m_dbg->valid(), true);
-
- rootObject = findRootObject();
- widthPropertyRef = findProperty(rootObject.properties, "width");
-
- // QCOMPARE(widthPropertyRef.value(), QVariant(0)); // TODO: Shouldn't this work?
- QCOMPARE(widthPropertyRef.binding, QString());
-
- //
// set handler
//
rootObject = findRootObject();
@@ -935,6 +922,50 @@ void tst_QQmlEngineDebugService::setBindingForObject()
QCOMPARE(onEnteredRef.value, QVariant("{console.log('hello, world') }"));
}
+void tst_QQmlEngineDebugService::resetBindingForObject()
+{
+ QmlDebugObjectReference rootObject = findRootObject();
+ QVERIFY(rootObject.debugId != -1);
+ QmlDebugPropertyReference widthPropertyRef = findProperty(rootObject.properties, "width");
+
+ bool success = false;
+
+ m_dbg->setBindingForObject(rootObject.debugId, "width", "15", true,
+ QString(), -1, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), true);
+
+ //
+ // reset
+ //
+ m_dbg->resetBindingForObject(rootObject.debugId, "width", &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), true);
+
+ rootObject = findRootObject();
+ widthPropertyRef = findProperty(rootObject.properties, "width");
+
+ QCOMPARE(widthPropertyRef.value, QVariant(0));
+ QCOMPARE(widthPropertyRef.binding, QString());
+
+ //
+ // reset nested property
+ //
+ success = false;
+ m_dbg->resetBindingForObject(rootObject.debugId, "font.bold", &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), true);
+
+ rootObject = findRootObject();
+ QmlDebugPropertyReference boldPropertyRef = findProperty(rootObject.properties, "font.bold");
+
+ QCOMPARE(boldPropertyRef.value.toBool(), false);
+ QCOMPARE(boldPropertyRef.binding, QString());
+}
+
void tst_QQmlEngineDebugService::setBindingInStates()
{
// Check if changing bindings of propertychanges works