From 7644b352297e9fd1ee271421e9ce8b7256946b12 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 16 Oct 2009 09:34:38 +0200 Subject: Fixed typo in qtableview.cpp. Auto-test included. Will timeout on fail. Reviewed-by: Alexis --- src/gui/itemviews/qtableview.cpp | 2 +- tests/auto/qtableview/tst_qtableview.cpp | 35 +++++++++++++++++++++++++++----- 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) { -- cgit v0.12