diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 45839d2ab3..f61e38c432 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -230,6 +230,7 @@ private slots: void insertTest(); void mixedTests(); void resizeToContentTest(); + void testStreamWithHide(); protected: void setupTestData(bool use_reset_model = false); @@ -2698,5 +2699,26 @@ void tst_QHeaderView::resizeToContentTest() calculateAndCheck(__LINE__, precalced_results); } +void tst_QHeaderView::testStreamWithHide() +{ +#ifndef QT_NO_DATASTREAM + m_tableview->setVerticalHeader(view); + m_tableview->setModel(model); + view->setDefaultSectionSize(25); + view->hideSection(2); + view->swapSections(1, 2); + + QByteArray s = view->saveState(); + view->swapSections(1, 2); + view->setDefaultSectionSize(30); // To make sure our precalced data are correct. + view->restoreState(s); + + const int precalced_results[] = { -1116614432, -1528653200, -1914165644, 244434607, -1111214068, 750357900, 75}; + calculateAndCheck(__LINE__, precalced_results); +#else + QSKIP("Datastream required for testStreamWithHide. Skipping this test."); +#endif +} + QTEST_MAIN(tst_QHeaderView) #include "tst_qheaderview.moc"