summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-05-22 00:32:16 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-05-22 00:37:31 (GMT)
commit61943383ccff409d60d9837d58e4372dc6f22f23 (patch)
treeb030d569a1c4a31a20b87c3b0b80f4ee6d2fec7a /tests
parent942ea5202d4a329376c27015b07406c2018437ff (diff)
downloadQt-61943383ccff409d60d9837d58e4372dc6f22f23.zip
Qt-61943383ccff409d60d9837d58e4372dc6f22f23.tar.gz
Qt-61943383ccff409d60d9837d58e4372dc6f22f23.tar.bz2
Add support for baseline anchoring.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/anchors/data/illegal1.qml10
-rw-r--r--tests/auto/declarative/anchors/data/illegal2.qml11
-rw-r--r--tests/auto/declarative/anchors/data/illegal3.qml10
-rw-r--r--tests/auto/declarative/anchors/tst_anchors.cpp43
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"