summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtreeview
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2010-04-06 14:48:59 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2010-04-07 08:38:53 (GMT)
commite56af88f159ceee5f9613ab57b2358601e79c081 (patch)
tree9920af48eccfafb9f5b8f3647a1d83c7f5492ab4 /tests/auto/qtreeview
parent1ba21662a208dc50cd2d7c47fa4cdd3dd07c1617 (diff)
downloadQt-e56af88f159ceee5f9613ab57b2358601e79c081.zip
Qt-e56af88f159ceee5f9613ab57b2358601e79c081.tar.gz
Qt-e56af88f159ceee5f9613ab57b2358601e79c081.tar.bz2
QTreeView: fix PageUp/PageDown with disabled items.
The problem was seen in Qt Creator (in the 'Sources' tab of the debugger). Same logic as in above() and bellow() Reviewed-by: Gabriel
Diffstat (limited to 'tests/auto/qtreeview')
-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"