diff options
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qbuttongroup/tst_qbuttongroup.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 8 | ||||
-rw-r--r-- | tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 192 | ||||
-rw-r--r-- | tests/auto/qstatusbar/tst_qstatusbar.cpp | 9 | ||||
-rw-r--r-- | tests/auto/qwindowsurface/tst_qwindowsurface.cpp | 2 |
6 files changed, 108 insertions, 110 deletions
diff --git a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp index 502c2d1..11c1f47 100644 --- a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp +++ b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp @@ -173,10 +173,11 @@ void tst_QButtonGroup::arrowKeyNavigation() dlg.show(); qApp->setActiveWindow(&dlg); + QTest::qWaitForWindowShown(&dlg); bt1.setFocus(); - QVERIFY(bt1.hasFocus()); + QTRY_VERIFY(bt1.hasFocus()); QTest::keyClick(&bt1, Qt::Key_Right); QVERIFY(pb.hasFocus()); diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index ef9fe9e..bbf19f2 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -2925,10 +2925,8 @@ void tst_QGraphicsItem::hoverEventsGenerateRepaints() QGraphicsScene scene; QGraphicsView view(&scene); view.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif - QTest::qWait(20); + QTest::qWaitForWindowShown(&view); + QTest::qWait(100); EventTester *tester = new EventTester; scene.addItem(tester); @@ -4637,7 +4635,7 @@ void tst_QGraphicsItem::paint() qApp->processEvents(); //First show one paint - QVERIFY(tester2.painted == 1); + QTRY_COMPARE(tester2.painted, 1); //nominal case, update call paint tester2.update(); diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 5c0073c..6e60516 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -1491,9 +1491,7 @@ void tst_QGraphicsProxyWidget::scrollUpdate() View view(&scene); view.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif + QTest::qWaitForWindowShown(&view); QTRY_VERIFY(view.npaints >= 1); QTest::qWait(20); widget->paintEventRegion = QRegion(); diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 07d7cce..864076f 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -1702,9 +1702,8 @@ void tst_QGraphicsScene::hoverEvents_parentChild() view.rotate(10); view.scale(1.7, 1.7); view.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif + QTest::qWaitForWindowShown(&view); + QTest::qWait(50); QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseMove); mouseEvent.setScenePos(QPointF(-1000, -1000)); @@ -3060,52 +3059,53 @@ void tst_QGraphicsScene::tabFocus_sceneWithFocusableItems() widget.show(); qApp->setActiveWindow(&widget); widget.activateWindow(); - QTest::qWait(125); + QTest::qWaitForWindowShown(&widget); + QApplication::processEvents(); dial1->setFocus(); - QVERIFY(dial1->hasFocus()); + QTRY_VERIFY(dial1->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(125); - QVERIFY(view->hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(view->hasFocus()); QVERIFY(view->viewport()->hasFocus()); QVERIFY(scene.hasFocus()); QVERIFY(item->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(125); - QVERIFY(dial2->hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(dial2->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); - QTest::qWait(125); - QVERIFY(view->hasFocus()); - QVERIFY(view->viewport()->hasFocus()); - QVERIFY(scene.hasFocus()); - QVERIFY(item->hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(view->hasFocus()); + QTRY_VERIFY(view->viewport()->hasFocus()); + QTRY_VERIFY(scene.hasFocus()); + QTRY_VERIFY(item->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); - QTest::qWait(125); - QVERIFY(dial1->hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(dial1->hasFocus()); // If the item requests input focus, it can only ensure that the scene // sets focus on itself, but the scene cannot request focus from any view. item->setFocus(); - QTest::qWait(125); - QVERIFY(!view->hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(!view->hasFocus()); QVERIFY(!view->viewport()->hasFocus()); - QVERIFY(scene.hasFocus()); + QTRY_VERIFY(scene.hasFocus()); QVERIFY(item->hasFocus()); view->setFocus(); - QTest::qWait(125); - QVERIFY(view->hasFocus()); - QVERIFY(view->viewport()->hasFocus()); - QVERIFY(scene.hasFocus()); - QVERIFY(item->hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(view->hasFocus()); + QTRY_VERIFY(view->viewport()->hasFocus()); + QTRY_VERIFY(scene.hasFocus()); + QTRY_VERIFY(item->hasFocus()); // Check that everyone loses focus when the widget is hidden. widget.hide(); - QTest::qWait(125); - QVERIFY(!view->hasFocus()); + QTest::qWait(15); + QTRY_VERIFY(!view->hasFocus()); QVERIFY(!view->viewport()->hasFocus()); QVERIFY(!scene.hasFocus()); QVERIFY(!item->hasFocus()); @@ -3114,8 +3114,8 @@ void tst_QGraphicsScene::tabFocus_sceneWithFocusableItems() widget.show(); qApp->setActiveWindow(&widget); widget.activateWindow(); - QTest::qWait(125); - QVERIFY(view->hasFocus()); + QTest::qWaitForWindowShown(&widget); + QTRY_VERIFY(view->hasFocus()); QVERIFY(view->viewport()->hasFocus()); QVERIFY(scene.hasFocus()); QVERIFY(item->hasFocus()); @@ -3193,47 +3193,48 @@ void tst_QGraphicsScene::tabFocus_sceneWithFocusWidgets() widget.show(); qApp->setActiveWindow(&widget); widget.activateWindow(); - QTest::qWait(125); + QTest::qWaitForWindowShown(&widget); + QApplication::processEvents(); dial1->setFocus(); - QVERIFY(dial1->hasFocus()); + QTRY_VERIFY(dial1->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(125); - QVERIFY(view->hasFocus()); - QVERIFY(view->viewport()->hasFocus()); - QVERIFY(scene.hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(view->hasFocus()); + QTRY_VERIFY(view->viewport()->hasFocus()); + QTRY_VERIFY(scene.hasFocus()); QCOMPARE(widget1->tabs, 0); QVERIFY(widget1->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(125); - QCOMPARE(widget1->tabs, 1); - QVERIFY(widget2->hasFocus()); + QApplication::processEvents(); + QTRY_COMPARE(widget1->tabs, 1); + QTRY_VERIFY(widget2->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(125); - QCOMPARE(widget2->tabs, 1); - QVERIFY(dial2->hasFocus()); + QApplication::processEvents(); + QTRY_COMPARE(widget2->tabs, 1); + QTRY_VERIFY(dial2->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); - QTest::qWait(125); - QVERIFY(widget2->hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(widget2->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); - QTest::qWait(125); - QCOMPARE(widget2->backTabs, 1); - QVERIFY(widget1->hasFocus()); + QApplication::processEvents(); + QTRY_COMPARE(widget2->backTabs, 1); + QTRY_VERIFY(widget1->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); - QTest::qWait(125); - QCOMPARE(widget1->backTabs, 1); - QVERIFY(dial1->hasFocus()); + QApplication::processEvents(); + QTRY_COMPARE(widget1->backTabs, 1); + QTRY_VERIFY(dial1->hasFocus()); widget1->setFocus(); view->viewport()->setFocus(); widget.hide(); - QTest::qWait(125); + QTest::qWait(15); widget.show(); qApp->setActiveWindow(&widget); widget.activateWindow(); - QTest::qWait(125); - QVERIFY(widget1->hasFocus()); + QTest::qWaitForWindowShown(&widget); + QTRY_VERIFY(widget1->hasFocus()); } void tst_QGraphicsScene::tabFocus_sceneWithNestedFocusWidgets() @@ -3276,10 +3277,10 @@ void tst_QGraphicsScene::tabFocus_sceneWithNestedFocusWidgets() widget.show(); qApp->setActiveWindow(&widget); widget.activateWindow(); - QTest::qWait(125); + QTest::qWaitForWindowShown(&widget); dial1->setFocus(); - QVERIFY(dial1->hasFocus()); + QTRY_VERIFY(dial1->hasFocus()); EventSpy focusInSpy_1(widget1, QEvent::FocusIn); EventSpy focusOutSpy_1(widget1, QEvent::FocusOut); @@ -3291,78 +3292,79 @@ void tst_QGraphicsScene::tabFocus_sceneWithNestedFocusWidgets() EventSpy focusOutSpy_2(widget2, QEvent::FocusOut); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(125); - QVERIFY(widget1->hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(widget1->hasFocus()); QCOMPARE(focusInSpy_1.count(), 1); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(125); - QVERIFY(!widget1->hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(!widget1->hasFocus()); QVERIFY(widget1_1->hasFocus()); QCOMPARE(focusOutSpy_1.count(), 1); QCOMPARE(focusInSpy_1_1.count(), 1); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(125); - QVERIFY(!widget1_1->hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(!widget1_1->hasFocus()); QVERIFY(widget1_2->hasFocus()); QCOMPARE(focusOutSpy_1_1.count(), 1); QCOMPARE(focusInSpy_1_2.count(), 1); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(125); - QVERIFY(!widget1_2->hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(!widget1_2->hasFocus()); QVERIFY(widget2->hasFocus()); QCOMPARE(focusOutSpy_1_2.count(), 1); QCOMPARE(focusInSpy_2.count(), 1); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(125); - QVERIFY(!widget2->hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(!widget2->hasFocus()); QVERIFY(dial2->hasFocus()); QCOMPARE(focusOutSpy_2.count(), 1); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); - QTest::qWait(125); - QVERIFY(widget2->hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(widget2->hasFocus()); QCOMPARE(focusInSpy_2.count(), 2); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); - QTest::qWait(125); - QVERIFY(!widget2->hasFocus()); - QVERIFY(widget1_2->hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(!widget2->hasFocus()); + QTRY_VERIFY(widget1_2->hasFocus()); QCOMPARE(focusOutSpy_2.count(), 2); QCOMPARE(focusInSpy_1_2.count(), 2); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); - QTest::qWait(125); - QVERIFY(!widget1_2->hasFocus()); - QVERIFY(widget1_1->hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(!widget1_2->hasFocus()); + QTRY_VERIFY(widget1_1->hasFocus()); QCOMPARE(focusOutSpy_1_2.count(), 2); QCOMPARE(focusInSpy_1_1.count(), 2); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); - QTest::qWait(125); - QVERIFY(!widget1_1->hasFocus()); - QVERIFY(widget1->hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(!widget1_1->hasFocus()); + QTRY_VERIFY(widget1->hasFocus()); QCOMPARE(focusOutSpy_1_1.count(), 2); QCOMPARE(focusInSpy_1.count(), 2); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); - QTest::qWait(125); - QVERIFY(!widget1->hasFocus()); - QVERIFY(dial1->hasFocus()); + QApplication::processEvents(); + QTRY_VERIFY(!widget1->hasFocus()); + QTRY_VERIFY(dial1->hasFocus()); QCOMPARE(focusOutSpy_1.count(), 2); widget1->setFocus(); view->viewport()->setFocus(); widget.hide(); - QTest::qWait(125); + QTest::qWait(12); widget.show(); qApp->setActiveWindow(&widget); widget.activateWindow(); - QTest::qWait(125); - QVERIFY(widget1->hasFocus()); + QTest::qWaitForWindowShown(&widget); + QApplication::processEvents(); + QTRY_VERIFY(widget1->hasFocus()); } void tst_QGraphicsScene::style() @@ -3454,10 +3456,10 @@ void tst_QGraphicsScene::task139782_containsItemBoundingRect() void tst_QGraphicsScene::task176178_itemIndexMethodBreaksSceneRect() { - QGraphicsScene scene; - scene.setItemIndexMethod(QGraphicsScene::NoIndex); - QGraphicsRectItem *rect = new QGraphicsRectItem; - rect->setRect(0,0,100,100); + QGraphicsScene scene; + scene.setItemIndexMethod(QGraphicsScene::NoIndex); + QGraphicsRectItem *rect = new QGraphicsRectItem; + rect->setRect(0,0,100,100); scene.addItem(rect); QCOMPARE(scene.sceneRect(), rect->rect()); } @@ -3518,7 +3520,7 @@ void tst_QGraphicsScene::sorting_data() void tst_QGraphicsScene::sorting() { QFETCH(bool, cache); - + QGraphicsScene scene; scene.setSortCacheEnabled(cache); @@ -3552,15 +3554,15 @@ void tst_QGraphicsScene::sorting() c_2_1_1->setPos(-16, 16); c_2_2->setPos(-16, 28); c_2_2->setZValue(1); - - c_1->setFlag(QGraphicsItem::ItemIsMovable); - c_1_1->setFlag(QGraphicsItem::ItemIsMovable); - c_1_1_1->setFlag(QGraphicsItem::ItemIsMovable); - c_1_2->setFlag(QGraphicsItem::ItemIsMovable); - c_2->setFlag(QGraphicsItem::ItemIsMovable); - c_2_1->setFlag(QGraphicsItem::ItemIsMovable); - c_2_1_1->setFlag(QGraphicsItem::ItemIsMovable); - c_2_2->setFlag(QGraphicsItem::ItemIsMovable); + + c_1->setFlag(QGraphicsItem::ItemIsMovable); + c_1_1->setFlag(QGraphicsItem::ItemIsMovable); + c_1_1_1->setFlag(QGraphicsItem::ItemIsMovable); + c_1_2->setFlag(QGraphicsItem::ItemIsMovable); + c_2->setFlag(QGraphicsItem::ItemIsMovable); + c_2_1->setFlag(QGraphicsItem::ItemIsMovable); + c_2_1_1->setFlag(QGraphicsItem::ItemIsMovable); + c_2_2->setFlag(QGraphicsItem::ItemIsMovable); t_1->setData(0, "t_1"); c_1->setData(0, "c_1"); @@ -3585,7 +3587,7 @@ void tst_QGraphicsScene::sorting() foreach (QGraphicsItem *item, scene.items(32, 31, 4, 55)) qDebug() << "\t" << item->data(0).toString(); qDebug() << "}"; - + QCOMPARE(scene.items(32, 31, 4, 55), QList<QGraphicsItem *>() << c_1_2 << c_1_1_1 << c_1 << t_1); diff --git a/tests/auto/qstatusbar/tst_qstatusbar.cpp b/tests/auto/qstatusbar/tst_qstatusbar.cpp index 3727882..9774559 100644 --- a/tests/auto/qstatusbar/tst_qstatusbar.cpp +++ b/tests/auto/qstatusbar/tst_qstatusbar.cpp @@ -48,6 +48,8 @@ #include <QMainWindow> #include <QSizeGrip> +#include "../../shared/util.h" + //TESTED_CLASS= //TESTED_FILES= @@ -177,7 +179,7 @@ void tst_QStatusBar::setSizeGripEnabled() qt_x11_wait_for_window_manager(&mainWindow); #endif - QVERIFY(statusBar->isVisible()); + QTRY_VERIFY(statusBar->isVisible()); QPointer<QSizeGrip> sizeGrip = qFindChild<QSizeGrip *>(statusBar); QVERIFY(sizeGrip); QVERIFY(sizeGrip->isVisible()); @@ -223,11 +225,8 @@ void tst_QStatusBar::setSizeGripEnabled() qApp->processEvents(); mainWindow.showNormal(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&mainWindow); -#endif qApp->processEvents(); - QVERIFY(sizeGrip->isVisible()); + QTRY_VERIFY(sizeGrip->isVisible()); } void tst_QStatusBar::task194017_hiddenWidget() diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp index 0a6b7ad..e96bcf9 100644 --- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp +++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp @@ -230,7 +230,7 @@ void tst_QWindowSurface::grabWidget() parentWidget.show(); QTest::qWaitForWindowShown(&parentWidget); - QTest::qWait(120); + QTest::qWait(220); QPixmap parentPixmap = parentWidget.windowSurface()->grabWidget(&parentWidget); QPixmap childPixmap = childWidget.windowSurface()->grabWidget(&childWidget); |