summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2012-02-29 09:18:59 +1000
committerRohan McGovern <rohan.mcgovern@nokia.com>2012-02-29 09:23:14 +1000
commit98dd1781d9256f68025d2a2db408f4f5947f3214 (patch)
treedbe1424abd90014edb5546c920ca585ed62b46e3 /tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
parent6c1bdc1854a7700c2b3a345b95f6a2fdca84037d (diff)
parentfa1b9070af66edb81b2a3735c1951f78b22bd666 (diff)
Merge master -> api_changes
Includes fixes for tst_qfiledialog2, tst_qtextedit autotests on mac. Change-Id: I49cac26894d31291a8339ccc1eb80b6a940f0827
Diffstat (limited to 'tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp')
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index 4dd57e1b90..3edc125b5a 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -205,6 +205,7 @@ private slots:
void QTBUG12268_hiddenMovedSectionSorting();
void QTBUG14242_hideSectionAutoSize();
void ensureNoIndexAtLength();
+ void offsetConsistent();
void initialSortOrderRole();
@@ -2168,6 +2169,33 @@ void tst_QHeaderView::ensureNoIndexAtLength()
QVERIFY(hv->visualIndexAt(hv->length()) == -1);
}
+void tst_QHeaderView::offsetConsistent()
+{
+ // Ensure that a hidden section 'far away'
+ // does not affect setOffsetToSectionPosition ..
+ const int sectionToHide = 513;
+ QTableView qtv;
+ QStandardItemModel amodel(1000, 4);
+ qtv.setModel(&amodel);
+ QHeaderView *hv = qtv.verticalHeader();
+ for (int u = 0; u < 100; u += 2)
+ hv->resizeSection(u, 0);
+ hv->setOffsetToSectionPosition(150);
+ int offset1 = hv->offset();
+ hv->hideSection(sectionToHide);
+ hv->setOffsetToSectionPosition(150);
+ int offset2 = hv->offset();
+ QVERIFY(offset1 == offset2);
+ // Ensure that hidden indexes (still) is considered.
+ hv->resizeSection(sectionToHide, hv->sectionSize(200) * 2);
+ hv->setOffsetToSectionPosition(800);
+ offset1 = hv->offset();
+ hv->showSection(sectionToHide);
+ hv->setOffsetToSectionPosition(800);
+ offset2 = hv->offset();
+ QVERIFY(offset2 > offset1);
+}
+
void tst_QHeaderView::initialSortOrderRole()
{
QTableView view; // ### Shadowing member view (of type QHeaderView)