summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/itemviews/qheaderview
diff options
context:
space:
mode:
authorThorbjørn Lund Martsum <tmartsum@gmail.com>2012-06-23 20:06:19 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-05 13:13:58 +0200
commit5dc9036e18daebda38902065639b4975e5f15e7c (patch)
tree8347cea68dc3a667eba9cdeb174c612a13d6b559 /tests/auto/widgets/itemviews/qheaderview
parentf8f6acb05ce9aa5fccc329bf5587adf14ed9a710 (diff)
QHeaderView - adding an auto test with saveState and restoreState
This test is nice to have regardless though the main reason for it is a refactor of hiddenSections in QHeaderView. Change-Id: Id41a1d5edda2ef75bf432a78cdb3e952303eae92 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'tests/auto/widgets/itemviews/qheaderview')
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp22
1 files changed, 22 insertions, 0 deletions
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"