summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-06-10 00:22:34 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-06-10 00:22:34 (GMT)
commit6eb8af2ceca2d0fc8b7108bec3525d915d31fe65 (patch)
tree770bd08e3a293e80c71383dd10d242930c912a09
parent433ad48e3ce0fd66d6165714c0bd811d5cb79a35 (diff)
downloadQt-6eb8af2ceca2d0fc8b7108bec3525d915d31fe65.zip
Qt-6eb8af2ceca2d0fc8b7108bec3525d915d31fe65.tar.gz
Qt-6eb8af2ceca2d0fc8b7108bec3525d915d31fe65.tar.bz2
Improve test stability.
-rw-r--r--tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp17
1 files changed, 17 insertions, 0 deletions
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 <QtDeclarative/qdeclarativeview.h>
#include <QtDeclarative/qdeclarativeitem.h>
#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<QWidget *>(&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<QWidget *>(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<QWidget *>(viewer));
+
// Browser.qml successfully loaded
QDeclarativeItem* browserItem = qobject_cast<QDeclarativeItem*>(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<QWidget *>(viewer));
+
// initial size
QCOMPARE(rootItem->width(), 200.0);
QCOMPARE(rootItem->height(), 300.0);