@@ -31,7 +31,6 @@ TestUtil::TestUtil(QObject *parent)
3131 : QObject(parent)
3232 , m_targetWindow(0)
3333 , m_touchDevice(0)
34− , m_installedTouchRegistry(false)
3534{
3635}
3736
@@ -83,30 +82,19 @@ void TestUtil::ensureTouchDevice()
8382
8483void TestUtil::ensureTouchRegistryInstalled()
8584{
86− if (m_installedTouchRegistry)
85+ if (TouchRegistry::instance())
8786 return;
8887
89− TouchRegistry *touchRegistry;
90− if (TouchRegistry::instance() == nullptr) {
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);
94− } else {
95− touchRegistry = TouchRegistry::instance();
96− if (touchRegistry->parent() != this) {
97− // someone else created it. leave it alone
98− m_installedTouchRegistry = true;
99− }
100− }
88+ if (!m_targetWindow)
89+ return;
10190
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);
10394
104− if (m_targetWindow) {
105− QQuickView *view = qobject_cast<QQuickView*>(m_targetWindow);
106− if (view) {
107− view->installEventFilter(touchRegistry);
108− touchRegistry->setParent(view);
109− m_installedTouchRegistry = true;
110− }
95+ QQuickView *view = qobject_cast<QQuickView*>(m_targetWindow);
96+ if (view) {
97+ view->installEventFilter(touchRegistry);
98+ touchRegistry->setParent(view);
11199 }
112100}