From 6eb8af2ceca2d0fc8b7108bec3525d915d31fe65 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 10 Jun 2010 10:22:34 +1000 Subject: Improve test stability. --- .../qdeclarativeviewer/tst_qdeclarativeviewer.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp index 91b7cf8..abc9688 100644 --- a/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp +++ b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp @@ -44,6 +44,7 @@ #include #include #include "qmlruntime.h" +#include "../../../shared/util.h" #ifdef Q_OS_SYMBIAN // In Symbian OS test data is located in applications private dir @@ -85,6 +86,10 @@ void tst_QDeclarativeViewer::orientation() QVERIFY(rootItem); window.show(); + QApplication::setActiveWindow(&window); + QTest::qWaitForWindowShown(&window); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(&window)); + QCOMPARE(rootItem->width(), 200.0); QCOMPARE(rootItem->height(), 300.0); QCOMPARE(viewer->view()->size(), QSize(200, 300)); @@ -125,6 +130,10 @@ void tst_QDeclarativeViewer::loading() QVERIFY(rootItem); viewer->show(); + QApplication::setActiveWindow(viewer); + QTest::qWaitForWindowShown(viewer); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(viewer)); + // initial size QCOMPARE(rootItem->width(), 200.0); QCOMPARE(rootItem->height(), 300.0); @@ -192,6 +201,10 @@ void tst_QDeclarativeViewer::fileBrowser() viewer->openFile(); viewer->show(); + QApplication::setActiveWindow(viewer); + QTest::qWaitForWindowShown(viewer); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(viewer)); + // Browser.qml successfully loaded QDeclarativeItem* browserItem = qobject_cast(viewer->view()->rootObject()); QVERIFY(viewer->view()); @@ -225,6 +238,10 @@ void tst_QDeclarativeViewer::resizing() QVERIFY(rootItem); viewer->show(); + QApplication::setActiveWindow(viewer); + QTest::qWaitForWindowShown(viewer); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(viewer)); + // initial size QCOMPARE(rootItem->width(), 200.0); QCOMPARE(rootItem->height(), 300.0); -- cgit v0.12