summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-05-05 15:03:09 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-05-05 18:22:40 (GMT)
commit5443871a89e01c8d8a8440f7786a24ea87922106 (patch)
tree90d06a6bbb1ce57e77b3cbc134006e199baba68d /tests
parent98d485b54d2da97b83b7ff2379b31039923f922e (diff)
downloadQt-5443871a89e01c8d8a8440f7786a24ea87922106.zip
Qt-5443871a89e01c8d8a8440f7786a24ea87922106.tar.gz
Qt-5443871a89e01c8d8a8440f7786a24ea87922106.tar.bz2
Accept the event when doing keyboard search on a itemview.
This is required for KHTML Patch by David Faure (the test is not really related) Reviewed-by: Thierry Task-number: 252912
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qlistview/tst_qlistview.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp
index c372475..791a472 100644
--- a/tests/auto/qlistview/tst_qlistview.cpp
+++ b/tests/auto/qlistview/tst_qlistview.cpp
@@ -106,6 +106,7 @@ private slots:
void task228566_infiniteRelayout();
void task248430_crashWith0SizedItem();
void task250446_scrollChanged();
+ void keyboardSearch();
};
// Testing get/set functions
@@ -1555,6 +1556,30 @@ void tst_QListView::task250446_scrollChanged()
QCOMPARE(view.currentIndex(), index);
}
+void tst_QListView::keyboardSearch()
+{
+ QStringList items;
+ items << "AB" << "AC" << "BA" << "BB" << "BD" << "KAFEINE" << "KONQUEROR" << "KOPETE" << "KOOKA" << "OKULAR";
+ QStringListModel model(items);
+
+ QListView view;
+ view.setModel(&model);
+ view.show();
+ QTest::qWait(30);
+// QCOMPARE(view.currentIndex() , model.index(0,0));
+
+ QTest::keyClick(&view, Qt::Key_K);
+ QTest::qWait(10);
+ QCOMPARE(view.currentIndex() , model.index(5,0)); //KAFEINE
+
+ QTest::keyClick(&view, Qt::Key_O);
+ QTest::qWait(10);
+ QCOMPARE(view.currentIndex() , model.index(6,0)); //KONQUEROR
+
+ QTest::keyClick(&view, Qt::Key_N);
+ QTest::qWait(10);
+ QCOMPARE(view.currentIndex() , model.index(6,0)); //KONQUEROR
+}
QTEST_MAIN(tst_QListView)
#include "tst_qlistview.moc"