summaryrefslogtreecommitdiff
path: root/tests/auto/qheaderview/tst_qheaderview.cpp
diff options
context:
space:
mode:
authorThorbjørn Lund Martsum <tmartsum@gmail.com>2012-10-28 06:55:55 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-31 01:03:22 +0100
commitda113c065991f2e1d25fd507daf79f5aeb691522 (patch)
tree203784284ad21cae94de8952081c54b8ae687693 /tests/auto/qheaderview/tst_qheaderview.cpp
parent4ccc7ff70918f1fdbe37637aa72e02d5a90a6550 (diff)
downloadqt4-tools-da113c065991f2e1d25fd507daf79f5aeb691522.tar.gz
QHeaderView - fix minor bug in visualIndexAt
This fixes a minor bug in VisualIndex triggered when calling resizeSection with size 0 (but not hideSection). It is mostly cosmetics - but it is still a bug. This is a backport of SHA 73a5bc2aac7638438dfde260a4246359a06e89ae Change-Id: Ic3e1ce584d8befa501c670c085435248ebaa681b Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'tests/auto/qheaderview/tst_qheaderview.cpp')
-rw-r--r--tests/auto/qheaderview/tst_qheaderview.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qheaderview/tst_qheaderview.cpp b/tests/auto/qheaderview/tst_qheaderview.cpp
index 6e685643ce..2588f5e8d8 100644
--- a/tests/auto/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/qheaderview/tst_qheaderview.cpp
@@ -197,6 +197,7 @@ private slots:
void QTBUG14242_hideSectionAutoSize();
void initialSortOrderRole();
+ void ensureNoIndexAtLength();
protected:
QWidget *topLevel;
@@ -2162,5 +2163,17 @@ void tst_QHeaderView::initialSortOrderRole()
QCOMPARE(view.horizontalHeader()->sortIndicatorOrder(), Qt::AscendingOrder);
}
+void tst_QHeaderView::ensureNoIndexAtLength()
+{
+ QTableView qtv;
+ QStandardItemModel amodel(4, 4);
+ qtv.setModel(&amodel);
+ QHeaderView *hv = qtv.verticalHeader();
+ QVERIFY(hv->visualIndexAt(hv->length()) == -1);
+ hv->resizeSection(hv->count() - 1, 0);
+ QVERIFY(hv->visualIndexAt(hv->length()) == -1);
+}
+
+
QTEST_MAIN(tst_QHeaderView)
#include "tst_qheaderview.moc"