test: fixed failure of tst_qstylesheetstyle on qpa
authorRohan McGovern <rohan.mcgovern@nokia.com>
Thu, 18 Aug 2011 00:33:57 +0000 (10:33 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 18 Aug 2011 06:05:38 +0000 (08:05 +0200)
Wait for window shown on _all_ platforms, not just X11.

QEXPECT_FAIL a test which relies on QCursor::setPos, which is currently
unimplemented for qpa (QTBUG-20753).

Change-Id: I72412476afc7e52ccb6cab4306ff791b7e7d8d93
Reviewed-on: http://codereview.qt.nokia.com/3118
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp

index 11d297c..a8dfea9 100644 (file)
@@ -792,9 +792,7 @@ void tst_QStyleSheetStyle::focusColors()
             frame.setLayout(layout);
 
             frame.show();
-#ifdef Q_WS_X11
-            qt_x11_wait_for_window_manager(&frame);
-#endif
+            QTest::qWaitForWindowShown(&frame);
             QApplication::setActiveWindow(&frame);
             widget->setFocus();
             QApplication::processEvents();
@@ -856,15 +854,17 @@ void tst_QStyleSheetStyle::hoverColors()
         QCursor::setPos(QPoint(0,0));
 #endif
 
-#ifdef Q_WS_X11
-        qt_x11_wait_for_window_manager(&frame);
-#endif
+        QTest::qWaitForWindowShown(&frame);
         QApplication::setActiveWindow(&frame);
         QTest::qWait(60);
         //move the mouse inside the widget, it should be colored
         QTest::mouseMove ( widget, QPoint(5,5));
         QTest::qWait(60);
 
+#ifdef Q_WS_QPA
+        QEXPECT_FAIL("", "QCursor::setPos / QTest::mouseMove is not implemented on qpa", Abort);
+#endif
+
         QVERIFY(widget->testAttribute(Qt::WA_UnderMouse));
 
         QImage image(frame.width(), frame.height(), QImage::Format_ARGB32);
@@ -960,9 +960,7 @@ void tst_QStyleSheetStyle::background()
         QWidget* widget = widgets[c];
 
         widget->show();
-#ifdef Q_WS_X11
-        qt_x11_wait_for_window_manager(widget);
-#endif
+        QTest::qWaitForWindowShown(widget);
 
         QImage image(widget->width(), widget->height(), QImage::Format_ARGB32);
         widget->render(&image);
@@ -1303,9 +1301,7 @@ void tst_QStyleSheetStyle::emptyStyleSheet()
     layout.addWidget(new QGroupBox("some text", &w));
 
     w.show();
-#ifdef Q_WS_X11
-    qt_x11_wait_for_window_manager(&w);
-#endif
+    QTest::qWaitForWindowShown(&w);
     //workaround the fact that the label sizehint is one pixel different the first time.
     label.setIndent(0); //force to recompute the sizeHint:
     w.setFocus();