summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/itemviews
diff options
context:
space:
mode:
authorThorbjørn Lund Martsum <tmartsum@gmail.com>2012-01-10 19:33:14 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-01 02:16:08 +0100
commit96f1fe8855082017fbbecccdab1eb11fd8c1f870 (patch)
tree24017d87ba81ee6363c0d3496881738f9bbc4d37 /tests/auto/widgets/itemviews
parent85c08e06c81d9e6cd1bb29f13357d63c1a93599b (diff)
QHeaderView - preventing negative section sizes.
This patch removes the posibility to call resizeSection with negative sizes. Sections with negative sizes affect the other sections, and it does not seem to have a useful, well-defined semantic. The length can also become negative - and visualIndexAt work strange. Change-Id: I632beb160649fa10e2106314557b8c5a106aa3cf Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'tests/auto/widgets/itemviews')
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp10
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 62da3337e1..2a0a40f542 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -172,6 +172,7 @@ private slots:
void removeSection();
void preserveHiddenSectionWidth();
void invisibleStretchLastSection();
+ void noSectionsWithNegativeSize();
void emptySectionSpan();
void task236450_hidden_data();
@@ -1853,6 +1854,15 @@ void tst_QHeaderView::invisibleStretchLastSection()
QCOMPARE(view.sectionSize(count - 1), view.defaultSectionSize() * 2);
}
+void tst_QHeaderView::noSectionsWithNegativeSize()
+{
+ QStandardItemModel m(4, 4);
+ QHeaderView h(Qt::Horizontal);
+ h.setModel(&m);
+ h.resizeSection(1, -5);
+ QVERIFY(h.sectionSize(1) >= 0); // Sections with negative sizes not well defined.
+}
+
void tst_QHeaderView::emptySectionSpan()
{
QHeaderViewPrivate::SectionSpan span;