diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2012-02-17 12:42:29 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-20 07:35:01 +0100 |
commit | 69ab984ac69fe3a10656e488fe354165b5aa550e (patch) | |
tree | ba1de00f60a85fd99f99947063fe58d4cfdce263 /tests/auto/qtquick2 | |
parent | 5e0e4ca462d2431c85e4c14d9cc90401d47296cc (diff) |
Improve test coverage for AnchorChanges.
Change-Id: If6d62febed093a07d75a6125a920aac628c35e54
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
Diffstat (limited to 'tests/auto/qtquick2')
-rw-r--r-- | tests/auto/qtquick2/qdeclarativestates/tst_qdeclarativestates.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/auto/qtquick2/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/qtquick2/qdeclarativestates/tst_qdeclarativestates.cpp index 008d802825..391a4f7cfe 100644 --- a/tests/auto/qtquick2/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/qtquick2/qdeclarativestates/tst_qdeclarativestates.cpp @@ -679,6 +679,9 @@ void tst_qdeclarativestates::anchorChanges() QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0)); QVERIFY(aChanges != 0); + QCOMPARE(aChanges->anchors()->left().script(), QLatin1String("undefined")); + QCOMPARE(aChanges->anchors()->right().script(), QLatin1String("container.right")); + rectPrivate->setState("right"); QCOMPARE(innerRect->x(), qreal(150)); QCOMPARE(aChanges->object(), qobject_cast<QQuickItem*>(innerRect)); @@ -739,6 +742,9 @@ void tst_qdeclarativestates::anchorChanges3() QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0)); QVERIFY(aChanges != 0); + QCOMPARE(aChanges->anchors()->top().script(), QLatin1String("container.top")); + QCOMPARE(aChanges->anchors()->bottom().script(), QLatin1String("bottomGuideline.bottom")); + rectPrivate->setState("reanchored"); QCOMPARE(aChanges->object(), qobject_cast<QQuickItem*>(innerRect)); QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->left().item, QQuickItemPrivate::get(leftGuideline)->left().item); @@ -789,6 +795,9 @@ void tst_qdeclarativestates::anchorChanges4() QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0)); QVERIFY(aChanges != 0); + QCOMPARE(aChanges->anchors()->horizontalCenter().script(), QLatin1String("bottomGuideline.horizontalCenter")); + QCOMPARE(aChanges->anchors()->verticalCenter().script(), QLatin1String("leftGuideline.verticalCenter")); + QQuickItemPrivate::get(rect)->setState("reanchored"); QCOMPARE(aChanges->object(), qobject_cast<QQuickItem*>(innerRect)); QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->horizontalCenter().item, QQuickItemPrivate::get(bottomGuideline)->horizontalCenter().item); @@ -824,12 +833,14 @@ void tst_qdeclarativestates::anchorChanges5() QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0)); QVERIFY(aChanges != 0); + QCOMPARE(aChanges->anchors()->baseline().script(), QLatin1String("leftGuideline.baseline")); + QQuickItemPrivate::get(rect)->setState("reanchored"); QCOMPARE(aChanges->object(), qobject_cast<QQuickItem*>(innerRect)); - //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); + QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->horizontalCenter().item, QQuickItemPrivate::get(bottomGuideline)->horizontalCenter().item); + QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->horizontalCenter().anchorLine, QQuickItemPrivate::get(bottomGuideline)->horizontalCenter().anchorLine); + QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->baseline().item, QQuickItemPrivate::get(leftGuideline)->baseline().item); + QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->baseline().anchorLine, QQuickItemPrivate::get(leftGuideline)->baseline().anchorLine); delete rect; } |