From 58ab483cdb685ee71daf4e68907a97481a411628 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 31 Jul 2012 09:06:50 +0200 Subject: [PATCH] Stabilize the QHeaderView test. The test has a member QWidget *topLevel which it recreates and shows in init() without waiting for it to be exposed although it is not used in every test case. This apparently interferes with some tests that create separate top levels. Do not show in init(), delete the topLevel. Add wait to the cases where the topLevel is shown. Change-Id: Ib428020b36dc82991d41e68478fd583bdfb004c7 Reviewed-by: Sergio Ahumada --- .../widgets/itemviews/qheaderview/tst_qheaderview.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 758c6e0b19..19004e7cad 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -420,7 +420,6 @@ void tst_QHeaderView::init() view->setModel(model); QCOMPARE(spy.count(), 1); view->resize(200,200); - topLevel->show(); } void tst_QHeaderView::cleanup() @@ -431,6 +430,8 @@ void tst_QHeaderView::cleanup() view = 0; delete model; model = 0; + delete topLevel; + topLevel = 0; } void tst_QHeaderView::noModel() @@ -558,6 +559,7 @@ void tst_QHeaderView::stretch() view->setStretchLastSection(true); QCOMPARE(view->stretchLastSection(), true); topLevel->show(); + QVERIFY(QTest::qWaitForWindowExposed(topLevel)); QCOMPARE(view->width(), viewSize.width()); QCOMPARE(view->visualIndexAt(view->viewport()->height() - 5), 3); @@ -724,6 +726,7 @@ void tst_QHeaderView::visualIndexAt() view->setStretchLastSection(true); topLevel->show(); + QVERIFY(QTest::qWaitForWindowExposed(topLevel)); for (int i = 0; i < hidden.count(); ++i) view->setSectionHidden(hidden.at(i), true); @@ -745,6 +748,7 @@ void tst_QHeaderView::length() #endif view->setStretchLastSection(true); topLevel->show(); + QVERIFY(QTest::qWaitForWindowExposed(topLevel)); //minimumSectionSize should be the size of the last section of the widget is not tall enough int length = view->minimumSectionSize(); @@ -757,6 +761,7 @@ void tst_QHeaderView::length() view->setStretchLastSection(false); topLevel->show(); + QVERIFY(QTest::qWaitForWindowExposed(topLevel)); QVERIFY(length != view->length()); @@ -808,6 +813,7 @@ void tst_QHeaderView::logicalIndexAt() QCOMPARE(view->logicalIndexAt(1), 0); topLevel->show(); + QVERIFY(QTest::qWaitForWindowExposed(topLevel)); view->setStretchLastSection(true); // First item QCOMPARE(view->logicalIndexAt(0), 0); @@ -1111,6 +1117,7 @@ void tst_QHeaderView::resizeWithResizeModes() view->setSectionResizeMode(i, (QHeaderView::ResizeMode)modes.at(i)); } topLevel->show(); + QVERIFY(QTest::qWaitForWindowExposed(topLevel)); view->resize(size, size); for (int j = 0; j < expected.count(); ++j) QCOMPARE(view->sectionSize(j), expected.at(j)); @@ -1209,6 +1216,7 @@ void tst_QHeaderView::resizeSection() view->resize(400, 400); topLevel->show(); + QVERIFY(QTest::qWaitForWindowExposed(topLevel)); view->setSectionsMovable(true); view->setStretchLastSection(false);