pmaports/unity8/ubuntu-ui-toolkit/0005-Adjust-for-removed-QTest-waitForEvents-method.patch

687 lines
28 KiB
Diff
Raw Normal View History

From 83d90533ebcef429fd7499c5e6ad856e42062820 Mon Sep 17 00:00:00 2001
From: Luca Weiss <luca@z3ntu.xyz>
Date: Sun, 30 Dec 2018 22:53:00 +0100
Subject: [PATCH 5/5] Adjust for removed QTest::waitForEvents() method
See https://github.com/qt/qtbase/commit/75e583b3fcbdbbb999633eb5f2267720dd695cfa
---
.../tst_deprecated_theme_engine.cpp | 4 +-
.../src/tst_i18n_LocalizedApp.cpp | 2 +-
.../src/tst_i18n_RelativeTime.cpp | 2 +-
.../tst_inversemouseareatest.cpp | 32 +++----
tests/unit/mainview11/tst_mainview.cpp | 2 +-
tests/unit/mainview13/tst_mainview.cpp | 2 +-
.../mousefilters/tst_mousefilterstest.cpp | 96 +++++++++----------
tests/unit/performance/tst_performance.cpp | 2 +-
tests/unit/statesaver/tst_statesaver.cpp | 2 +-
tests/unit/subtheming/tst_subtheming.cpp | 2 +-
10 files changed, 73 insertions(+), 73 deletions(-)
diff --git a/tests/unit/deprecated_theme_engine/tst_deprecated_theme_engine.cpp b/tests/unit/deprecated_theme_engine/tst_deprecated_theme_engine.cpp
index 19bea4c5f..94b0edf1c 100644
--- a/tests/unit/deprecated_theme_engine/tst_deprecated_theme_engine.cpp
+++ b/tests/unit/deprecated_theme_engine/tst_deprecated_theme_engine.cpp
@@ -56,13 +56,13 @@ public:
void setTheme(const QString &theme)
{
rootObject()->setProperty("themeName", theme);
- QTest::waitForEvents();
+ qApp->processEvents();
}
void setStyle(const QString &style)
{
rootObject()->setProperty("styleDocument", style);
- QTest::waitForEvents();
+ qApp->processEvents();
}
};
diff --git a/tests/unit/i18n/LocalizedApp/src/tst_i18n_LocalizedApp.cpp b/tests/unit/i18n/LocalizedApp/src/tst_i18n_LocalizedApp.cpp
index 8333460fd..84da303ad 100644
--- a/tests/unit/i18n/LocalizedApp/src/tst_i18n_LocalizedApp.cpp
+++ b/tests/unit/i18n/LocalizedApp/src/tst_i18n_LocalizedApp.cpp
@@ -57,7 +57,7 @@ public:
{
// load the document
view->setSource(QUrl::fromLocalFile(document));
- QTest::waitForEvents();
+ qApp->processEvents();
return view->rootObject();
}
diff --git a/tests/unit/i18n/RelativeTime/src/tst_i18n_RelativeTime.cpp b/tests/unit/i18n/RelativeTime/src/tst_i18n_RelativeTime.cpp
index 957a9570b..abd497e07 100644
--- a/tests/unit/i18n/RelativeTime/src/tst_i18n_RelativeTime.cpp
+++ b/tests/unit/i18n/RelativeTime/src/tst_i18n_RelativeTime.cpp
@@ -57,7 +57,7 @@ public:
{
// load the document
view->setSource(QUrl::fromLocalFile(document));
- QTest::waitForEvents();
+ qApp->processEvents();
return view->rootObject();
}
diff --git a/tests/unit/inversemousearea/tst_inversemouseareatest.cpp b/tests/unit/inversemousearea/tst_inversemouseareatest.cpp
index 19736ca5c..9fd448a66 100644
--- a/tests/unit/inversemousearea/tst_inversemouseareatest.cpp
+++ b/tests/unit/inversemousearea/tst_inversemouseareatest.cpp
@@ -97,7 +97,7 @@ private Q_SLOTS:
// connect pressed signal to capture mouse object
QObject::connect(area, SIGNAL(pressed(QQuickMouseEvent*)), this, SLOT(capturePressed(QQuickMouseEvent*)));
QTest::mouseClick(quickView.data(), Qt::LeftButton, Qt::NoModifier, QPoint(10, 10));
- QTest::waitForEvents();
+ qApp->processEvents();
QVERIFY(eventCleanup.isEmpty());
}
@@ -110,7 +110,7 @@ private Q_SLOTS:
// connect pressed signal to capture mouse object
QObject::connect(area, SIGNAL(pressed(QQuickMouseEvent*)), this, SLOT(capturePressed(QQuickMouseEvent*)));
QTest::mouseClick(quickView.data(), Qt::LeftButton, Qt::NoModifier, QPoint(10, 10));
- QTest::waitForEvents();
+ qApp->processEvents();
QVERIFY(eventCleanup.isEmpty());
}
@@ -119,7 +119,7 @@ private Q_SLOTS:
QScopedPointer<InverseMouseAreaTest> quickView(new InverseMouseAreaTest("SensingAreaError.qml"));
QTest::mouseClick(quickView.data(), Qt::LeftButton, 0, QPoint(20, 20));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(quickView->rootObject()->property("log").toString(), QString("IMA"));
}
@@ -134,7 +134,7 @@ private Q_SLOTS:
quickView->findItem<QQuickItem*>("clickArea");
QTest::mouseClick(l[0], Qt::LeftButton, 0, QPoint(20, 10));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(quickView->rootObject()->property("log").toString(), QString("IMA"));
}
@@ -143,7 +143,7 @@ private Q_SLOTS:
QScopedPointer<InverseMouseAreaTest> quickView(new InverseMouseAreaTest("OverlappedMouseArea.qml"));
QTest::mouseClick(quickView.data(), Qt::LeftButton, 0, QPoint(20, 10));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(quickView->rootObject()->property("log").toString(), QString("MA"));
}
@@ -161,7 +161,7 @@ private Q_SLOTS:
// click in the top rectangle, use 800msec delay to prevent dblclick detection
QTest::mouseClick(quickView.data(), Qt::LeftButton, 0, QPoint(10, 10), DOUBLECLICK_TIMEOUT);
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(ma1Spy.count(), 0);
QCOMPARE(ma2Spy.count(), 0);
QCOMPARE(imaSpy.count(), 1);
@@ -169,7 +169,7 @@ private Q_SLOTS:
// click in the second rectangle, use 800msec delay to prevent dblclick detection
QTest::mouseClick(quickView.data(), Qt::LeftButton, 0, QPoint(10, 65), DOUBLECLICK_TIMEOUT);
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(ma1Spy.count(), 0);
QCOMPARE(ma2Spy.count(), 0);
QCOMPARE(imaSpy.count(), 1);
@@ -177,7 +177,7 @@ private Q_SLOTS:
// click in the button, use 800msec delay to prevent dblclick detection
QTest::mouseClick(quickView.data(), Qt::LeftButton, 0, QPoint(25, 85), DOUBLECLICK_TIMEOUT);
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(ma1Spy.count(), 0);
QCOMPARE(ma2Spy.count(), 1);
QCOMPARE(imaSpy.count(), 0);
@@ -185,14 +185,14 @@ private Q_SLOTS:
// double click in the second rectangle
QSignalSpy imaDSpy(area, SIGNAL(doubleClicked(QQuickMouseEvent*)));
QTest::mouseDClick(quickView.data(), Qt::LeftButton, 0, QPoint(10, 65));
- QTest::waitForEvents();
+ qApp->processEvents();
// FIXME: this is flaky
QCOMPARE(imaDSpy.count(), 1);
imaDSpy.clear();
// double click in the first rectangle
QTest::mouseDClick(quickView.data(), Qt::LeftButton, 0, QPoint(10, 10));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(imaDSpy.count(), 1);
imaDSpy.clear();
}
@@ -210,21 +210,21 @@ private Q_SLOTS:
QSignalSpy ma2Spy(ma2, SIGNAL(pressed(QQuickMouseEvent*)));
QTest::mouseClick(quickView.data(), Qt::LeftButton, 0, QPoint(10, 10), DOUBLECLICK_TIMEOUT);
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(ma1Spy.count(), 1);
QCOMPARE(ma2Spy.count(), 0);
QCOMPARE(imaSpy.count(), 1);
ma1Spy.clear(); imaSpy.clear();
QTest::mouseClick(quickView.data(), Qt::LeftButton, 0, QPoint(10, 65), DOUBLECLICK_TIMEOUT);
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(ma1Spy.count(), 0);
QCOMPARE(ma2Spy.count(), 1);
QCOMPARE(imaSpy.count(), 1);
ma2Spy.clear(); imaSpy.clear();
QTest::mouseClick(quickView.data(), Qt::LeftButton, 0, QPoint(25, 80), DOUBLECLICK_TIMEOUT);
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(ma1Spy.count(), 0);
QCOMPARE(ma2Spy.count(), 1);
QCOMPARE(imaSpy.count(), 0);
@@ -253,21 +253,21 @@ private Q_SLOTS:
// click on the topmost rectangle
QTest::mouseClick(quickView.data(), Qt::LeftButton, 0, QPoint(10, 10), DOUBLECLICK_TIMEOUT);
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(ma2Spy.count(), 0);
QCOMPARE(imaSpy.count(), 1);
imaSpy.clear();
// click on the second rectangle
QTest::mouseClick(quickView.data(), Qt::LeftButton, 0, QPoint(10, 65), DOUBLECLICK_TIMEOUT);
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(ma2Spy.count(), 0);
QCOMPARE(imaSpy.count(), 1);
imaSpy.clear();
// click on the button
QTest::mouseClick(quickView.data(), Qt::LeftButton, 0, QPoint(25, 85), DOUBLECLICK_TIMEOUT);
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(ma2Spy.count(), 1);
QCOMPARE(imaSpy.count(), 0);
diff --git a/tests/unit/mainview11/tst_mainview.cpp b/tests/unit/mainview11/tst_mainview.cpp
index f1e68f4c6..e9ae2257a 100644
--- a/tests/unit/mainview11/tst_mainview.cpp
+++ b/tests/unit/mainview11/tst_mainview.cpp
@@ -57,7 +57,7 @@ public:
{
// load the document
view->setSource(QUrl::fromLocalFile(document));
- QTest::waitForEvents();
+ qApp->processEvents();
return view->rootObject();
}
diff --git a/tests/unit/mainview13/tst_mainview.cpp b/tests/unit/mainview13/tst_mainview.cpp
index 36c5c78cc..287dd75ee 100644
--- a/tests/unit/mainview13/tst_mainview.cpp
+++ b/tests/unit/mainview13/tst_mainview.cpp
@@ -57,7 +57,7 @@ public:
{
// load the document
view->setSource(QUrl::fromLocalFile(document));
- QTest::waitForEvents();
+ qApp->processEvents();
return view->rootObject();
}
diff --git a/tests/unit/mousefilters/tst_mousefilterstest.cpp b/tests/unit/mousefilters/tst_mousefilterstest.cpp
index 955289a07..dc0b28bac 100644
--- a/tests/unit/mousefilters/tst_mousefilterstest.cpp
+++ b/tests/unit/mousefilters/tst_mousefilterstest.cpp
@@ -146,7 +146,7 @@ private Q_SLOTS:
preventDblClick();
QTest::mouseClick(view.data(), Qt::LeftButton, 0, guPoint(2, 2));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(view->rootObject()->hasFocus(), true);
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 1);
@@ -175,7 +175,7 @@ private Q_SLOTS:
preventDblClick();
QTest::mouseClick(view.data(), Qt::LeftButton, 0, guPoint(2, 2));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(view->rootObject()->hasFocus(), true);
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 1);
@@ -204,7 +204,7 @@ private Q_SLOTS:
preventDblClick();
QTest::mouseClick(view.data(), Qt::LeftButton, 0, guPoint(10, 10));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(view->rootObject()->hasFocus(), false);
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 1);
@@ -234,7 +234,7 @@ private Q_SLOTS:
preventDblClick();
QTest::mouseClick(view.data(), Qt::LeftButton, 0, guPoint(10, 10));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(view->rootObject()->hasFocus(), false);
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 1);
@@ -265,7 +265,7 @@ private Q_SLOTS:
QTest::mousePress(view.data(), Qt::LeftButton, 0, guPoint(2, 2));
QTest::mouseMove(view.data(), guPoint(2.2, 2.2));
QTest::mouseRelease(view.data(), Qt::LeftButton, 0, guPoint(2.2, 2.2));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(view->rootObject()->hasFocus(), true);
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 1);
@@ -296,7 +296,7 @@ private Q_SLOTS:
QTest::mousePress(view.data(), Qt::LeftButton, 0, guPoint(10, 10));
QTest::mouseMove(view.data(), guPoint(10.2, 10.2));
QTest::mouseRelease(view.data(), Qt::LeftButton, 0, guPoint(10.2, 10.2));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(view->rootObject()->hasFocus(), false);
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 1);
@@ -327,7 +327,7 @@ private Q_SLOTS:
QTest::mousePress(view.data(), Qt::LeftButton, 0, guPoint(2, 2));
QTest::mouseMove(view.data(), guPoint(2.7, 2.7));
QTest::mouseRelease(view.data(), Qt::LeftButton, 0, guPoint(2.7, 2.7));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(view->rootObject()->hasFocus(), true);
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 1);
@@ -358,7 +358,7 @@ private Q_SLOTS:
QTest::mousePress(view.data(), Qt::LeftButton, 0, guPoint(10, 10));
QTest::mouseMove(view.data(), guPoint(10.6, 10.6));
QTest::mouseRelease(view.data(), Qt::LeftButton, 0, guPoint(10.6, 10.6));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(view->rootObject()->hasFocus(), false);
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 1);
@@ -395,10 +395,10 @@ private Q_SLOTS:
// introduce small delay to suppress double clicks
preventDblClick();
QTest::mouseClick(view.data(), Qt::LeftButton, 0, guPoint(10, 10));
- QTest::waitForEvents();
+ qApp->processEvents();
preventDblClick();
QTest::mouseClick(view.data(), Qt::LeftButton, 0, guPoint(10, 69));
- QTest::waitForEvents();
+ qApp->processEvents();
if (!inputPanelPresent()) {
QEXPECT_FAIL(0, "No OSK installed", Abort);
}
@@ -432,7 +432,7 @@ private Q_SLOTS:
QTest::mousePress(view.data(), Qt::LeftButton, 0, guPoint(2, 2));
QTest::mouseMove(view.data(), guPoint(2.7, 2.7));
QTest::mouseRelease(view.data(), Qt::LeftButton, 0, guPoint(2.7, 2.7));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(view->rootObject()->hasFocus(), true);
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 1);
@@ -464,7 +464,7 @@ private Q_SLOTS:
QTest::mousePress(view.data(), Qt::LeftButton, 0, guPoint(10, 10));
QTest::mouseMove(view.data(), guPoint(10.5, 10.5));
QTest::mouseRelease(view.data(), Qt::LeftButton, 0, guPoint(10.5, 10.5));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(view->rootObject()->hasFocus(), false);
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 1);
@@ -496,7 +496,7 @@ private Q_SLOTS:
QTest::mousePress(view.data(), Qt::LeftButton, 0, guPoint(10, 10));
QTest::mouseMove(view.data(), guPoint(15, 15));
QTest::mouseRelease(view.data(), Qt::LeftButton, 0, guPoint(15, 15));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(view->rootObject()->hasFocus(), false);
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 1);
@@ -519,7 +519,7 @@ private Q_SLOTS:
preventDblClick();
mousePressAndHold(view.data(), Qt::LeftButton, 0, guPoint(2, 2));
QTest::mouseRelease(view.data(), Qt::LeftButton, 0, guPoint(2, 2));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(view->rootObject()->hasFocus(), true);
QCOMPARE(pressAndHold.count(), 1);
QCOMPARE(clicked.count(), 0);
@@ -536,7 +536,7 @@ private Q_SLOTS:
preventDblClick();
mousePressAndHold(view.data(), Qt::LeftButton, 0, guPoint(2, 2));
QTest::mouseRelease(view.data(), Qt::LeftButton, 0, guPoint(2, 2));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(view->rootObject()->hasFocus(), true);
QCOMPARE(pressAndHold.count(), 1);
QCOMPARE(clicked.count(), 1);
@@ -556,7 +556,7 @@ private Q_SLOTS:
preventDblClick();
QTest::mouseDClick(view.data(), Qt::LeftButton, 0, guPoint(2, 2));
- QTest::waitForEvents();
+ qApp->processEvents();
QVariant selectedText = input->property("selectedText");
QCOMPARE(input->hasFocus(), true);
QVERIFY(selectedText.isValid());
@@ -600,7 +600,7 @@ private Q_SLOTS:
preventDblClick();
QTest::mouseClick(view.data(), Qt::LeftButton, 0, guPoint(2, 2));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(input->hasFocus(), true);
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 1);
@@ -631,7 +631,7 @@ private Q_SLOTS:
preventDblClick();
QTest::mouseClick(view.data(), Qt::LeftButton, 0, guPoint(2, 2));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(input->hasFocus(), false);
// only the pressed was blocked, the rest of the events land in the proxy
QCOMPARE(pressed.count(), 0);
@@ -663,7 +663,7 @@ private Q_SLOTS:
preventDblClick();
QTest::mouseClick(view.data(), Qt::LeftButton, 0, guPoint(2, 2));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(input->hasFocus(), false);
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 1);
@@ -694,7 +694,7 @@ private Q_SLOTS:
preventDblClick();
QTest::mouseClick(view.data(), Qt::LeftButton, 0, guPoint(2, 2));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(input->hasFocus(), true);
QCOMPARE(pressed.count(), 0);
QCOMPARE(released.count(), 1);
@@ -725,7 +725,7 @@ private Q_SLOTS:
preventDblClick();
QTest::mouseClick(view.data(), Qt::LeftButton, 0, guPoint(2, 2));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(input->hasFocus(), false);
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 1);
@@ -756,7 +756,7 @@ private Q_SLOTS:
preventDblClick();
QTest::mouseClick(input->window(), Qt::LeftButton, 0, guPoint(10, 7));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(input->hasFocus(), true);
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 1);
@@ -780,7 +780,7 @@ private Q_SLOTS:
preventDblClick();
QTest::mouseDClick(input->window(), Qt::LeftButton, 0, guPoint(10, 7));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(input->hasFocus(), true);
QVariant selectedText = input->property("selectedText");
QVERIFY(selectedText.isValid());
@@ -807,7 +807,7 @@ private Q_SLOTS:
preventDblClick();
QTest::mouseClick(view.data(), Qt::LeftButton, 0, guPoint(2, 2));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(input->hasFocus(), true);
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 0);
@@ -843,9 +843,9 @@ private Q_SLOTS:
for (int i = 0; i < 30; i++) {
QTest::mouseMove(flickable->window(), guPoint(5 + i, 5 + i));
}
- QTest::waitForEvents();
+ qApp->processEvents();
QTest::mouseRelease(flickable->window(), Qt::LeftButton, 0, guPoint(35, 35));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 1);
@@ -883,7 +883,7 @@ private Q_SLOTS:
QTest::mouseMove(flickable->window(), guPoint(5 + i, 5 + i));
}
QTest::mouseRelease(flickable->window(), Qt::LeftButton, 0, guPoint(35, 35));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(pressed.count(), 1);
QCOMPARE(released.count(), 1);
@@ -913,7 +913,7 @@ private Q_SLOTS:
// Note: press inside the filtered area, so entered() exited() positionChanged() will
// all receive the pressed button
QTest::mousePress(view.data(), Qt::LeftButton, 0, guPoint(5, 5));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(entered.count(), 1);
// when entered(), buttons are the same as when pressed
QCOMPARE(mouseEventParams.handler, QString("EVENT1"));
@@ -921,12 +921,12 @@ private Q_SLOTS:
QTest::mouseMove(view.data(), guPoint(15, 5));
QTest::mouseMove(view.data(), guPoint(25, 5));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(mouseEvent2Params.handler, QString("EVENT2"));
QCOMPARE(mouseEvent2Params.pressedButton, Qt::LeftButton);
QTest::mouseRelease(view.data(), Qt::LeftButton, 0, guPoint(35, 5));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(exited.count(), 1);
// when entered(), button is the same when pressed, however buttons
// does no longer contains the button pressed
@@ -1005,14 +1005,14 @@ private Q_SLOTS:
//center of the view
QTest::mouseMove(view.data(), guPoint(1, 1));
QTest::mouseMove(view.data(), guPoint(15, 15));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(entered.count(), 1);
QCOMPARE(mouseEvent3Params.handler, QString("EVENT4"));
QCOMPARE(mouseEvent3Params.pressedButton, Qt::NoButton);
QTest::mousePress(view.data(), Qt::LeftButton, 0, guPoint(15, 15));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(mouseEventParams.handler, QString("EVENT1"));
QCOMPARE(mouseEventParams.pressedButton, Qt::LeftButton);
@@ -1020,7 +1020,7 @@ private Q_SLOTS:
//go out of the mousearea on the right
QTest::mouseMove(view.data(), guPoint(45, 15));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(mouseEvent2Params.handler, QString("EVENT2"));
QCOMPARE(mouseEvent2Params.pressedButton, Qt::LeftButton);
QCOMPARE(exited.count(), 1);
@@ -1029,7 +1029,7 @@ private Q_SLOTS:
//move back in
QTest::mouseMove(view.data(), guPoint(25, 15));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(mouseEvent2Params.handler, QString("EVENT2"));
QCOMPARE(mouseEvent2Params.pressedButton, Qt::LeftButton);
QCOMPARE(entered.count(), 2);
@@ -1038,7 +1038,7 @@ private Q_SLOTS:
//and out again
QTest::mouseMove(view.data(), guPoint(45, 15));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(mouseEvent2Params.handler, QString("EVENT2"));
QCOMPARE(mouseEvent2Params.pressedButton, Qt::LeftButton);
QCOMPARE(exited.count(), 2);
@@ -1046,7 +1046,7 @@ private Q_SLOTS:
QCOMPARE(mouseEvent3Params.pressedButton, Qt::LeftButton);
QTest::mouseRelease(view.data(), Qt::LeftButton, 0, guPoint(45, 15));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(positionChanged.count(), 4);
}
@@ -1104,13 +1104,13 @@ private Q_SLOTS:
// produce long press
// FIXME move this under UbuntuTestCase
mousePressAndHold(test.data(), Qt::LeftButton, 0, guPoint(20, 30));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(hostHoldSpy.count(), 1);
QCOMPARE(proxyHoldSpy.count(), 1);
// click
QTest::mouseRelease(test.data(), Qt::LeftButton, 0, guPoint(20, 30));
- QTest::waitForEvents();
+ qApp->processEvents();
}
void testCase_forwardComposedEventsToProxy_whenMoved()
@@ -1133,13 +1133,13 @@ private Q_SLOTS:
QTest::mouseMove(test.data(), guPoint(20 + i, 30 + i));
}
QTest::qWait(UCMouse::DefaultPressAndHoldDelay / 2 + 200);
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(hostHoldSpy.count(), 0);
QCOMPARE(proxyHoldSpy.count(), 0);
// click
QTest::mouseRelease(test.data(), Qt::LeftButton, 0, guPoint(20, 30));
- QTest::waitForEvents();
+ qApp->processEvents();
}
void testCase_forwardToChainedItems()
@@ -1162,7 +1162,7 @@ private Q_SLOTS:
QObject::connect(proxy2, SIGNAL(pressed(QQuickMouseEvent*,QQuickItem*)), this, SLOT(onMouseEvent3(QQuickMouseEvent*,QQuickItem*)));
QTest::mousePress(test.data(), Qt::LeftButton, 0, guPoint(20, 30));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(hostPressed.count(), 1);
QCOMPARE(proxy1Pressed.count(), 1);
QCOMPARE(proxy2Pressed.count(), 1);
@@ -1173,7 +1173,7 @@ private Q_SLOTS:
// click
QTest::mouseRelease(test.data(), Qt::LeftButton, 0, guPoint(20, 30));
- QTest::waitForEvents();
+ qApp->processEvents();
}
void testCase_ignoreSynthesizedEvents() {
@@ -1199,32 +1199,32 @@ private Q_SLOTS:
//send a touch event, which will be converted to a synthesized mouse event, since
//no item in this QML is handling touch events
UCTestExtras::touchPress(0, overlayArea, guPoint(15, 15));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(areaPressed.count(), 0);
QCOMPARE(overlayAreaPressed.count(), 1);
QCOMPARE(overlayFilterPressed.count(), 0);
UCTestExtras::touchRelease(0, overlayArea, guPoint(15, 15));
- QTest::waitForEvents();
+ qApp->processEvents();
overlayFilter->setProperty("ignoreSynthesizedEvents", false);
QCOMPARE(overlayFilter->property("ignoreSynthesizedEvents").toBool(), false);
UCTestExtras::touchPress(1, overlayArea, guPoint(15, 15));
- QTest::waitForEvents();
+ qApp->processEvents();
QCOMPARE(areaPressed.count(), 0);
//the filter doesn't accept the pressed event by default
QCOMPARE(overlayAreaPressed.count(), 2);
QCOMPARE(overlayFilterPressed.count(), 1);
UCTestExtras::touchRelease(1, overlayArea, guPoint(15, 15));
- QTest::waitForEvents();
+ qApp->processEvents();
overlayArea->setEnabled(false);
QCOMPARE(overlayArea->isEnabled(), false);
UCTestExtras::touchPress(2, overlayArea, guPoint(15, 15));
- QTest::waitForEvents();
+ qApp->processEvents();
//the filter gets the event but its owner is not enabled, so we expect it
//to propagate to the area underneath
@@ -1232,7 +1232,7 @@ private Q_SLOTS:
QCOMPARE(overlayAreaPressed.count(), 2);
QCOMPARE(overlayFilterPressed.count(), 2);
UCTestExtras::touchRelease(2, overlayArea, guPoint(15, 15));
- QTest::waitForEvents();
+ qApp->processEvents();
}
};
diff --git a/tests/unit/performance/tst_performance.cpp b/tests/unit/performance/tst_performance.cpp
index 605ef79c4..ce31de076 100644
--- a/tests/unit/performance/tst_performance.cpp
+++ b/tests/unit/performance/tst_performance.cpp
@@ -35,7 +35,7 @@ private:
QQuickItem *loadDocument(const QString &document)
{
quickView->setSource(QUrl::fromLocalFile(document));
- QTest::waitForEvents();
+ qApp->processEvents();
return quickView->rootObject();
}
diff --git a/tests/unit/statesaver/tst_statesaver.cpp b/tests/unit/statesaver/tst_statesaver.cpp
index 19c2a0c21..4c55d903d 100644
--- a/tests/unit/statesaver/tst_statesaver.cpp
+++ b/tests/unit/statesaver/tst_statesaver.cpp
@@ -458,7 +458,7 @@ private Q_SLOTS:
QVERIFY(topLoader);
topLoader->setProperty("source", "Dynamic.qml");
- QTest::waitForEvents();
+ qApp->processEvents();
QObject *testItem = view->rootObject()->findChild<QObject*>("testItem");
QVERIFY(testItem);
diff --git a/tests/unit/subtheming/tst_subtheming.cpp b/tests/unit/subtheming/tst_subtheming.cpp
index 77e099cee..1db1de29e 100644
--- a/tests/unit/subtheming/tst_subtheming.cpp
+++ b/tests/unit/subtheming/tst_subtheming.cpp
@@ -739,7 +739,7 @@ private Q_SLOTS:
void test_mixed_versions() {
ThemeTestCase::ignoreWarning("OtherVersion.qml", 19, 1, "QML StyledItem: Mixing of Ubuntu.Components module versions 1.3 and 1.2 detected!");
QScopedPointer<ThemeTestCase> view(new ThemeTestCase("OtherVersion.qml"));
- QTest::waitForEvents();
+ qApp->processEvents();
UCStyledItemBase *newStyled = static_cast<UCStyledItemBase*>(view->rootObject());
UCStyledItemBase *otherStyled = view->findItem<UCStyledItemBase*>("otherStyled");
QCOMPARE(UCStyledItemBasePrivate::get(newStyled)->styleInstance()->objectName(), QString("OptionSelector13"));
--
2.20.1