summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-10-16 07:34:38 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-10-16 07:34:38 (GMT)
commit7644b352297e9fd1ee271421e9ce8b7256946b12 (patch)
tree81f8ad1d09f056c630666a8f0d8fb5ca2bf71e89
parent8ef83e60df0291ba2a36cc744e1f0c11f465f1e2 (diff)
downloadQt-7644b352297e9fd1ee271421e9ce8b7256946b12.zip
Qt-7644b352297e9fd1ee271421e9ce8b7256946b12.tar.gz
Qt-7644b352297e9fd1ee271421e9ce8b7256946b12.tar.bz2
Fixed typo in qtableview.cpp.
Auto-test included. Will timeout on fail. Reviewed-by: Alexis
-rw-r--r--src/gui/itemviews/qtableview.cpp2
-rw-r--r--tests/auto/qtableview/tst_qtableview.cpp35
2 files changed, 31 insertions, 6 deletions
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp
index a610b73..2a937f1 100644
--- a/src/gui/itemviews/qtableview.cpp
+++ b/src/gui/itemviews/qtableview.cpp
@@ -1599,7 +1599,7 @@ QModelIndex QTableView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifi
break;
visualColumn = right + 1;
if (visualRow == 0) {
- wrapped == true;
+ wrapped = true;
visualRow = bottom;
} else {
--visualRow;
diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp
index d75cfa7..d8110e1 100644
--- a/tests/auto/qtableview/tst_qtableview.cpp
+++ b/tests/auto/qtableview/tst_qtableview.cpp
@@ -1195,6 +1195,13 @@ void tst_QTableView::moveCursorStrikesBack_data()
<< 0 << 5 << (IntList() << int(QtTestTableView::MoveNext))
<< 1 << 0;
+ QTest::newRow("Last column disabled. Task QTBUG-3878") << -1 << -1
+ << IntList()
+ << (IntList() << 6)
+ << QRect()
+ << 1 << 0 << (IntList() << int(QtTestTableView::MovePrevious))
+ << 0 << 5;
+
QTest::newRow("Span, anchor column hidden") << -1 << 1
<< IntList()
<< IntList()
@@ -1250,6 +1257,24 @@ void tst_QTableView::moveCursorStrikesBack_data()
<< QRect(1, 2, 2, 3)
<< 5 << 2 << (IntList() << int(QtTestTableView::MoveUp) << int(QtTestTableView::MoveUp))
<< 1 << 2;
+
+ IntList fullList;
+ for (int i = 0; i < 7; ++i)
+ fullList << i;
+
+ QTest::newRow("All disabled, wrap forward. Timeout => FAIL") << -1 << -1
+ << fullList
+ << fullList
+ << QRect()
+ << 1 << 0 << (IntList() << int(QtTestTableView::MoveNext))
+ << 1 << 0;
+
+ QTest::newRow("All disabled, wrap backwards. Timeout => FAIL") << -1 << -1
+ << fullList
+ << fullList
+ << QRect()
+ << 1 << 0 << (IntList() << int(QtTestTableView::MovePrevious))
+ << 1 << 0;
}
void tst_QTableView::moveCursorStrikesBack()
@@ -1272,11 +1297,6 @@ void tst_QTableView::moveCursorStrikesBack()
view.hideRow(hideRow);
view.hideColumn(hideColumn);
- foreach (int row, disableRows)
- model.disableRow(row);
- foreach (int column, disableColumns)
- model.disableColumn(column);
-
if (span.height() && span.width())
view.setSpan(span.top(), span.left(), span.height(), span.width());
view.show();
@@ -1284,6 +1304,11 @@ void tst_QTableView::moveCursorStrikesBack()
QModelIndex index = model.index(startRow, startColumn);
view.setCurrentIndex(index);
+ foreach (int row, disableRows)
+ model.disableRow(row);
+ foreach (int column, disableColumns)
+ model.disableColumn(column);
+
int newRow = -1;
int newColumn = -1;
foreach (int cursorMoveAction, cursorMoveActions) {