summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp')
-rw-r--r--tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
index 3710645514..dfb780c8fa 100644
--- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
+++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
@@ -201,6 +201,7 @@ private slots:
void taskQTBUG_7774_RtoLVisualRegionForSelection();
void taskQTBUG_8777_scrollToSpans();
void taskQTBUG_10169_sizeHintForRow();
+ void taskQTBUG_30653_doItemsLayout();
void mouseWheel_data();
void mouseWheel();
@@ -4124,5 +4125,38 @@ void tst_QTableView::viewOptions()
QVERIFY(options.showDecorationSelected);
}
+void tst_QTableView::taskQTBUG_30653_doItemsLayout()
+{
+ QWidget topLevel;
+ QtTestTableView view(&topLevel);
+
+ QtTestTableModel model(5, 5);
+ view.setModel(&model);
+
+ QtTestItemDelegate delegate;
+ delegate.hint = QSize(50, 50);
+ view.setItemDelegate(&delegate);
+
+ view.resizeRowsToContents();
+ view.resizeColumnsToContents();
+
+ // show two and half rows/cols
+ int extraWidth = view.verticalHeader()->sizeHint().width() + view.verticalScrollBar()->sizeHint().width();
+ int extraHeight = view.horizontalHeader()->sizeHint().height() + view.horizontalScrollBar()->sizeHint().height();
+ view.resize(125 + extraWidth, 125 + extraHeight);
+
+ topLevel.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
+
+ // the offset after scrollToBottom() and doItemsLayout() should not differ
+ // as the view content should stay aligned to the last section
+ view.scrollToBottom();
+ int scrollToBottomOffset = view.verticalHeader()->offset();
+ view.doItemsLayout();
+ int doItemsLayoutOffset = view.verticalHeader()->offset();
+
+ QCOMPARE(scrollToBottomOffset, doItemsLayoutOffset);
+}
+
QTEST_MAIN(tst_QTableView)
#include "tst_qtableview.moc"