summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPierre Rossi <pierre.rossi@nokia.com>2010-07-20 09:23:25 (GMT)
committerPierre Rossi <pierre.rossi@nokia.com>2010-07-20 09:42:20 (GMT)
commit8517f787b798d9e300438404aab359de2acc0978 (patch)
tree2961167559aad1f41bcad5a737c6e3aa22c1007e /tests
parentb0998a44a5dc384a6cf65c1d5910cb3dd40620cf (diff)
downloadQt-8517f787b798d9e300438404aab359de2acc0978.zip
Qt-8517f787b798d9e300438404aab359de2acc0978.tar.gz
Qt-8517f787b798d9e300438404aab359de2acc0978.tar.bz2
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')
-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 f6cd4e3..da0a0bb 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"