aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativebehaviors
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2011-11-08 08:35:55 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-09 01:23:33 +0100
commit26ec7d7e407fd1b55f69d63833a3ee8af4479d85 (patch)
tree1de05ec9fe5f9352b7afa0872cb0105d8386ed68 /tests/auto/declarative/qdeclarativebehaviors
parent9eca40d0dac8f5ac3f7ccf4c998e44395084adfc (diff)
Property changes in Component.onCompleted should trigger Behaviors.
Task-number: QTBUG-22555 Change-Id: Ieffb8037d7289113ea4f629ba3b578a845d2cb28 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativebehaviors')
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/startOnCompleted.qml15
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp20
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/startOnCompleted.qml b/tests/auto/declarative/qdeclarativebehaviors/data/startOnCompleted.qml
new file mode 100644
index 0000000000..fdc3779a5c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/startOnCompleted.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ id: innerRect
+ width: 100; height: 100
+ color: "green"
+ Behavior on x { NumberAnimation {} }
+ }
+
+ Component.onCompleted: innerRect.x = 100
+}
diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
index b6e68d6677..e84cd580ce 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
+++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
@@ -77,6 +77,7 @@ private slots:
void runningTrue();
void sameValue();
void delayedRegistration();
+ void startOnCompleted();
};
void tst_qdeclarativebehaviors::simpleBehavior()
@@ -432,6 +433,25 @@ void tst_qdeclarativebehaviors::delayedRegistration()
QTRY_COMPARE(innerRect->property("x").toInt(), int(100));
}
+//QTBUG-22555
+void tst_qdeclarativebehaviors::startOnCompleted()
+{
+ QDeclarativeEngine engine;
+
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("startOnCompleted.qml")));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QQuickItem *innerRect = rect->findChild<QQuickRectangle*>();
+ QVERIFY(innerRect != 0);
+
+ QCOMPARE(innerRect->property("x").toInt(), int(0));
+
+ QTRY_COMPARE(innerRect->property("x").toInt(), int(100));
+
+ delete rect;
+}
+
QTEST_MAIN(tst_qdeclarativebehaviors)
#include "tst_qdeclarativebehaviors.moc"