aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-03-01 20:25:51 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2021-03-01 22:26:07 +0100
commit0b6e5504afc05bb3dbb16275efb0faaa50abc412 (patch)
tree6179b25dfc28e32350353fa6f49cfdff394d8fb5 /tests
parenta0d73125882a7a937d0d13348c8657ba81d50080 (diff)
tests: Do not delete device prematurely
The delivery agent expects the device to live longer than itself. Pick-to: 6.1 Change-Id: I3c837633f2c4a91f5b370df4d486a01b2ee05f13 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/focus/tst_focus.cpp5
-rw-r--r--tests/auto/qquickpopup/tst_qquickpopup.cpp2
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);