tst_Gestures: Use QTest::qWaitForWindowExposed()
Instead of a local wrapper for it. Change-Id: I0708dfad44b3db0c7a13e75ba5b4193ab50ac315 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>bb10
parent
2660aefdbc
commit
e69b6d2dbc
|
|
@ -43,24 +43,6 @@
|
|||
|
||||
#include <qdebug.h>
|
||||
|
||||
static bool waitForWindowExposed(QWindow *window)
|
||||
{
|
||||
if (!window)
|
||||
return false;
|
||||
#ifdef Q_OS_OSX
|
||||
QTest::qWait(100);
|
||||
return window->isExposed();
|
||||
#endif
|
||||
return QTest::qWaitForWindowExposed(window);
|
||||
}
|
||||
|
||||
static bool waitForWindowExposed(QWidget *widget)
|
||||
{
|
||||
if (!widget)
|
||||
return false;
|
||||
return waitForWindowExposed(widget->windowHandle());
|
||||
}
|
||||
|
||||
static QPointF mapToGlobal(const QPointF &pt, QGraphicsItem *item, QGraphicsView *view)
|
||||
{
|
||||
return view->viewport()->mapToGlobal(view->mapFromScene(item->mapToScene(pt)));
|
||||
|
|
@ -376,7 +358,7 @@ void tst_Gestures::customGesture()
|
|||
GestureWidget widget;
|
||||
widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
|
||||
widget.show();
|
||||
QVERIFY(waitForWindowExposed(&widget));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
|
||||
CustomEvent event;
|
||||
event.hotSpot = widget.mapToGlobal(QPoint(5,5));
|
||||
|
|
@ -845,7 +827,7 @@ void tst_Gestures::graphicsItemGesture()
|
|||
item->setPos(100, 100);
|
||||
|
||||
view.show();
|
||||
QVERIFY(waitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
view.ensureVisible(scene.sceneRect());
|
||||
|
||||
item->grabGesture(CustomGesture::GestureType);
|
||||
|
|
@ -907,7 +889,7 @@ void tst_Gestures::graphicsView()
|
|||
item->setPos(100, 100);
|
||||
|
||||
view.show();
|
||||
QVERIFY(waitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
view.ensureVisible(scene.sceneRect());
|
||||
|
||||
item->grabGesture(CustomGesture::GestureType);
|
||||
|
|
@ -983,7 +965,7 @@ void tst_Gestures::graphicsItemTreeGesture()
|
|||
item1_child2->setParentItem(item1);
|
||||
|
||||
view.show();
|
||||
QVERIFY(waitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
view.ensureVisible(scene.sceneRect());
|
||||
|
||||
item1->grabGesture(CustomGesture::GestureType);
|
||||
|
|
@ -1040,7 +1022,7 @@ void tst_Gestures::explicitGraphicsObjectTarget()
|
|||
item2_child1->setPos(10, 10);
|
||||
|
||||
view.show();
|
||||
QVERIFY(waitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
view.ensureVisible(scene.sceneRect());
|
||||
|
||||
item1->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
|
||||
|
|
@ -1099,7 +1081,7 @@ void tst_Gestures::gestureOverChildGraphicsItem()
|
|||
item2_child1->setPos(0, 0);
|
||||
|
||||
view.show();
|
||||
QVERIFY(waitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
view.ensureVisible(scene.sceneRect());
|
||||
|
||||
item1->grabGesture(CustomGesture::GestureType);
|
||||
|
|
@ -1397,7 +1379,7 @@ void tst_Gestures::testMapToScene()
|
|||
item0->setPos(14, 16);
|
||||
|
||||
view.show(); // need to show to give it a global coordinate
|
||||
QVERIFY(waitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
view.ensureVisible(scene.sceneRect());
|
||||
|
||||
QPoint origin = view.mapToGlobal(QPoint());
|
||||
|
|
@ -1523,7 +1505,7 @@ void tst_Gestures::autoCancelGestures()
|
|||
parent.grabGesture(CustomGesture::GestureType);
|
||||
child->grabGesture(secondGesture);
|
||||
parent.show();
|
||||
QVERIFY(waitForWindowExposed(&parent));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&parent));
|
||||
|
||||
/*
|
||||
An event is sent to both the child and the parent, when the child gets it a gesture is triggered
|
||||
|
|
@ -1582,7 +1564,7 @@ void tst_Gestures::autoCancelGestures2()
|
|||
child->grabGesture(secondGesture);
|
||||
|
||||
view.show();
|
||||
QVERIFY(waitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
view.ensureVisible(scene.sceneRect());
|
||||
|
||||
CustomEvent event;
|
||||
|
|
@ -1628,7 +1610,7 @@ void tst_Gestures::graphicsViewParentPropagation()
|
|||
item1_c1_c1->setPos(0, 0);
|
||||
|
||||
view.show();
|
||||
QVERIFY(waitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
view.ensureVisible(scene.sceneRect());
|
||||
|
||||
item0->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures | Qt::IgnoredGesturesPropagateToParent);
|
||||
|
|
@ -1698,7 +1680,7 @@ void tst_Gestures::panelPropagation()
|
|||
item1_child1_child1->setZValue(10);
|
||||
|
||||
view.show();
|
||||
QVERIFY(waitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
view.ensureVisible(scene.sceneRect());
|
||||
|
||||
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
|
||||
|
|
@ -1809,7 +1791,7 @@ void tst_Gestures::panelStacksBehindParent()
|
|||
panel->setZValue(5);
|
||||
|
||||
view.show();
|
||||
QVERIFY(waitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
view.ensureVisible(scene.sceneRect());
|
||||
|
||||
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
|
||||
|
|
@ -1893,7 +1875,7 @@ void tst_Gestures::deleteGestureTargetItem()
|
|||
items.insert(item2->objectName(), item2);
|
||||
|
||||
view.show();
|
||||
QVERIFY(waitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
view.ensureVisible(scene.sceneRect());
|
||||
|
||||
if (propagateUpdateGesture)
|
||||
|
|
@ -1938,7 +1920,7 @@ void tst_Gestures::viewportCoordinates()
|
|||
scene.addItem(item1);
|
||||
|
||||
view.show();
|
||||
QVERIFY(waitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
view.ensureVisible(scene.sceneRect());
|
||||
|
||||
CustomEvent event;
|
||||
|
|
@ -1975,7 +1957,7 @@ void tst_Gestures::partialGesturePropagation()
|
|||
scene.addItem(item4);
|
||||
|
||||
view.show();
|
||||
QVERIFY(waitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
view.ensureVisible(scene.sceneRect());
|
||||
|
||||
item1->ignoredUpdatedGestures << CustomGesture::GestureType;
|
||||
|
|
@ -2063,7 +2045,7 @@ void tst_Gestures::testQGestureRecognizerCleanup()
|
|||
//QGestureRecognizer::registerRecognizer(new PanRecognizer(PanRecognizer::Custom));
|
||||
|
||||
w->show();
|
||||
QVERIFY(waitForWindowExposed(w));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(w));
|
||||
delete w;
|
||||
}
|
||||
|
||||
|
|
@ -2184,7 +2166,7 @@ void tst_Gestures::testReuseCanceledGestures()
|
|||
gv->viewport()->grabGesture(tapGestureTypeId);
|
||||
|
||||
mw.show();
|
||||
QVERIFY(waitForWindowExposed(&mw));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&mw));
|
||||
|
||||
QPoint targetPos(gv->mapFromScene(target->mapToScene(target->rect().center())));
|
||||
targetPos = gv->viewport()->mapFromParent(targetPos);
|
||||
|
|
@ -2250,7 +2232,7 @@ void tst_Gestures::conflictingGesturesInGraphicsView()
|
|||
scene.addItem(item2);
|
||||
|
||||
view.show();
|
||||
QVERIFY(waitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
view.ensureVisible(scene.sceneRect());
|
||||
|
||||
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
|
||||
|
|
@ -2315,7 +2297,7 @@ void tst_Gestures::bug_13501_gesture_not_accepted()
|
|||
NoConsumeWidgetBug13501 w;
|
||||
w.grabGesture(Qt::TapGesture);
|
||||
w.show();
|
||||
QVERIFY(waitForWindowExposed(&w));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&w));
|
||||
//QTest::mousePress(&ignoreEvent, Qt::LeftButton);
|
||||
QTouchDevice *device = QTest::createTouchDevice();
|
||||
QTest::touchEvent(&w, device).press(0, QPoint(10, 10), &w);
|
||||
|
|
|
|||
Loading…
Reference in New Issue