diff options
author | Liang Qi <liang.qi@qt.io> | 2019-04-24 09:52:30 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-04-24 09:52:30 +0200 |
commit | dc373186841802f2dd17fcd243efdeca7d5433e9 (patch) | |
tree | 4fff0a3366b63db97ca5a8b04a220bb0b8c56450 /tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp | |
parent | 7d646508c8219408f90103ed13613db8d01a4065 (diff) | |
parent | cb10ec56f733c34d23c9e5511b19c1e508d0f13f (diff) |
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
src/gui/util/qshaderformat.cpp
src/gui/util/qshaderformat_p.h
src/widgets/graphicsview/qgraphicsitem_p.h
Change-Id: Idafd88eb9a0a15b4af29f6143d009c1ec8ceecca
Diffstat (limited to 'tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp')
-rw-r--r-- | tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 42258c85b9..f247889d55 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -248,6 +248,7 @@ private slots: void sizeHintCrash(); void testResetCachedSizeHint(); void statusTips(); + void testRemovingColumnsViaLayoutChanged(); protected: void setupTestData(bool use_reset_model = false); @@ -353,6 +354,7 @@ public: void cleanup() { + emit layoutAboutToBeChanged(); cols = 3; rows = 3; emit layoutChanged(); @@ -3489,5 +3491,20 @@ void tst_QHeaderView::statusTips() QCOMPARE(headerView.statusTipText, QLatin1String("[0,1,0] -- Header")); } +void tst_QHeaderView::testRemovingColumnsViaLayoutChanged() +{ + const int persistentSectionSize = 101; + + QtTestModel model; + model.rows = model.cols = 5; + view->setModel(&model); + for (int i = 0; i < model.cols; ++i) + view->resizeSection(i, persistentSectionSize + i); + model.cleanup(); // down to 3 via layoutChanged (not columnsRemoved) + for (int j = 0; j < model.cols; ++j) + QCOMPARE(view->sectionSize(j), persistentSectionSize + j); + // The main point of this test is that the section-size restoring code didn't go out of bounds. +} + QTEST_MAIN(tst_QHeaderView) #include "tst_qheaderview.moc" |