diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-03-05 03:51:10 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-03-05 03:51:10 (GMT) |
commit | 48fd47f64f3f73e82016161d82cdf67908a9c653 (patch) | |
tree | e337d89e525d3a55d2b9aca8c19d2b3b43c65c50 /tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp | |
parent | a7b46bda37a428ae2e5554aa8e58469c92b310a9 (diff) | |
parent | c9b3309ae1d3a34790d71fdfd7dcaab79433f049 (diff) | |
download | Qt-48fd47f64f3f73e82016161d82cdf67908a9c653.zip Qt-48fd47f64f3f73e82016161d82cdf67908a9c653.tar.gz Qt-48fd47f64f3f73e82016161d82cdf67908a9c653.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Conflicts:
tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
Diffstat (limited to 'tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index 5549a3e..bbcc86e 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -178,6 +178,26 @@ void tst_QDeclarativeItem::keys() testObject->reset(); + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QCOMPARE(testObject->mKey, int(Qt::Key_Tab)); + QCOMPARE(testObject->mForwardedKey, int(Qt::Key_Tab)); + QCOMPARE(testObject->mText, QLatin1String("Tab")); + QVERIFY(testObject->mModifiers == Qt::NoModifier); + QVERIFY(key.isAccepted()); + + testObject->reset(); + + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QCOMPARE(testObject->mKey, int(Qt::Key_Backtab)); + QCOMPARE(testObject->mForwardedKey, int(Qt::Key_Backtab)); + QCOMPARE(testObject->mText, QLatin1String("Backtab")); + QVERIFY(testObject->mModifiers == Qt::NoModifier); + QVERIFY(key.isAccepted()); + + testObject->reset(); + canvas->rootContext()->setContextProperty("enableKeyHanding", QVariant(false)); key = QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier, "", false, 1); @@ -243,6 +263,24 @@ void tst_QDeclarativeItem::keyNavigation() QVERIFY(item); QVERIFY(item->hasFocus()); + // tab + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QVERIFY(key.isAccepted()); + + item = findItem<QDeclarativeItem>(canvas->rootObject(), "item2"); + QVERIFY(item); + QVERIFY(item->hasFocus()); + + // backtab + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QVERIFY(key.isAccepted()); + + item = findItem<QDeclarativeItem>(canvas->rootObject(), "item1"); + QVERIFY(item); + QVERIFY(item->hasFocus()); + delete canvas; } |