summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeitem
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qdeclarativeitem')
-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);