diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/anchors/data/illegal1.qml | 10 | ||||
-rw-r--r-- | tests/auto/declarative/anchors/data/illegal2.qml | 11 | ||||
-rw-r--r-- | tests/auto/declarative/anchors/data/illegal3.qml | 10 | ||||
-rw-r--r-- | tests/auto/declarative/anchors/tst_anchors.cpp | 43 |
4 files changed, 74 insertions, 0 deletions
diff --git a/tests/auto/declarative/anchors/data/illegal1.qml b/tests/auto/declarative/anchors/data/illegal1.qml new file mode 100644 index 0000000..635bf95 --- /dev/null +++ b/tests/auto/declarative/anchors/data/illegal1.qml @@ -0,0 +1,10 @@ +Rect { + id: rect + width: 120; height: 200; color: "white" + Rect { id: TheRect; width: 100; height: 100 } + Rect { + anchors.left: TheRect.left + anchors.right: TheRect.right + anchors.horizontalCenter: TheRect.horizontalCenter + } +} diff --git a/tests/auto/declarative/anchors/data/illegal2.qml b/tests/auto/declarative/anchors/data/illegal2.qml new file mode 100644 index 0000000..425d0e4 --- /dev/null +++ b/tests/auto/declarative/anchors/data/illegal2.qml @@ -0,0 +1,11 @@ +Rect { + id: rect + width: 120; height: 200; color: "white" + Text { id: Text1; text: "Hello" } + Text { + id: Text2; + anchors.baseline: Text1.baseline; + anchors.top: Text1.top; + text: "World" + } +} diff --git a/tests/auto/declarative/anchors/data/illegal3.qml b/tests/auto/declarative/anchors/data/illegal3.qml new file mode 100644 index 0000000..fa48b78 --- /dev/null +++ b/tests/auto/declarative/anchors/data/illegal3.qml @@ -0,0 +1,10 @@ +Rect { + id: rect + width: 120; height: 200; color: "white" + Item { + Rect { id: TheRect; width: 100; height: 100 } + } + Rect { + anchors.left: TheRect.left + } +} diff --git a/tests/auto/declarative/anchors/tst_anchors.cpp b/tests/auto/declarative/anchors/tst_anchors.cpp index 8087d6e..587b4ab 100644 --- a/tests/auto/declarative/anchors/tst_anchors.cpp +++ b/tests/auto/declarative/anchors/tst_anchors.cpp @@ -16,6 +16,7 @@ public: private slots: void basicAnchors(); void loops(); + void illegalSets(); }; /* @@ -118,6 +119,48 @@ void tst_anchors::loops() } } +void tst_anchors::illegalSets() +{ + { + QFxView *view = new QFxView; + + view->setUrl(QUrl("file://" SRCDIR "/data/illegal1.qml")); + + //### ignoreMessage doesn't seem to work + //QTest::ignoreMessage(QtWarningMsg, "QML QFxRect (unknown location): Can't specify left, right, and hcenter anchors."); + view->execute(); + qApp->processEvents(); + + delete view; + } + + { + QFxView *view = new QFxView; + + view->setUrl(QUrl("file://" SRCDIR "/data/illegal2.qml")); + + //### ignoreMessage doesn't seem to work here + //QTest::ignoreMessage(QtWarningMsg, "QML QFxText (unknown location): Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors."); + view->execute(); + //qApp->processEvents(); + + delete view; + } + + { + QFxView *view = new QFxView; + + view->setUrl(QUrl("file://" SRCDIR "/data/illegal3.qml")); + + //### ignoreMessage doesn't seem to work here + //QTest::ignoreMessage(QtWarningMsg, "Can't anchor to an item that isn't a parent or sibling."); + view->execute(); + qApp->processEvents(); + + delete view; + } +} + QTEST_MAIN(tst_anchors) #include "tst_anchors.moc" |