diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2012-05-29 09:50:13 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-29 08:55:09 +0200 |
commit | 18eba786347c42e0c1c9a2a5f8331624f1779920 (patch) | |
tree | 5d6593274f7d43d203b572ec77a4cd4ac2900842 /tests/auto/quick/qquickgridview/tst_qquickgridview.cpp | |
parent | 9064de5692c83139aa3730ac6f8684c9402ae5db (diff) |
Fix nested GridView key navigation with a single row or column.
Don't ignore key events when the currentIndex is unchanged due to
wrapping.
.
Task-number: QTBUG-21999
Change-Id: Idc82d472ca7ec495669207761bfe7de58b8781f9
Reviewed-by: Bea Lam <bea.lam@nokia.com>
Diffstat (limited to 'tests/auto/quick/qquickgridview/tst_qquickgridview.cpp')
-rw-r--r-- | tests/auto/quick/qquickgridview/tst_qquickgridview.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index 04cc79de96..235c29f5a4 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -2027,6 +2027,25 @@ void tst_QQuickGridView::keyNavigation() QTRY_COMPARE(gridview->contentX(), contentPosAtFirstItem.x()); QTRY_COMPARE(gridview->contentY(), contentPosAtFirstItem.y()); + // Test key press still accepted when position wraps to same index. + canvas->rootObject()->setProperty("lastKey", 0); + model.removeItems(1, model.count() - 1); + + QTest::keyClick(canvas, backwardsKey); + QCOMPARE(canvas->rootObject()->property("lastKey").toInt(), 0); + + QTest::keyClick(canvas, forwardsKey); + QCOMPARE(canvas->rootObject()->property("lastKey").toInt(), 0); + + // Test key press not accepted at limits when wrap is disabled. + gridview->setWrapEnabled(false); + + QTest::keyClick(canvas, backwardsKey); + QCOMPARE(canvas->rootObject()->property("lastKey").toInt(), int(backwardsKey)); + + QTest::keyClick(canvas, forwardsKey); + QCOMPARE(canvas->rootObject()->property("lastKey").toInt(), int(forwardsKey)); + releaseView(canvas); } |