@@ -31,7 +31,6 @@ TestUtil::TestUtil(QObject *parent)
31 : QObject(parent)
31 : QObject(parent)
32 , m_targetWindow(0)
32 , m_targetWindow(0)
33 , m_touchDevice(0)
33 , m_touchDevice(0)
34− , m_installedTouchRegistry(false)
@@ -83,30 +82,19 @@ void TestUtil::ensureTouchDevice()
84void TestUtil::ensureTouchRegistryInstalled()
83void TestUtil::ensureTouchRegistryInstalled()
86− if (m_installedTouchRegistry)
85+ if (TouchRegistry::instance())
89− TouchRegistry *touchRegistry;
88+ if (!m_targetWindow)
90− if (TouchRegistry::instance() == nullptr) {
89+ return;
91− // Tests can be *very* slow to run and we don't want things timing out because
92− // of that. So give it fake timers to use (they will never time out)
93− touchRegistry = new TouchRegistry(this, new FakeTimerFactory);
95− touchRegistry = TouchRegistry::instance();
96− if (touchRegistry->parent() != this) {
97− // someone else created it. leave it alone
98− m_installedTouchRegistry = true;
102− ensureTargetWindow();
91+ // Tests can be *very* slow to run and we don't want things timing out because
92+ // of that. So give it fake timers to use (they will never time out)
93+ TouchRegistry *touchRegistry = new TouchRegistry(this, new FakeTimerFactory);
104− if (m_targetWindow) {
105− QQuickView *view = qobject_cast<QQuickView*>(m_targetWindow);
95+ QQuickView *view = qobject_cast<QQuickView*>(m_targetWindow);
106− if (view) {
96+ if (view) {
107− view->installEventFilter(touchRegistry);
97+ view->installEventFilter(touchRegistry);
108− touchRegistry->setParent(view);
98+ touchRegistry->setParent(view);
109− m_installedTouchRegistry = true;