summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-10-08 04:34:48 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-10-08 04:34:48 (GMT)
commitfd2d104988955e4e94252abd8d90507aa33dc10d (patch)
treeaca06bee5ab2d1102665a4008ab07be0a8e6d9d0 /tests
parentebe12dbbda9c4f8921de010f21f3ede4e03942be (diff)
downloadQt-fd2d104988955e4e94252abd8d90507aa33dc10d.zip
Qt-fd2d104988955e4e94252abd8d90507aa33dc10d.tar.gz
Qt-fd2d104988955e4e94252abd8d90507aa33dc10d.tar.bz2
Test for QTBUG-13685
Task-number: QTBUG-13685
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeitem/data/keystest.qml1
-rw-r--r--tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp12
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeitem/data/keystest.qml b/tests/auto/declarative/qdeclarativeitem/data/keystest.qml
index 3927f42..9af6e9f 100644
--- a/tests/auto/declarative/qdeclarativeitem/data/keystest.qml
+++ b/tests/auto/declarative/qdeclarativeitem/data/keystest.qml
@@ -17,6 +17,7 @@ Item {
Item {
id: item2
+ visible: forwardeeVisible
Keys.onPressed: keysTestObject.forwardedKey(event.key)
Keys.onReleased: keysTestObject.forwardedKey(event.key)
}
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
index bbbf73e..b4903ae 100644
--- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
+++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
@@ -204,6 +204,7 @@ void tst_QDeclarativeItem::keys()
canvas->rootContext()->setContextProperty("keysTestObject", testObject);
canvas->rootContext()->setContextProperty("enableKeyHanding", QVariant(true));
+ canvas->rootContext()->setContextProperty("forwardeeVisible", QVariant(true));
canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keystest.qml"));
canvas->show();
@@ -287,6 +288,17 @@ void tst_QDeclarativeItem::keys()
testObject->reset();
+ canvas->rootContext()->setContextProperty("forwardeeVisible", QVariant(false));
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, "A", false, 1);
+ QApplication::sendEvent(canvas, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_A));
+ QCOMPARE(testObject->mForwardedKey, 0);
+ QCOMPARE(testObject->mText, QLatin1String("A"));
+ QVERIFY(testObject->mModifiers == Qt::NoModifier);
+ QVERIFY(!key.isAccepted());
+
+ testObject->reset();
+
canvas->rootContext()->setContextProperty("enableKeyHanding", QVariant(false));
QCOMPARE(canvas->rootObject()->property("isEnabled").toBool(), false);