diff options
author | Bea Lam <bea.lam@nokia.com> | 2011-07-28 16:10:46 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-28 10:04:08 +0200 |
commit | 43d940fd30ea4728664de393479438f54e888b32 (patch) | |
tree | cea5a67db0f2d9d468f3194dd3534e0d3d6c9e27 /tests/auto/declarative/qsglistview | |
parent | da0441aa30e1e10c1e0ac9a8cd305c1b6e63c111 (diff) |
Fix auto-repeat key navigation for GridView
Shouldn't set moveReason=SetIndex in key navigation. ListView didn't
do this in its keyPress implementation.
Added extra tests for GridView and ListView.
Task-number: QTBUG-20408
Change-Id: Iaf0f331d3ba4f037c5bbc0a41418dd656b5a3695
Reviewed-on: http://codereview.qt.nokia.com/2318
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qsglistview')
-rw-r--r-- | tests/auto/declarative/qsglistview/tst_qsglistview.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/declarative/qsglistview/tst_qsglistview.cpp b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp index 43efea268b..5ee13e8724 100644 --- a/tests/auto/declarative/qsglistview/tst_qsglistview.cpp +++ b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp @@ -1447,6 +1447,25 @@ void tst_QSGListView::currentIndex() QTest::keyClick(canvas, Qt::Key_Up); QCOMPARE(listview->currentIndex(), 0); + // hold down Key_Down + for (int i=0; i<model.count()-1; i++) { + QTest::simulateEvent(canvas, true, Qt::Key_Down, Qt::NoModifier, "", true); + QTRY_COMPARE(listview->currentIndex(), i+1); + } + QTest::keyRelease(canvas, Qt::Key_Down); + QTRY_COMPARE(listview->currentIndex(), model.count()-1); + QTRY_COMPARE(listview->contentY(), 280.0); + + // hold down Key_Up + for (int i=model.count()-1; i > 0; i--) { + QTest::simulateEvent(canvas, true, Qt::Key_Up, Qt::NoModifier, "", true); + QTRY_COMPARE(listview->currentIndex(), i-1); + } + QTest::keyRelease(canvas, Qt::Key_Up); + QTRY_COMPARE(listview->currentIndex(), 0); + QTRY_COMPARE(listview->contentY(), 0.0); + + // turn off auto highlight listview->setHighlightFollowsCurrentItem(false); QVERIFY(listview->highlightFollowsCurrentItem() == false); |