tst_QTouchEvent: Wait for window exposed instead of active

This makes the tests pass on Wayland compositors that don't automatically give
focus to newly created windows. Such as a headless Weston, which is very useful
for testing.

Task-number: QTBUG-66846
Change-Id: I502504b333499c89be193a3ebc19d41264a13580
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
This commit is contained in:
Johan Klokkhammer Helsing 2018-04-06 14:37:22 +02:00 committed by Johan Helsing
parent 5ffd47b764
commit b451c9dfdc

View File

@ -608,7 +608,7 @@ void tst_QTouchEvent::basicRawEventTranslation()
touchWidget.setAttribute(Qt::WA_AcceptTouchEvents);
touchWidget.setGeometry(100, 100, 400, 300);
touchWidget.show();
QVERIFY(QTest::qWaitForWindowActive(&touchWidget));
QVERIFY(QTest::qWaitForWindowExposed(&touchWidget));
QPointF pos = touchWidget.rect().center();
QPointF screenPos = touchWidget.mapToGlobal(pos.toPoint());
@ -741,7 +741,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
rightWidget.setGeometry(300, 100, 100, 100);
touchWidget.show();
QVERIFY(QTest::qWaitForWindowActive(&touchWidget));
QVERIFY(QTest::qWaitForWindowExposed(&touchWidget));
QPointF leftPos = leftWidget.rect().center();
QPointF rightPos = rightWidget.rect().center();
@ -968,7 +968,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
rightWidget.setGeometry(300, 100, 100, 100);
touchWidget.show();
QVERIFY(QTest::qWaitForWindowActive(&touchWidget));
QVERIFY(QTest::qWaitForWindowExposed(&touchWidget));
QPointF leftPos = leftWidget.rect().center();
QPointF rightPos = rightWidget.rect().center();
@ -1184,7 +1184,7 @@ void tst_QTouchEvent::basicRawEventTranslationOfIds()
touchWidget.setAttribute(Qt::WA_AcceptTouchEvents);
touchWidget.setGeometry(100, 100, 400, 300);
touchWidget.show();
QVERIFY(QTest::qWaitForWindowActive(&touchWidget));
QVERIFY(QTest::qWaitForWindowExposed(&touchWidget));
QVarLengthArray<QPointF, 2> pos;
QVarLengthArray<QPointF, 2> screenPos;