diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-05-24 23:58:54 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-05-24 23:58:54 (GMT) |
commit | 19038ba0847d3b8ed476d8c3c1d29332d4f80677 (patch) | |
tree | 0374a25291e47d576dc9c45ef43acd7d830195cc /tests/auto/declarative | |
parent | 641c7cbdc52f84c07cf5bb628840bd6072e64764 (diff) | |
parent | bfff04ba4fab92e1cfa57954c9df2d3b5ed807ef (diff) | |
download | Qt-19038ba0847d3b8ed476d8c3c1d29332d4f80677.zip Qt-19038ba0847d3b8ed476d8c3c1d29332d4f80677.tar.gz Qt-19038ba0847d3b8ed476d8c3c1d29332d4f80677.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tests/auto/declarative')
-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 | ||||
-rw-r--r-- | tests/auto/declarative/qmlparser/testtypes.h | 2 |
5 files changed, 75 insertions, 1 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" diff --git a/tests/auto/declarative/qmlparser/testtypes.h b/tests/auto/declarative/qmlparser/testtypes.h index c1f85b9..e124631 100644 --- a/tests/auto/declarative/qmlparser/testtypes.h +++ b/tests/auto/declarative/qmlparser/testtypes.h @@ -66,7 +66,7 @@ public: MyInterface *interface() const { return m_interface; } void setInterface(MyInterface *iface) { m_interface = iface; } - static QObject *qmlAttachedProperties(QObject *other) { + static MyQmlObject *qmlAttachedProperties(QObject *other) { MyQmlObject *rv = new MyQmlObject; rv->setParent(other); return rv; |