tests/auto/qheaderview/tst_qheaderview.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
--- a/tests/auto/qheaderview/tst_qheaderview.cpp	Tue Jul 06 15:10:48 2010 +0300
+++ b/tests/auto/qheaderview/tst_qheaderview.cpp	Wed Aug 18 10:37:55 2010 +0300
@@ -193,6 +193,7 @@
     void QTBUG6058_reset();
     void QTBUG7833_sectionClicked();
     void QTBUG8650_crashOnInsertSections();
+    void QTBUG12268_hiddenMovedSectionSorting();
 
 protected:
     QHeaderView *view;
@@ -2071,5 +2072,25 @@
     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"