@@ -53,8 +53,8 @@ private Q_SLOTS:
53 void initTestCase() {} // will be called before the first test function is executed
53 void initTestCase() {} // will be called before the first test function is executed
54 void cleanupTestCase() {} // will be called after the last test function was executed.
54 void cleanupTestCase() {} // will be called after the last test function was executed.
56− void init() {} // called right before each and every test function is executed
56+ void init(); // called right before each and every test function is executed
57− void cleanup() {} // called right after each and every test function is executed
57+ void cleanup(); // called right after each and every test function is executed
59 void requestWithNoCandidates();
59 void requestWithNoCandidates();
60 void lateCandidateRequestGetsNothing();
60 void lateCandidateRequestGetsNothing();
@@ -67,11 +67,23 @@ private Q_SLOTS:
67 void rejectingTouchfterItsEnd();
67 void rejectingTouchfterItsEnd();
68 void removeOldUndecidedCandidates();
68 void removeOldUndecidedCandidates();
69 void interimOwnerWontGetUnownedTouchEvents();
69 void interimOwnerWontGetUnownedTouchEvents();
72+ TouchRegistry *touchRegistry;
75+void tst_TouchRegistry::init()
77+ touchRegistry = TouchRegistry::instance();
80+void tst_TouchRegistry::cleanup()
82+ delete touchRegistry;
72void tst_TouchRegistry::requestWithNoCandidates()
85void tst_TouchRegistry::requestWithNoCandidates()
74− TouchRegistry touchRegistry;
75 DummyCandidate candidate;
87 DummyCandidate candidate;
@@ -83,17 +95,16 @@ void tst_TouchRegistry::requestWithNoCandidates()
83 Qt::NoModifier,
95 Qt::NoModifier,
84 Qt::TouchPointPressed,
96 Qt::TouchPointPressed,
85 touchPoints);
97 touchPoints);
86− touchRegistry.update(&touchEvent);
98+ touchRegistry->update(&touchEvent);
89− touchRegistry.requestTouchOwnership(0, &candidate);
101+ touchRegistry->requestTouchOwnership(0, &candidate);
91 QVERIFY(candidate.ownedTouches.contains(0));
103 QVERIFY(candidate.ownedTouches.contains(0));
94void tst_TouchRegistry::lateCandidateRequestGetsNothing()
106void tst_TouchRegistry::lateCandidateRequestGetsNothing()
96− TouchRegistry touchRegistry;
97 DummyCandidate earlyCandidate;
108 DummyCandidate earlyCandidate;
98 earlyCandidate.setObjectName("early");
109 earlyCandidate.setObjectName("early");
99 DummyCandidate lateCandidate;
110 DummyCandidate lateCandidate;
@@ -108,21 +119,21 @@ void tst_TouchRegistry::lateCandidateRequestGetsNothing()
108 Qt::NoModifier,
119 Qt::NoModifier,
109 Qt::TouchPointPressed,
120 Qt::TouchPointPressed,
110 touchPoints);
121 touchPoints);
111− touchRegistry.update(&touchEvent);
122+ touchRegistry->update(&touchEvent);
114− touchRegistry.addCandidateOwnerForTouch(0, &earlyCandidate);
125+ touchRegistry->addCandidateOwnerForTouch(0, &earlyCandidate);
115− touchRegistry.addCandidateOwnerForTouch(0, &lateCandidate);
126+ touchRegistry->addCandidateOwnerForTouch(0, &lateCandidate);
117 QVERIFY(earlyCandidate.ownedTouches.isEmpty());
128 QVERIFY(earlyCandidate.ownedTouches.isEmpty());
118 QVERIFY(lateCandidate.ownedTouches.isEmpty());
129 QVERIFY(lateCandidate.ownedTouches.isEmpty());
120− touchRegistry.requestTouchOwnership(0, &lateCandidate);
131+ touchRegistry->requestTouchOwnership(0, &lateCandidate);
122 QVERIFY(earlyCandidate.ownedTouches.isEmpty());
133 QVERIFY(earlyCandidate.ownedTouches.isEmpty());
123 QVERIFY(lateCandidate.ownedTouches.isEmpty());
134 QVERIFY(lateCandidate.ownedTouches.isEmpty());
125− touchRegistry.requestTouchOwnership(0, &earlyCandidate);
136+ touchRegistry->requestTouchOwnership(0, &earlyCandidate);
127 QVERIFY(earlyCandidate.ownedTouches.contains(0));
138 QVERIFY(earlyCandidate.ownedTouches.contains(0));
128 QVERIFY(lateCandidate.ownedTouches.isEmpty());
139 QVERIFY(lateCandidate.ownedTouches.isEmpty());
@@ -130,7 +141,6 @@ void tst_TouchRegistry::lateCandidateRequestGetsNothing()
131void tst_TouchRegistry::lateCandidateGestOwnershipOnceEarlyCandidateQuits()
142void tst_TouchRegistry::lateCandidateGestOwnershipOnceEarlyCandidateQuits()
133− TouchRegistry touchRegistry;
134 DummyCandidate earlyCandidate;
144 DummyCandidate earlyCandidate;
135 DummyCandidate lateCandidate;
145 DummyCandidate lateCandidate;
@@ -143,21 +153,21 @@ void tst_TouchRegistry::lateCandidateGestOwnershipOnceEarlyCandidateQuits()
143 Qt::NoModifier,
153 Qt::NoModifier,
144 Qt::TouchPointPressed,
154 Qt::TouchPointPressed,
145 touchPoints);
155 touchPoints);
146− touchRegistry.update(&touchEvent);
156+ touchRegistry->update(&touchEvent);
149− touchRegistry.addCandidateOwnerForTouch(0, &earlyCandidate);
159+ touchRegistry->addCandidateOwnerForTouch(0, &earlyCandidate);
150− touchRegistry.addCandidateOwnerForTouch(0, &lateCandidate);
160+ touchRegistry->addCandidateOwnerForTouch(0, &lateCandidate);
152 QVERIFY(earlyCandidate.ownedTouches.isEmpty());
162 QVERIFY(earlyCandidate.ownedTouches.isEmpty());
153 QVERIFY(lateCandidate.ownedTouches.isEmpty());
163 QVERIFY(lateCandidate.ownedTouches.isEmpty());
155− touchRegistry.requestTouchOwnership(0, &lateCandidate);
165+ touchRegistry->requestTouchOwnership(0, &lateCandidate);
157 QVERIFY(earlyCandidate.ownedTouches.isEmpty());
167 QVERIFY(earlyCandidate.ownedTouches.isEmpty());
158 QVERIFY(lateCandidate.ownedTouches.isEmpty());
168 QVERIFY(lateCandidate.ownedTouches.isEmpty());
160− touchRegistry.removeCandidateOwnerForTouch(0, &earlyCandidate);
170+ touchRegistry->removeCandidateOwnerForTouch(0, &earlyCandidate);
162 QVERIFY(earlyCandidate.ownedTouches.isEmpty());
172 QVERIFY(earlyCandidate.ownedTouches.isEmpty());
163 QVERIFY(lateCandidate.ownedTouches.contains(0));
173 QVERIFY(lateCandidate.ownedTouches.contains(0));
@@ -165,7 +175,6 @@ void tst_TouchRegistry::lateCandidateGestOwnershipOnceEarlyCandidateQuits()
166void tst_TouchRegistry::dispatchesTouchEventsToCandidates()
176void tst_TouchRegistry::dispatchesTouchEventsToCandidates()
168− TouchRegistry touchRegistry;
169 QQuickItem rootItem;
178 QQuickItem rootItem;
171 DummyCandidate candidate0;
180 DummyCandidate candidate0;
@@ -190,10 +199,10 @@ void tst_TouchRegistry::dispatchesTouchEventsToCandidates()
190 Qt::NoModifier,
199 Qt::NoModifier,
191 Qt::TouchPointPressed,
200 Qt::TouchPointPressed,
192 touchPoints);
201 touchPoints);
193− touchRegistry.update(&touchEvent);
202+ touchRegistry->update(&touchEvent);
196− touchRegistry.addCandidateOwnerForTouch(0, &candidate0);
205+ touchRegistry->addCandidateOwnerForTouch(0, &candidate0);
199 QList<QTouchEvent::TouchPoint> touchPoints;
208 QList<QTouchEvent::TouchPoint> touchPoints;
@@ -208,7 +217,7 @@ void tst_TouchRegistry::dispatchesTouchEventsToCandidates()
208 Qt::NoModifier,
217 Qt::NoModifier,
209 Qt::TouchPointPressed | Qt::TouchPointMoved,
218 Qt::TouchPointPressed | Qt::TouchPointMoved,
210 touchPoints);
219 touchPoints);
211− touchRegistry.update(&touchEvent);
220+ touchRegistry->update(&touchEvent);
214 // candidate0 should have received an update on the touch he's interested on.
223 // candidate0 should have received an update on the touch he's interested on.
@@ -220,7 +229,7 @@ void tst_TouchRegistry::dispatchesTouchEventsToCandidates()
220 QCOMPARE(candidate0.unownedTouchEvents[0].touchPoints[0].rect().x(), 11 - candidate0.x());
229 QCOMPARE(candidate0.unownedTouchEvents[0].touchPoints[0].rect().x(), 11 - candidate0.x());
221 QCOMPARE(candidate0.unownedTouchEvents[0].touchPoints[0].rect().y(), 11 - candidate0.y());
230 QCOMPARE(candidate0.unownedTouchEvents[0].touchPoints[0].rect().y(), 11 - candidate0.y());
223− touchRegistry.addCandidateOwnerForTouch(1, &candidate1);
232+ touchRegistry->addCandidateOwnerForTouch(1, &candidate1);
226 QList<QTouchEvent::TouchPoint> touchPoints;
235 QList<QTouchEvent::TouchPoint> touchPoints;
@@ -235,7 +244,7 @@ void tst_TouchRegistry::dispatchesTouchEventsToCandidates()
235 Qt::NoModifier,
244 Qt::NoModifier,
236 Qt::TouchPointPressed | Qt::TouchPointMoved,
245 Qt::TouchPointPressed | Qt::TouchPointMoved,
237 touchPoints);
246 touchPoints);
238− touchRegistry.update(&touchEvent);
247+ touchRegistry->update(&touchEvent);
241 // candidate0 gets updates only for touch 0 and
250 // candidate0 gets updates only for touch 0 and
@@ -252,7 +261,6 @@ void tst_TouchRegistry::dispatchesTouchEventsToCandidates()
253void tst_TouchRegistry::dispatchesTouchEventsToWatchers()
262void tst_TouchRegistry::dispatchesTouchEventsToWatchers()
255− TouchRegistry touchRegistry;
256 QQuickItem rootItem;
264 QQuickItem rootItem;
258 DummyCandidate watcher;
266 DummyCandidate watcher;
@@ -271,10 +279,10 @@ void tst_TouchRegistry::dispatchesTouchEventsToWatchers()
271 Qt::NoModifier,
279 Qt::NoModifier,
272 Qt::TouchPointPressed,
280 Qt::TouchPointPressed,
273 touchPoints);
281 touchPoints);
274− touchRegistry.update(&touchEvent);
282+ touchRegistry->update(&touchEvent);
277− touchRegistry.addTouchWatcher(0, &watcher);
285+ touchRegistry->addTouchWatcher(0, &watcher);
280 QList<QTouchEvent::TouchPoint> touchPoints;
288 QList<QTouchEvent::TouchPoint> touchPoints;
@@ -289,7 +297,7 @@ void tst_TouchRegistry::dispatchesTouchEventsToWatchers()
289 Qt::NoModifier,
297 Qt::NoModifier,
290 Qt::TouchPointPressed | Qt::TouchPointMoved,
298 Qt::TouchPointPressed | Qt::TouchPointMoved,
291 touchPoints);
299 touchPoints);
292− touchRegistry.update(&touchEvent);
300+ touchRegistry->update(&touchEvent);
295 // watcher should have received an update on the touch he's interested on.
303 // watcher should have received an update on the touch he's interested on.
@@ -314,7 +322,7 @@ void tst_TouchRegistry::dispatchesTouchEventsToWatchers()
314 Qt::NoModifier,
322 Qt::NoModifier,
315 Qt::TouchPointPressed | Qt::TouchPointMoved,
323 Qt::TouchPointPressed | Qt::TouchPointMoved,
316 touchPoints);
324 touchPoints);
317− touchRegistry.update(&touchEvent);
325+ touchRegistry->update(&touchEvent);
320 // watcher gets updates only for touch 0
328 // watcher gets updates only for touch 0
@@ -326,7 +334,6 @@ void tst_TouchRegistry::dispatchesTouchEventsToWatchers()
327void tst_TouchRegistry::keepDispatchingToWatchersAfterLastCandidateGivesUp()
335void tst_TouchRegistry::keepDispatchingToWatchersAfterLastCandidateGivesUp()
329− TouchRegistry touchRegistry;
330 DummyCandidate item;
337 DummyCandidate item;
@@ -338,10 +345,10 @@ void tst_TouchRegistry::keepDispatchingToWatchersAfterLastCandidateGivesUp()
338 Qt::NoModifier,
345 Qt::NoModifier,
339 Qt::TouchPointPressed,
346 Qt::TouchPointPressed,
340 touchPoints);
347 touchPoints);
341− touchRegistry.update(&touchEvent);
348+ touchRegistry->update(&touchEvent);
344− touchRegistry.addCandidateOwnerForTouch(0, &item);
351+ touchRegistry->addCandidateOwnerForTouch(0, &item);
347 QList<QTouchEvent::TouchPoint> touchPoints;
354 QList<QTouchEvent::TouchPoint> touchPoints;
@@ -354,7 +361,7 @@ void tst_TouchRegistry::keepDispatchingToWatchersAfterLastCandidateGivesUp()
354 Qt::NoModifier,
361 Qt::NoModifier,
355 Qt::TouchPointPressed | Qt::TouchPointMoved,
362 Qt::TouchPointPressed | Qt::TouchPointMoved,
356 touchPoints);
363 touchPoints);
357− touchRegistry.update(&touchEvent);
364+ touchRegistry->update(&touchEvent);
360 QCOMPARE(item.unownedTouchEvents.count(), 1);
367 QCOMPARE(item.unownedTouchEvents.count(), 1);
@@ -362,7 +369,7 @@ void tst_TouchRegistry::keepDispatchingToWatchersAfterLastCandidateGivesUp()
362 QCOMPARE(item.unownedTouchEvents[0].touchPoints[0].id(), 0);
369 QCOMPARE(item.unownedTouchEvents[0].touchPoints[0].id(), 0);
363 item.unownedTouchEvents.clear();
370 item.unownedTouchEvents.clear();
365− touchRegistry.addTouchWatcher(1, &item);
372+ touchRegistry->addTouchWatcher(1, &item);
368 QList<QTouchEvent::TouchPoint> touchPoints;
375 QList<QTouchEvent::TouchPoint> touchPoints;
@@ -375,7 +382,7 @@ void tst_TouchRegistry::keepDispatchingToWatchersAfterLastCandidateGivesUp()
375 Qt::NoModifier,
382 Qt::NoModifier,
376 Qt::TouchPointMoved,
383 Qt::TouchPointMoved,
377 touchPoints);
384 touchPoints);
378− touchRegistry.update(&touchEvent);
385+ touchRegistry->update(&touchEvent);
381 QCOMPARE(item.unownedTouchEvents.count(), 1);
388 QCOMPARE(item.unownedTouchEvents.count(), 1);
@@ -395,7 +402,7 @@ void tst_TouchRegistry::keepDispatchingToWatchersAfterLastCandidateGivesUp()
395 Qt::NoModifier,
402 Qt::NoModifier,
396 Qt::TouchPointReleased | Qt::TouchPointMoved,
403 Qt::TouchPointReleased | Qt::TouchPointMoved,
397 touchPoints);
404 touchPoints);
398− touchRegistry.update(&touchEvent);
405+ touchRegistry->update(&touchEvent);
401 QCOMPARE(item.unownedTouchEvents.count(), 1);
408 QCOMPARE(item.unownedTouchEvents.count(), 1);
@@ -404,7 +411,7 @@ void tst_TouchRegistry::keepDispatchingToWatchersAfterLastCandidateGivesUp()
404 QVERIFY(item.unownedTouchEvents[0].containsTouchWithId(1));
411 QVERIFY(item.unownedTouchEvents[0].containsTouchWithId(1));
405 item.unownedTouchEvents.clear();
412 item.unownedTouchEvents.clear();
407− touchRegistry.removeCandidateOwnerForTouch(0, &item);
414+ touchRegistry->removeCandidateOwnerForTouch(0, &item);
410 QList<QTouchEvent::TouchPoint> touchPoints;
417 QList<QTouchEvent::TouchPoint> touchPoints;
@@ -415,7 +422,7 @@ void tst_TouchRegistry::keepDispatchingToWatchersAfterLastCandidateGivesUp()
415 Qt::NoModifier,
422 Qt::NoModifier,
416 Qt::TouchPointReleased,
423 Qt::TouchPointReleased,
417 touchPoints);
424 touchPoints);
418− touchRegistry.update(&touchEvent);
425+ touchRegistry->update(&touchEvent);
421 QCOMPARE(item.unownedTouchEvents.count(), 1);
428 QCOMPARE(item.unownedTouchEvents.count(), 1);
@@ -423,7 +430,7 @@ void tst_TouchRegistry::keepDispatchingToWatchersAfterLastCandidateGivesUp()
423 QVERIFY(item.unownedTouchEvents[0].containsTouchWithId(1));
430 QVERIFY(item.unownedTouchEvents[0].containsTouchWithId(1));
424 item.unownedTouchEvents.clear();
431 item.unownedTouchEvents.clear();
426− QVERIFY(touchRegistry.m_touchInfoPool.isEmpty());
433+ QVERIFY(touchRegistry->m_touchInfoPool.isEmpty());
@@ -432,7 +439,6 @@ void tst_TouchRegistry::keepDispatchingToWatchersAfterLastCandidateGivesUp()
433void tst_TouchRegistry::candidatesAndWatchers_1()
440void tst_TouchRegistry::candidatesAndWatchers_1()
435− TouchRegistry touchRegistry;
436 DummyCandidate item;
442 DummyCandidate item;
@@ -444,10 +450,10 @@ void tst_TouchRegistry::candidatesAndWatchers_1()
444 Qt::NoModifier,
450 Qt::NoModifier,
445 Qt::TouchPointPressed,
451 Qt::TouchPointPressed,
446 touchPoints);
452 touchPoints);
447− touchRegistry.update(&touchEvent);
453+ touchRegistry->update(&touchEvent);
450− touchRegistry.addCandidateOwnerForTouch(0, &item);
456+ touchRegistry->addCandidateOwnerForTouch(0, &item);
453 QList<QTouchEvent::TouchPoint> touchPoints;
459 QList<QTouchEvent::TouchPoint> touchPoints;
@@ -460,14 +466,14 @@ void tst_TouchRegistry::candidatesAndWatchers_1()
460 Qt::NoModifier,
466 Qt::NoModifier,
461 Qt::TouchPointPressed | Qt::TouchPointMoved,
467 Qt::TouchPointPressed | Qt::TouchPointMoved,
462 touchPoints);
468 touchPoints);
463− touchRegistry.update(&touchEvent);
469+ touchRegistry->update(&touchEvent);
466− touchRegistry.addTouchWatcher(1, &item);
472+ touchRegistry->addTouchWatcher(1, &item);
468− touchRegistry.removeCandidateOwnerForTouch(0, &item);
474+ touchRegistry->removeCandidateOwnerForTouch(0, &item);
470− touchRegistry.addTouchWatcher(0, &item);
476+ touchRegistry->addTouchWatcher(0, &item);
473 QList<QTouchEvent::TouchPoint> touchPoints;
479 QList<QTouchEvent::TouchPoint> touchPoints;
@@ -480,7 +486,7 @@ void tst_TouchRegistry::candidatesAndWatchers_1()
480 Qt::NoModifier,
486 Qt::NoModifier,
481 Qt::TouchPointReleased | Qt::TouchPointMoved,
487 Qt::TouchPointReleased | Qt::TouchPointMoved,
482 touchPoints);
488 touchPoints);
483− touchRegistry.update(&touchEvent);
489+ touchRegistry->update(&touchEvent);
@@ -492,10 +498,10 @@ void tst_TouchRegistry::candidatesAndWatchers_1()
492 Qt::NoModifier,
498 Qt::NoModifier,
493 Qt::TouchPointReleased,
499 Qt::TouchPointReleased,
494 touchPoints);
500 touchPoints);
495− touchRegistry.update(&touchEvent);
501+ touchRegistry->update(&touchEvent);
498− QVERIFY(touchRegistry.m_touchInfoPool.isEmpty());
504+ QVERIFY(touchRegistry->m_touchInfoPool.isEmpty());
500 item.unownedTouchEvents.clear();
506 item.unownedTouchEvents.clear();
@@ -508,7 +514,7 @@ void tst_TouchRegistry::candidatesAndWatchers_1()
508 Qt::NoModifier,
514 Qt::NoModifier,
509 Qt::TouchPointPressed,
515 Qt::TouchPointPressed,
510 touchPoints);
516 touchPoints);
511− touchRegistry.update(&touchEvent);
517+ touchRegistry->update(&touchEvent);
514 // Haven't made any subscription for that new touch 0.
520 // Haven't made any subscription for that new touch 0.
@@ -521,8 +527,6 @@ void tst_TouchRegistry::candidatesAndWatchers_1()
522void tst_TouchRegistry::candidatesAndWatchers_2()
528void tst_TouchRegistry::candidatesAndWatchers_2()
524− TouchRegistry touchRegistry;
526 DummyCandidate directionalDragArea;
530 DummyCandidate directionalDragArea;
527 directionalDragArea.setObjectName("DirectionalDragArea");
531 directionalDragArea.setObjectName("DirectionalDragArea");
@@ -539,14 +543,14 @@ void tst_TouchRegistry::candidatesAndWatchers_2()
539 Qt::NoModifier,
543 Qt::NoModifier,
540 Qt::TouchPointPressed,
544 Qt::TouchPointPressed,
541 touchPoints);
545 touchPoints);
542− touchRegistry.update(&touchEvent);
546+ touchRegistry->update(&touchEvent);
545 // [TouchRegistry] addCandidateOwnerForTouch id 0 candidate DirectionalDragArea
549 // [TouchRegistry] addCandidateOwnerForTouch id 0 candidate DirectionalDragArea
546− touchRegistry.addCandidateOwnerForTouch(0, &directionalDragArea);
550+ touchRegistry->addCandidateOwnerForTouch(0, &directionalDragArea);
548 // [TouchRegistry] requestTouchOwnership id 0 candidate TouchGate
552 // [TouchRegistry] requestTouchOwnership id 0 candidate TouchGate
549− touchRegistry.requestTouchOwnership(0, &touchGate);
553+ touchRegistry->requestTouchOwnership(0, &touchGate);
551 //[TouchRegistry] got TouchUpdate (id:0, state:moved, scenePos:(147,1023)) (id:1, state:pressed, scenePos:(327,792))
555 //[TouchRegistry] got TouchUpdate (id:0, state:moved, scenePos:(147,1023)) (id:1, state:pressed, scenePos:(327,792))
@@ -560,24 +564,24 @@ void tst_TouchRegistry::candidatesAndWatchers_2()
560 Qt::NoModifier,
564 Qt::NoModifier,
561 Qt::TouchPointPressed | Qt::TouchPointMoved,
565 Qt::TouchPointPressed | Qt::TouchPointMoved,
562 touchPoints);
566 touchPoints);
563− touchRegistry.update(&touchEvent);
567+ touchRegistry->update(&touchEvent);
566 // [TouchRegistry] addTouchWatcher id 1 watcher DirectionalDragArea
570 // [TouchRegistry] addTouchWatcher id 1 watcher DirectionalDragArea
567− touchRegistry.addTouchWatcher(1, &directionalDragArea);
571+ touchRegistry->addTouchWatcher(1, &directionalDragArea);
569 // [TouchRegistry] removeCandidateOwnerForTouch id 0 candidate DirectionalDragArea
573 // [TouchRegistry] removeCandidateOwnerForTouch id 0 candidate DirectionalDragArea
570− touchRegistry.removeCandidateOwnerForTouch(0, &directionalDragArea);
574+ touchRegistry->removeCandidateOwnerForTouch(0, &directionalDragArea);
572 //[TouchRegistry] sending TouchWonershipEvent(id = 0 gained) to candidate TouchGate
576 //[TouchRegistry] sending TouchWonershipEvent(id = 0 gained) to candidate TouchGate
573 QCOMPARE(touchGate.ownedTouches.count(), 1);
577 QCOMPARE(touchGate.ownedTouches.count(), 1);
574 QVERIFY(touchGate.ownedTouches.contains(0));
578 QVERIFY(touchGate.ownedTouches.contains(0));
576 // [TouchRegistry] addTouchWatcher id 0 watcher DirectionalDragArea
580 // [TouchRegistry] addTouchWatcher id 0 watcher DirectionalDragArea
577− touchRegistry.addTouchWatcher(0, &directionalDragArea);
581+ touchRegistry->addTouchWatcher(0, &directionalDragArea);
579 // [TouchRegistry] requestTouchOwnership id 1 candidate TouchGate
583 // [TouchRegistry] requestTouchOwnership id 1 candidate TouchGate
580− touchRegistry.requestTouchOwnership(1, &touchGate);
584+ touchRegistry->requestTouchOwnership(1, &touchGate);
582 //[TouchRegistry] sending TouchWonershipEvent(id = 1 gained) to candidate TouchGate
586 //[TouchRegistry] sending TouchWonershipEvent(id = 1 gained) to candidate TouchGate
583 QCOMPARE(touchGate.ownedTouches.count(), 2);
587 QCOMPARE(touchGate.ownedTouches.count(), 2);
@@ -598,7 +602,7 @@ void tst_TouchRegistry::candidatesAndWatchers_2()
598 Qt::NoModifier,
602 Qt::NoModifier,
599 Qt::TouchPointMoved,
603 Qt::TouchPointMoved,
600 touchPoints);
604 touchPoints);
601− touchRegistry.update(&touchEvent);
605+ touchRegistry->update(&touchEvent);
604 //vvvvv DDA Watchers are being ignored from now on vvvvvvv
608 //vvvvv DDA Watchers are being ignored from now on vvvvvvv
@@ -624,7 +628,7 @@ void tst_TouchRegistry::candidatesAndWatchers_2()
624 Qt::NoModifier,
628 Qt::NoModifier,
625 Qt::TouchPointMoved | Qt::TouchPointReleased,
629 Qt::TouchPointMoved | Qt::TouchPointReleased,
626 touchPoints);
630 touchPoints);
627− touchRegistry.update(&touchEvent);
631+ touchRegistry->update(&touchEvent);
630 QCOMPARE(directionalDragArea.unownedTouchEvents.count(), 1);
634 QCOMPARE(directionalDragArea.unownedTouchEvents.count(), 1);
@@ -646,7 +650,7 @@ void tst_TouchRegistry::candidatesAndWatchers_2()
646 Qt::NoModifier,
650 Qt::NoModifier,
647 Qt::TouchPointReleased,
651 Qt::TouchPointReleased,
648 touchPoints);
652 touchPoints);
649− touchRegistry.update(&touchEvent);
653+ touchRegistry->update(&touchEvent);
652 QCOMPARE(directionalDragArea.unownedTouchEvents.count(), 1);
656 QCOMPARE(directionalDragArea.unownedTouchEvents.count(), 1);
@@ -658,7 +662,6 @@ void tst_TouchRegistry::candidatesAndWatchers_2()
659void tst_TouchRegistry::rejectingTouchfterItsEnd()
663void tst_TouchRegistry::rejectingTouchfterItsEnd()
661− TouchRegistry touchRegistry;
662 DummyCandidate earlyCandidate;
665 DummyCandidate earlyCandidate;
663 DummyCandidate lateCandidate;
666 DummyCandidate lateCandidate;
@@ -671,16 +674,16 @@ void tst_TouchRegistry::rejectingTouchfterItsEnd()
671 Qt::NoModifier,
674 Qt::NoModifier,
672 Qt::TouchPointPressed,
675 Qt::TouchPointPressed,
673 touchPoints);
676 touchPoints);
674− touchRegistry.update(&touchEvent);
677+ touchRegistry->update(&touchEvent);
677− touchRegistry.addCandidateOwnerForTouch(0, &earlyCandidate);
680+ touchRegistry->addCandidateOwnerForTouch(0, &earlyCandidate);
678− touchRegistry.addCandidateOwnerForTouch(0, &lateCandidate);
681+ touchRegistry->addCandidateOwnerForTouch(0, &lateCandidate);
680 QVERIFY(earlyCandidate.ownedTouches.isEmpty());
683 QVERIFY(earlyCandidate.ownedTouches.isEmpty());
681 QVERIFY(lateCandidate.ownedTouches.isEmpty());
684 QVERIFY(lateCandidate.ownedTouches.isEmpty());
683− touchRegistry.requestTouchOwnership(0, &lateCandidate);
686+ touchRegistry->requestTouchOwnership(0, &lateCandidate);
685 QVERIFY(earlyCandidate.ownedTouches.isEmpty());
688 QVERIFY(earlyCandidate.ownedTouches.isEmpty());
686 QVERIFY(lateCandidate.ownedTouches.isEmpty());
689 QVERIFY(lateCandidate.ownedTouches.isEmpty());
@@ -694,25 +697,25 @@ void tst_TouchRegistry::rejectingTouchfterItsEnd()
694 Qt::NoModifier,
697 Qt::NoModifier,
695 Qt::TouchPointPressed,
698 Qt::TouchPointPressed,
696 touchPoints);
699 touchPoints);
697− touchRegistry.update(&touchEvent);
700+ touchRegistry->update(&touchEvent);
700 QVERIFY(earlyCandidate.ownedTouches.isEmpty());
703 QVERIFY(earlyCandidate.ownedTouches.isEmpty());
701 QVERIFY(lateCandidate.ownedTouches.isEmpty());
704 QVERIFY(lateCandidate.ownedTouches.isEmpty());
703− touchRegistry.removeCandidateOwnerForTouch(0, &earlyCandidate);
706+ touchRegistry->removeCandidateOwnerForTouch(0, &earlyCandidate);
705 QCOMPARE(lateCandidate.ownedTouches.count(), 1);
708 QCOMPARE(lateCandidate.ownedTouches.count(), 1);
706 QCOMPARE(lateCandidate.ownedTouches.contains(0), 1);
709 QCOMPARE(lateCandidate.ownedTouches.contains(0), 1);
708 // Check that there's no trace left of touch 0 as we no longer need to keep tabs on it.
711 // Check that there's no trace left of touch 0 as we no longer need to keep tabs on it.
709− QVERIFY(!touchRegistry.findTouchInfo(0));
712+ QVERIFY(!touchRegistry->findTouchInfo(0));
712void tst_TouchRegistry::removeOldUndecidedCandidates()
715void tst_TouchRegistry::removeOldUndecidedCandidates()
714 FakeTimerFactory *fakeTimerFactory = new FakeTimerFactory;
717 FakeTimerFactory *fakeTimerFactory = new FakeTimerFactory;
715− TouchRegistry *touchRegistry = new TouchRegistry(nullptr, fakeTimerFactory);
718+ touchRegistry->setTimerFactory(fakeTimerFactory);
717 DummyCandidate undecidedCandidate;
720 DummyCandidate undecidedCandidate;
718 undecidedCandidate.setObjectName("undecided");
721 undecidedCandidate.setObjectName("undecided");
@@ -749,8 +752,6 @@ void tst_TouchRegistry::removeOldUndecidedCandidates()
749 QVERIFY(undecidedCandidate.lostTouches.contains(0));
752 QVERIFY(undecidedCandidate.lostTouches.contains(0));
750 QVERIFY(candidateThatWantsTouch.ownedTouches.contains(0));
753 QVERIFY(candidateThatWantsTouch.ownedTouches.contains(0));
751 QVERIFY(candidateThatWantsTouch.lostTouches.isEmpty());
754 QVERIFY(candidateThatWantsTouch.lostTouches.isEmpty());
753− delete touchRegistry;
@@ -762,7 +763,7 @@ void tst_TouchRegistry::removeOldUndecidedCandidates()
762void tst_TouchRegistry::interimOwnerWontGetUnownedTouchEvents()
763void tst_TouchRegistry::interimOwnerWontGetUnownedTouchEvents()
764 FakeTimerFactory *fakeTimerFactory = new FakeTimerFactory;
765 FakeTimerFactory *fakeTimerFactory = new FakeTimerFactory;
765− TouchRegistry *touchRegistry = new TouchRegistry(nullptr, fakeTimerFactory);
766+ touchRegistry->setTimerFactory(fakeTimerFactory);
767 DummyCandidate undecidedCandidate;
768 DummyCandidate undecidedCandidate;
768 undecidedCandidate.setObjectName("undecided");
769 undecidedCandidate.setObjectName("undecided");
@@ -814,8 +815,6 @@ void tst_TouchRegistry::interimOwnerWontGetUnownedTouchEvents()
815 QCOMPARE(undecidedCandidate.unownedTouchEvents.count(), 2);
816 QCOMPARE(undecidedCandidate.unownedTouchEvents.count(), 2);
816 QCOMPARE(interimOwner.unownedTouchEvents.count(), 0);
817 QCOMPARE(interimOwner.unownedTouchEvents.count(), 0);
818− delete touchRegistry;
821////////////// TouchMemento //////////
820////////////// TouchMemento //////////