diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-03-01 20:25:51 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-03-01 23:08:50 +0000 |
commit | 4b34c15fa09995097aba901d96003a54c4a67296 (patch) | |
tree | 9adeb608ca3510527ec53e035179477268b589ba /tests | |
parent | 3d24946a1ae953270fc4779e3de2291b602e82e8 (diff) |
tests: Do not delete device prematurely
The delivery agent expects the device to live longer than itself.
Change-Id: I3c837633f2c4a91f5b370df4d486a01b2ee05f13
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 0b6e5504afc05bb3dbb16275efb0faaa50abc412)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/focus/tst_focus.cpp | 5 | ||||
-rw-r--r-- | tests/auto/qquickpopup/tst_qquickpopup.cpp | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/tests/auto/focus/tst_focus.cpp b/tests/auto/focus/tst_focus.cpp index b3f7c9a1..06c57efe 100644 --- a/tests/auto/focus/tst_focus.cpp +++ b/tests/auto/focus/tst_focus.cpp @@ -144,6 +144,7 @@ void tst_focus::policy() QFETCH(QString, name); QQmlEngine engine; + QScopedPointer<QPointingDevice> device(QTest::createTouchDevice()); QQmlComponent component(&engine); component.setData(QString("import QtQuick.Controls; ApplicationWindow { width: 100; height: 100; %1 { anchors.fill: parent } }").arg(name).toUtf8(), QUrl()); @@ -160,8 +161,6 @@ void tst_focus::policy() window->requestActivate(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QScopedPointer<QPointingDevice> device(QTest::createTouchDevice()); - control->setFocusPolicy(Qt::NoFocus); QCOMPARE(control->focusPolicy(), Qt::NoFocus); @@ -340,6 +339,7 @@ void tst_focus::scope() QQmlComponent component(&engine); component.setData(QString("import QtQuick; import QtQuick.Controls; ApplicationWindow { property alias child: child; width: 100; height: 100; %1 { anchors.fill: parent; Item { id: child; width: 10; height: 10 } } }").arg(name).toUtf8(), QUrl()); + QScopedPointer<QPointingDevice> device(QTest::createTouchDevice()); QScopedPointer<QQuickApplicationWindow> window(qobject_cast<QQuickApplicationWindow *>(component.create())); QVERIFY2(window, qPrintable(component.errorString())); @@ -356,7 +356,6 @@ void tst_focus::scope() window->requestActivate(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QScopedPointer<QPointingDevice> device(QTest::createTouchDevice()); child->forceActiveFocus(); QVERIFY(child->hasActiveFocus()); diff --git a/tests/auto/qquickpopup/tst_qquickpopup.cpp b/tests/auto/qquickpopup/tst_qquickpopup.cpp index c02b47fc..442b99fa 100644 --- a/tests/auto/qquickpopup/tst_qquickpopup.cpp +++ b/tests/auto/qquickpopup/tst_qquickpopup.cpp @@ -215,6 +215,7 @@ void tst_QQuickPopup::overlay() QFETCH(bool, modal); QFETCH(bool, dim); + QScopedPointer<QPointingDevice> device(QTest::createTouchDevice()); QQuickApplicationHelper helper(this, source); QVERIFY2(helper.ready, helper.failureMessage()); @@ -305,7 +306,6 @@ void tst_QQuickPopup::overlay() QVERIFY(popup->isVisible()); QVERIFY(overlay->isVisible()); - QScopedPointer<QPointingDevice> device(QTest::createTouchDevice()); QTest::touchEvent(window, device.data()).press(0, QPoint(1, 1)); QCOMPARE(overlayPressedSignal.count(), ++overlayPressCount); |