aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquicktableview/tst_qquicktableview.cpp')
-rw-r--r--tests/auto/quick/qquicktableview/tst_qquicktableview.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
index c7fd51f72c..dfcce6afdb 100644
--- a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
+++ b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
@@ -538,13 +538,14 @@ void tst_QQuickTableView::checkContentWidthAndHeight()
tableView->setContentY(flickTo);
const int largeSizeCellCountInView = qCeil(tableView->width() / cellSizeLarge);
- const int bottomRow = smallCellCount + largeSizeCellCountInView - 1;
- QCOMPARE(tableViewPrivate->loadedTable.right(), bottomRow);
+ const int columnCount = smallCellCount + largeSizeCellCountInView;
+ QCOMPARE(tableViewPrivate->loadedTable.right(), columnCount - 1);
const qreal firstHalfLength = smallCellCount * cellSizeSmall;
const qreal secondHalfOneScreenLength = largeSizeCellCountInView * cellSizeLarge;
const qreal lengthAfterFlick = firstHalfLength + secondHalfOneScreenLength;
- const qreal averageCellSize = lengthAfterFlick / (smallCellCount + largeSizeCellCountInView);
+
+ const qreal averageCellSize = lengthAfterFlick / columnCount;
const qreal expectedSizeHalf = (tableSize * averageCellSize) + accumulatedSpacing;
QCOMPARE(tableView->contentWidth(), expectedSizeHalf);
@@ -580,6 +581,10 @@ void tst_QQuickTableView::checkExplicitContentWidthAndHeight()
QCOMPARE(tableView->contentWidth(), 1000);
QCOMPARE(tableView->contentHeight(), 1000);
+ auto model = TestModelAsVariant(100, 100);
+ tableView->setModel(model);
+ WAIT_UNTIL_POLISHED;
+
// Flick somewhere. It should not affect the contentWidth/Height
tableView->setContentX(500);
tableView->setContentY(500);