summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-06-22 01:27:16 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-06-22 01:27:16 (GMT)
commit30b9cf0ff65bca3dbfddbd74cb21ec3eb68cbd88 (patch)
tree25a1b5ab4101c2eaaeb3f3dee9a60dc270d92e5d /tests
parent162dd1adb3e6369e85af09f34dc56b70eeb43f4c (diff)
downloadQt-30b9cf0ff65bca3dbfddbd74cb21ec3eb68cbd88.zip
Qt-30b9cf0ff65bca3dbfddbd74cb21ec3eb68cbd88.tar.gz
Qt-30b9cf0ff65bca3dbfddbd74cb21ec3eb68cbd88.tar.bz2
Fix anchor resetting and prevent illegal anchors.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/anchors/tst_anchors.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/declarative/anchors/tst_anchors.cpp b/tests/auto/declarative/anchors/tst_anchors.cpp
index abe6d96..4830169 100644
--- a/tests/auto/declarative/anchors/tst_anchors.cpp
+++ b/tests/auto/declarative/anchors/tst_anchors.cpp
@@ -17,6 +17,8 @@ private slots:
void basicAnchors();
void loops();
void illegalSets();
+ void reset();
+ void nullItem();
};
/*
@@ -154,6 +156,30 @@ void tst_anchors::illegalSets()
}
}
+void tst_anchors::reset()
+{
+ QFxItem *aItem = new QFxItem;
+ QFxAnchorLine anchor;
+ anchor.item = aItem;
+ anchor.anchorLine = QFxAnchorLine::Top;
+
+ QFxItem *item = new QFxItem;
+ item->anchors()->setBottom(anchor);
+ QCOMPARE(item->anchors()->usedAnchors().testFlag(QFxAnchors::HasBottomAnchor), true);
+
+ item->anchors()->resetBottom();
+ QCOMPARE(item->anchors()->usedAnchors().testFlag(QFxAnchors::HasBottomAnchor), false);
+}
+
+void tst_anchors::nullItem()
+{
+ QFxAnchorLine anchor;
+
+ QTest::ignoreMessage(QtWarningMsg, "QML QFxItem (unknown location): Can't anchor to a null item. ");
+ QFxItem *item = new QFxItem;
+ item->anchors()->setBottom(anchor);
+}
+
QTEST_MAIN(tst_anchors)
#include "tst_anchors.moc"