summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-03-25 05:01:30 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-03-25 05:11:08 (GMT)
commitd373f8b8ee0a5841bcdb264b0b01b262c15e7f89 (patch)
tree5d995b987facc53c2a74ce419fa37708b7987017 /tests/auto/declarative
parentf20433bb8b72589fff27ec66f2e283b2f48fb019 (diff)
downloadQt-d373f8b8ee0a5841bcdb264b0b01b262c15e7f89.zip
Qt-d373f8b8ee0a5841bcdb264b0b01b262c15e7f89.tar.gz
Qt-d373f8b8ee0a5841bcdb264b0b01b262c15e7f89.tar.bz2
Update AnchorChanges to use more natural form for setting anchors.
Instead of specifying left, right, etc directly, we keep the regular syntax and specify anchors.left, anchors.right, etc. Also get rid of the hacky "reset" string property and use undefined to reset (like PropertyChanges).
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r--tests/auto/declarative/qdeclarativestates/data/anchorChanges1.qml4
-rw-r--r--tests/auto/declarative/qdeclarativestates/data/anchorChanges2.qml4
-rw-r--r--tests/auto/declarative/qdeclarativestates/data/anchorChanges3.qml8
-rw-r--r--tests/auto/declarative/qdeclarativestates/data/anchorChanges4.qml4
-rw-r--r--tests/auto/declarative/qdeclarativestates/data/anchorChanges5.qml4
-rw-r--r--tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp38
-rw-r--r--tests/auto/declarative/visual/animation/reanchor/reanchor.qml15
7 files changed, 39 insertions, 38 deletions
diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorChanges1.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChanges1.qml
index 7dce889..5443e54 100644
--- a/tests/auto/declarative/qdeclarativestates/data/anchorChanges1.qml
+++ b/tests/auto/declarative/qdeclarativestates/data/anchorChanges1.qml
@@ -16,8 +16,8 @@ Rectangle {
AnchorChanges {
id: ancCh
target: myRect;
- reset: "left"
- right: container.right
+ anchors.left: undefined
+ anchors.right: container.right
}
}
}
diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorChanges2.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChanges2.qml
index 545345e..56de560 100644
--- a/tests/auto/declarative/qdeclarativestates/data/anchorChanges2.qml
+++ b/tests/auto/declarative/qdeclarativestates/data/anchorChanges2.qml
@@ -14,8 +14,8 @@ Rectangle {
name: "right"
AnchorChanges {
target: myRect;
- reset: "left"
- right: parent.right
+ anchors.left: undefined
+ anchors.right: parent.right
}
}
}
diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorChanges3.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChanges3.qml
index 9d5b317..59c3c06 100644
--- a/tests/auto/declarative/qdeclarativestates/data/anchorChanges3.qml
+++ b/tests/auto/declarative/qdeclarativestates/data/anchorChanges3.qml
@@ -20,10 +20,10 @@ Rectangle {
name: "reanchored"
AnchorChanges {
target: myRect;
- left: leftGuideline.left
- right: container.right
- top: container.top
- bottom: bottomGuideline.bottom
+ anchors.left: leftGuideline.left
+ anchors.right: container.right
+ anchors.top: container.top
+ anchors.bottom: bottomGuideline.bottom
}
}
}
diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorChanges4.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChanges4.qml
index f128989..7e3ba1c 100644
--- a/tests/auto/declarative/qdeclarativestates/data/anchorChanges4.qml
+++ b/tests/auto/declarative/qdeclarativestates/data/anchorChanges4.qml
@@ -15,8 +15,8 @@ Rectangle {
name: "reanchored"
AnchorChanges {
target: myRect;
- horizontalCenter: bottomGuideline.horizontalCenter
- verticalCenter: leftGuideline.verticalCenter
+ anchors.horizontalCenter: bottomGuideline.horizontalCenter
+ anchors.verticalCenter: leftGuideline.verticalCenter
}
}
}
diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorChanges5.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChanges5.qml
index 4e6d34b..b85a922 100644
--- a/tests/auto/declarative/qdeclarativestates/data/anchorChanges5.qml
+++ b/tests/auto/declarative/qdeclarativestates/data/anchorChanges5.qml
@@ -15,8 +15,8 @@ Rectangle {
name: "reanchored"
AnchorChanges {
target: myRect;
- horizontalCenter: bottomGuideline.horizontalCenter
- baseline: leftGuideline.baseline
+ anchors.horizontalCenter: bottomGuideline.horizontalCenter
+ anchors.baseline: leftGuideline.baseline
}
}
}
diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
index 91883c9..2ab21a4 100644
--- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
+++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
@@ -564,10 +564,10 @@ void tst_qdeclarativestates::anchorChanges()
rect->setState("right");
QCOMPARE(innerRect->x(), qreal(150));
- QCOMPARE(aChanges->reset(), QString("left"));
+ QCOMPARE(aChanges->anchors()->left().anchorLine, QDeclarativeAnchorLine::Invalid); //### was reset (how do we distinguish from not set at all)
QCOMPARE(aChanges->object(), qobject_cast<QDeclarativeItem*>(innerRect));
- QCOMPARE(aChanges->right().item, rect->right().item);
- QCOMPARE(aChanges->right().anchorLine, rect->right().anchorLine);
+ QCOMPARE(aChanges->anchors()->right().item, rect->right().item);
+ QCOMPARE(aChanges->anchors()->right().anchorLine, rect->right().anchorLine);
rect->setState("");
QCOMPARE(innerRect->x(), qreal(5));
@@ -623,14 +623,14 @@ void tst_qdeclarativestates::anchorChanges3()
rect->setState("reanchored");
QCOMPARE(aChanges->object(), qobject_cast<QDeclarativeItem*>(innerRect));
- QCOMPARE(aChanges->left().item, leftGuideline->left().item);
- QCOMPARE(aChanges->left().anchorLine, leftGuideline->left().anchorLine);
- QCOMPARE(aChanges->right().item, rect->right().item);
- QCOMPARE(aChanges->right().anchorLine, rect->right().anchorLine);
- QCOMPARE(aChanges->top().item, rect->top().item);
- QCOMPARE(aChanges->top().anchorLine, rect->top().anchorLine);
- QCOMPARE(aChanges->bottom().item, bottomGuideline->bottom().item);
- QCOMPARE(aChanges->bottom().anchorLine, bottomGuideline->bottom().anchorLine);
+ QCOMPARE(aChanges->anchors()->left().item, leftGuideline->left().item);
+ QCOMPARE(aChanges->anchors()->left().anchorLine, leftGuideline->left().anchorLine);
+ QCOMPARE(aChanges->anchors()->right().item, rect->right().item);
+ QCOMPARE(aChanges->anchors()->right().anchorLine, rect->right().anchorLine);
+ QCOMPARE(aChanges->anchors()->top().item, rect->top().item);
+ QCOMPARE(aChanges->anchors()->top().anchorLine, rect->top().anchorLine);
+ QCOMPARE(aChanges->anchors()->bottom().item, bottomGuideline->bottom().item);
+ QCOMPARE(aChanges->anchors()->bottom().anchorLine, bottomGuideline->bottom().anchorLine);
QCOMPARE(innerRect->x(), qreal(10));
QCOMPARE(innerRect->y(), qreal(0));
@@ -673,10 +673,10 @@ void tst_qdeclarativestates::anchorChanges4()
rect->setState("reanchored");
QCOMPARE(aChanges->object(), qobject_cast<QDeclarativeItem*>(innerRect));
- QCOMPARE(aChanges->horizontalCenter().item, bottomGuideline->horizontalCenter().item);
- QCOMPARE(aChanges->horizontalCenter().anchorLine, bottomGuideline->horizontalCenter().anchorLine);
- QCOMPARE(aChanges->verticalCenter().item, leftGuideline->verticalCenter().item);
- QCOMPARE(aChanges->verticalCenter().anchorLine, leftGuideline->verticalCenter().anchorLine);
+ QCOMPARE(aChanges->anchors()->horizontalCenter().item, bottomGuideline->horizontalCenter().item);
+ QCOMPARE(aChanges->anchors()->horizontalCenter().anchorLine, bottomGuideline->horizontalCenter().anchorLine);
+ QCOMPARE(aChanges->anchors()->verticalCenter().item, leftGuideline->verticalCenter().item);
+ QCOMPARE(aChanges->anchors()->verticalCenter().anchorLine, leftGuideline->verticalCenter().anchorLine);
delete rect;
}
@@ -708,10 +708,10 @@ void tst_qdeclarativestates::anchorChanges5()
rect->setState("reanchored");
QCOMPARE(aChanges->object(), qobject_cast<QDeclarativeItem*>(innerRect));
- QCOMPARE(aChanges->horizontalCenter().item, bottomGuideline->horizontalCenter().item);
- QCOMPARE(aChanges->horizontalCenter().anchorLine, bottomGuideline->horizontalCenter().anchorLine);
- QCOMPARE(aChanges->baseline().item, leftGuideline->baseline().item);
- QCOMPARE(aChanges->baseline().anchorLine, leftGuideline->baseline().anchorLine);
+ QCOMPARE(aChanges->anchors()->horizontalCenter().item, bottomGuideline->horizontalCenter().item);
+ QCOMPARE(aChanges->anchors()->horizontalCenter().anchorLine, bottomGuideline->horizontalCenter().anchorLine);
+ QCOMPARE(aChanges->anchors()->baseline().item, leftGuideline->baseline().item);
+ QCOMPARE(aChanges->anchors()->baseline().anchorLine, leftGuideline->baseline().anchorLine);
delete rect;
}
diff --git a/tests/auto/declarative/visual/animation/reanchor/reanchor.qml b/tests/auto/declarative/visual/animation/reanchor/reanchor.qml
index e41a254..1d0495e 100644
--- a/tests/auto/declarative/visual/animation/reanchor/reanchor.qml
+++ b/tests/auto/declarative/visual/animation/reanchor/reanchor.qml
@@ -36,18 +36,19 @@ Rectangle {
name: "reanchored"
AnchorChanges {
target: myRect;
- left: leftGuideline.left
- right: container.right
- top: container.top
- bottom: bottomGuideline.bottom
+ anchors.left: leftGuideline.left
+ anchors.right: container.right
+ anchors.top: container.top
+ anchors.bottom: bottomGuideline.bottom
}
}, State {
name: "reanchored2"
AnchorChanges {
target: myRect;
- reset: "left, right"
- top: topGuideline2.top
- bottom: bottomGuideline2.bottom
+ anchors.left: undefined
+ anchors.right: undefined
+ anchors.top: topGuideline2.top
+ anchors.bottom: bottomGuideline2.bottom
}
}]