summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/states
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2009-11-17 05:38:19 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2009-11-17 05:38:19 (GMT)
commitd4f2c30ba3ab70a3f40fb7699a6924c1155c83d3 (patch)
tree295b45bd4d125c58fd5bc34784c02f848feb3bda /tests/auto/declarative/states
parent9a5dd525723363dc4230595c85f4406f27d5c0f2 (diff)
parentf2cb8e0ec8b34044b41e3a2389edbd45f1828b8f (diff)
downloadQt-d4f2c30ba3ab70a3f40fb7699a6924c1155c83d3.zip
Qt-d4f2c30ba3ab70a3f40fb7699a6924c1155c83d3.tar.gz
Qt-d4f2c30ba3ab70a3f40fb7699a6924c1155c83d3.tar.bz2
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tests/auto/declarative/states')
-rw-r--r--tests/auto/declarative/states/data/anchorChanges3.qml29
-rw-r--r--tests/auto/declarative/states/tst_states.cpp28
2 files changed, 57 insertions, 0 deletions
diff --git a/tests/auto/declarative/states/data/anchorChanges3.qml b/tests/auto/declarative/states/data/anchorChanges3.qml
new file mode 100644
index 0000000..8a74595
--- /dev/null
+++ b/tests/auto/declarative/states/data/anchorChanges3.qml
@@ -0,0 +1,29 @@
+import Qt 4.6
+
+Rectangle {
+ id: container
+ width: 200; height: 200
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ color: "green";
+ anchors.left: parent.left
+ anchors.right: rightGuideline.left
+ anchors.top: topGuideline.top
+ anchors.bottom: container.bottom
+ }
+ Item { id: leftGuideline; x: 10 }
+ Item { id: rightGuideline; x: 150 }
+ Item { id: topGuideline; y: 10 }
+ Item { id: bottomGuideline; y: 150 }
+ states: State {
+ name: "reanchored"
+ AnchorChanges {
+ target: myRect;
+ left: leftGuideline.left
+ right: container.right
+ top: container.top
+ bottom: bottomGuideline.bottom
+ }
+ }
+}
diff --git a/tests/auto/declarative/states/tst_states.cpp b/tests/auto/declarative/states/tst_states.cpp
index 0e0a72a..1588d4c 100644
--- a/tests/auto/declarative/states/tst_states.cpp
+++ b/tests/auto/declarative/states/tst_states.cpp
@@ -488,6 +488,8 @@ void tst_states::anchorChanges()
rect->setState("");
QCOMPARE(innerRect->x(), qreal(5));
+
+ delete rect;
}
{
@@ -499,10 +501,36 @@ void tst_states::anchorChanges()
QVERIFY(innerRect != 0);
rect->setState("right");
+ QEXPECT_FAIL("", "QTBUG-5338", Continue);
QCOMPARE(innerRect->x(), qreal(150));
rect->setState("");
QCOMPARE(innerRect->x(), qreal(5));
+
+ delete rect;
+ }
+
+ {
+ QmlComponent rectComponent(&engine, SRCDIR "/data/anchorChanges3.qml");
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"));
+ QVERIFY(innerRect != 0);
+
+ rect->setState("reanchored");
+ QCOMPARE(innerRect->x(), qreal(10));
+ QCOMPARE(innerRect->y(), qreal(0));
+ QCOMPARE(innerRect->width(), qreal(190));
+ QCOMPARE(innerRect->height(), qreal(150));
+
+ rect->setState("");
+ QCOMPARE(innerRect->x(), qreal(0));
+ QCOMPARE(innerRect->y(), qreal(10));
+ QCOMPARE(innerRect->width(), qreal(150));
+ QCOMPARE(innerRect->height(), qreal(190));
+
+ delete rect;
}
}