diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-07-24 20:44:05 +0200 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-08-04 19:31:15 +0000 |
commit | faff43348bfae5cfc709fabe9d2698fc3063c050 (patch) | |
tree | 2ca0b2874c3e3ce880ef1e09c706adb49ee17aac /tests | |
parent | f29c955483c0e0f94388b7ff1728d19abeb896ee (diff) |
QHeaderView: respect min/maxSectionSize in setDefaultSectionSize()
The min/max section size was not checked when setting the default
section size. This was an oversight when the check for min/max section
size was added to resizeSection().
[ChangeLog][QtWidgets][QHeaderView] setDefaultSectionSize() now
checks if the given value is inside min/max section size
Task-number: QTBUG-69431
Change-Id: I1b5704282927ce5a8520f52174ebf91d9840bc8a
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 05eef7c091..b6932d4892 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -405,6 +405,7 @@ void tst_QHeaderView::getSetCheck() // int QHeaderView::defaultSectionSize() // void QHeaderView::setDefaultSectionSize(int) + obj1.setMinimumSectionSize(0); obj1.setDefaultSectionSize(-1); QVERIFY(obj1.defaultSectionSize() >= 0); obj1.setDefaultSectionSize(0); @@ -2060,6 +2061,7 @@ void tst_QHeaderView::defaultSectionSize() QHeaderView h((Qt::Orientation)direction); h.setModel(&m); + h.setMinimumSectionSize(0); QCOMPARE(h.defaultSectionSize(), oldDefaultSize); h.setDefaultSectionSize(newDefaultSize); @@ -3326,8 +3328,16 @@ void tst_QHeaderView::testMinMaxSectionSize() QHeaderView &header = *tv.horizontalHeader(); header.setMinimumSectionSize(sectionSizeMin); header.setMaximumSectionSize(sectionSizeMax); + // check bounds for default section size + header.setDefaultSectionSize(sectionSizeMin - 1); + QCOMPARE(header.defaultSectionSize(), sectionSizeMin); + header.setDefaultSectionSize(sectionSizeMax + 1); + QCOMPARE(header.defaultSectionSize(), sectionSizeMax); + header.setDefaultSectionSize(defaultSectionSize); + QCOMPARE(header.defaultSectionSize(), defaultSectionSize); header.setStretchLastSection(stretchLastSection); + QCOMPARE(header.stretchLastSection(), stretchLastSection); // check defaults QCOMPARE(header.sectionSize(0), defaultSectionSize); |