summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtableview
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-07-10 13:46:13 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-07-10 14:02:13 (GMT)
commit788b8ab3eed9314310408a577d797471d392d582 (patch)
tree8e933a316a826b57b23286f4adae0756ef02d93a /tests/auto/qtableview
parente2bf5eeee12329ad4aee941b5bb70af4ee5bb32f (diff)
downloadQt-788b8ab3eed9314310408a577d797471d392d582.zip
Qt-788b8ab3eed9314310408a577d797471d392d582.tar.gz
Qt-788b8ab3eed9314310408a577d797471d392d582.tar.bz2
adding autotest
Task-number: 248688
Diffstat (limited to 'tests/auto/qtableview')
-rw-r--r--tests/auto/qtableview/tst_qtableview.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp
index 0a69b75..6fa57f0 100644
--- a/tests/auto/qtableview/tst_qtableview.cpp
+++ b/tests/auto/qtableview/tst_qtableview.cpp
@@ -176,6 +176,7 @@ private slots:
void task173773_updateVerticalHeader();
void task227953_setRootIndex();
void task240266_veryBigColumn();
+ void task248688_autoScrollNavigation();
void mouseWheel_data();
void mouseWheel();
@@ -587,7 +588,7 @@ void tst_QTableView::keyboardNavigation()
QModelIndex index = model.index(rowCount - 1, columnCount - 1);
view.setCurrentIndex(index);
- QApplication::instance()->processEvents();
+ QApplication::processEvents();
int row = rowCount - 1;
int column = columnCount - 1;
@@ -619,7 +620,7 @@ void tst_QTableView::keyboardNavigation()
}
QTest::keyClick(&view, key);
- QApplication::instance()->processEvents();
+ QApplication::processEvents();
QModelIndex index = model.index(row, column);
QCOMPARE(view.currentIndex(), index);
@@ -3154,6 +3155,31 @@ void tst_QTableView::task240266_veryBigColumn()
}
+void tst_QTableView::task248688_autoScrollNavigation()
+{
+ //we make sure that when navigating with the keyboard the view is correctly scrolled
+ //to the current item
+ QStandardItemModel model(16, 16);
+ QTableView view;
+ view.setModel(&model);
+
+ view.hideColumn(8);
+ view.hideRow(8);
+ view.show();
+ for (int r = 0; r < model.rowCount(); ++r) {
+ if (view.isRowHidden(r))
+ continue;
+ for (int c = 0; c < model.columnCount(); ++c) {
+ if (view.isColumnHidden(c))
+ continue;
+ QModelIndex index = model.index(r, c);
+ view.setCurrentIndex(index);
+ QVERIFY(view.viewport()->rect().contains(view.visualRect(index)));
+ }
+ }
+}
+
+
void tst_QTableView::mouseWheel_data()
{
QTest::addColumn<int>("scrollMode");