summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp')
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index c355ee9665..88c09de8e0 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -251,6 +251,7 @@ private slots:
void testResetCachedSizeHint();
void statusTips();
void testRemovingColumnsViaLayoutChanged();
+ void testModelMovingColumns();
protected:
void setupTestData(bool use_reset_model = false);
@@ -360,6 +361,12 @@ public:
endRemoveColumns();
}
+ void moveColumn(int from, int to)
+ {
+ beginMoveColumns(QModelIndex(), from, from, QModelIndex(), to);
+ endMoveColumns();
+ }
+
void cleanup()
{
emit layoutAboutToBeChanged();
@@ -3627,5 +3634,18 @@ void tst_QHeaderView::testRemovingColumnsViaLayoutChanged()
// The main point of this test is that the section-size restoring code didn't go out of bounds.
}
+void tst_QHeaderView::testModelMovingColumns()
+{
+ QtTestModel model(10, 10);
+ QHeaderView hv(Qt::Horizontal);
+ hv.setModel(&model);
+ hv.resizeSections(QHeaderView::ResizeToContents);
+ hv.show();
+
+ QPersistentModelIndex index3 = model.index(0, 3);
+ model.moveColumn(3, 1);
+ QCOMPARE(index3.column(), 1);
+}
+
QTEST_MAIN(tst_QHeaderView)
#include "tst_qheaderview.moc"