summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-12-21 01:11:59 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-12-21 01:12:38 (GMT)
commitbc679ceb8ad36de1da696f7f67e71145ceec7f98 (patch)
tree887dd425c07ca38fd67dfaacb1e0f0d6520bb2b8 /tests
parent66bc63292ca45fefce58fe427a2db480a6952e8d (diff)
downloadQt-bc679ceb8ad36de1da696f7f67e71145ceec7f98.zip
Qt-bc679ceb8ad36de1da696f7f67e71145ceec7f98.tar.gz
Qt-bc679ceb8ad36de1da696f7f67e71145ceec7f98.tar.bz2
More testing for KeyNavigation attached properties.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeitem/data/keynavigationtest.qml40
-rw-r--r--tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp5
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeitem/data/keynavigationtest.qml b/tests/auto/declarative/qdeclarativeitem/data/keynavigationtest.qml
index 229f969..f614a12 100644
--- a/tests/auto/declarative/qdeclarativeitem/data/keynavigationtest.qml
+++ b/tests/auto/declarative/qdeclarativeitem/data/keynavigationtest.qml
@@ -3,6 +3,46 @@ import QtQuick 1.0
Grid {
columns: 2
width: 100; height: 100
+ function verify() {
+ if (item1.KeyNavigation.right != item2)
+ return false;
+ if (item1.KeyNavigation.down != item3)
+ return false;
+ if (item1.KeyNavigation.tab != item2)
+ return false;
+ if (item1.KeyNavigation.backtab != item4)
+ return false;
+
+ if (item2.KeyNavigation.left != item1)
+ return false;
+ if (item2.KeyNavigation.down != item4)
+ return false;
+ if (item2.KeyNavigation.tab != item3)
+ return false;
+ if (item2.KeyNavigation.backtab != item1)
+ return false;
+
+ if (item3.KeyNavigation.right != item4)
+ return false;
+ if (item3.KeyNavigation.up != item1)
+ return false;
+ if (item3.KeyNavigation.tab != item4)
+ return false;
+ if (item3.KeyNavigation.backtab != item2)
+ return false;
+
+ if (item4.KeyNavigation.left != item3)
+ return false;
+ if (item4.KeyNavigation.up != item2)
+ return false;
+ if (item4.KeyNavigation.tab != item1)
+ return false;
+ if (item4.KeyNavigation.backtab != item3)
+ return false;
+
+ return true;
+ }
+
Rectangle {
id: item1
objectName: "item1"
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
index 711bf00..0ebb8b7 100644
--- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
+++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
@@ -393,6 +393,11 @@ void tst_QDeclarativeItem::keyNavigation()
QVERIFY(item);
QVERIFY(item->hasActiveFocus());
+ QVariant result;
+ QVERIFY(QMetaObject::invokeMethod(canvas->rootObject(), "verify",
+ Q_RETURN_ARG(QVariant, result)));
+ QVERIFY(result.toBool());
+
// right
QKeyEvent key(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1);
QApplication::sendEvent(canvas, &key);