summaryrefslogtreecommitdiffstats
path: root/tests/auto/qheaderview
diff options
context:
space:
mode:
authorPierre Rossi <pierre.rossi@nokia.com>2010-07-20 11:23:25 +0200
committerPierre Rossi <pierre.rossi@nokia.com>2010-07-20 11:42:20 +0200
commit8517f787b798d9e300438404aab359de2acc0978 (patch)
tree2961167559aad1f41bcad5a737c6e3aa22c1007e /tests/auto/qheaderview
parentb0998a44a5dc384a6cf65c1d5910cb3dd40620cf (diff)
Fix a Headerview layout bug
When the sections were moved calling logicalIndex on what was already a logical index messed up the hidden sections. Task-number: QTBUG-12268 Reviewed-by: Gabriel
Diffstat (limited to 'tests/auto/qheaderview')
-rw-r--r--tests/auto/qheaderview/tst_qheaderview.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qheaderview/tst_qheaderview.cpp b/tests/auto/qheaderview/tst_qheaderview.cpp
index f6cd4e3f4e..da0a0bbeed 100644
--- a/tests/auto/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/qheaderview/tst_qheaderview.cpp
@@ -193,6 +193,7 @@ private slots:
void QTBUG6058_reset();
void QTBUG7833_sectionClicked();
void QTBUG8650_crashOnInsertSections();
+ void QTBUG12268_hiddenMovedSectionSorting();
protected:
QHeaderView *view;
@@ -2071,5 +2072,25 @@ void tst_QHeaderView::QTBUG8650_crashOnInsertSections()
model.insertColumn(0, items);
}
+void tst_QHeaderView::QTBUG12268_hiddenMovedSectionSorting()
+{
+ QTableView view;
+ QStandardItemModel *model = new QStandardItemModel(4,3, &view);
+ for (int i = 0; i< model->rowCount(); ++i)
+ for (int j = 0; j< model->columnCount(); ++j)
+ model->setData(model->index(i,j), QString("item [%1,%2]").arg(i).arg(j));
+ view.setModel(model);
+ view.horizontalHeader()->setMovable(true);
+ view.setSortingEnabled(true);
+ view.sortByColumn(1, Qt::AscendingOrder);
+ view.horizontalHeader()->moveSection(0,2);
+ view.setColumnHidden(1, true);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ QCOMPARE(view.horizontalHeader()->hiddenSectionCount(), 1);
+ QTest::mouseClick(view.horizontalHeader()->viewport(), Qt::LeftButton);
+ QCOMPARE(view.horizontalHeader()->hiddenSectionCount(), 1);
+}
+
QTEST_MAIN(tst_QHeaderView)
#include "tst_qheaderview.moc"