summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtreeview/tst_qtreeview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qtreeview/tst_qtreeview.cpp')
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index 2de189d..75a4c62 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -215,6 +215,7 @@ private slots:
void addRowsWhileSectionsAreHidden();
void filterProxyModelCrash();
void styleOptionViewItem();
+ void keyboardNavigationWithDisabled();
// task-specific tests:
void task174627_moveLeftToRoot();
@@ -3753,5 +3754,36 @@ void tst_QTreeView::taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint()
QTRY_VERIFY(view.painted > 0);
}
+void tst_QTreeView::keyboardNavigationWithDisabled()
+{
+ QTreeView view;
+ QStandardItemModel model(90, 0);
+ for (int i = 0; i < 90; i ++) {
+ model.setItem(i, new QStandardItem(QString::number(i)));
+ model.item(i)->setEnabled(i%6 == 0);
+ }
+ view.setModel(&model);
+
+ view.resize(200, view.visualRect(model.index(0,0)).height()*10);
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_VERIFY(view.isActiveWindow());
+
+ view.setCurrentIndex(model.index(1, 0));
+ QTest::keyClick(view.viewport(), Qt::Key_Up);
+ QCOMPARE(view.currentIndex(), model.index(0, 0));
+ QTest::keyClick(view.viewport(), Qt::Key_Down);
+ QCOMPARE(view.currentIndex(), model.index(6, 0));
+ QTest::keyClick(view.viewport(), Qt::Key_PageDown);
+ QCOMPARE(view.currentIndex(), model.index(18, 0));
+ QTest::keyClick(view.viewport(), Qt::Key_Down);
+ QCOMPARE(view.currentIndex(), model.index(24, 0));
+ QTest::keyClick(view.viewport(), Qt::Key_PageUp);
+ QCOMPARE(view.currentIndex(), model.index(12, 0));
+ QTest::keyClick(view.viewport(), Qt::Key_Up);
+ QCOMPARE(view.currentIndex(), model.index(6, 0));
+}
+
QTEST_MAIN(tst_QTreeView)
#include "tst_qtreeview.moc"