68
72
void removeOldUndecidedCandidates();
69
73
void interimOwnerWontGetUnownedTouchEvents();
70
74
void candidateVanishes();
75
void candicateOwnershipReentrace();
73
78
TouchRegistry *touchRegistry;
864
869
QVERIFY(mainCandidate.ownedTouches.contains(0));
873
Regression test for canidate reentrance
875
Bug caused by candidates getting removed during ownership resolution
877
void tst_TouchRegistry::candicateOwnershipReentrace()
879
DummyCandidate mainCandidate;
880
DummyCandidate candicate2;
881
DummyCandidate candicate3;
884
QList<QTouchEvent::TouchPoint> touchPoints;
885
touchPoints.append(QTouchEvent::TouchPoint(0));
886
touchPoints[0].setState(Qt::TouchPointPressed);
887
QTouchEvent touchEvent(QEvent::TouchBegin,
890
Qt::TouchPointPressed,
892
touchRegistry->update(&touchEvent);
896
connect(&candicate2, &DummyCandidate::lostOwnership, this, [&]() {
897
touchRegistry->removeCandidateOwnerForTouch(0, &candicate2);
900
touchRegistry->addCandidateOwnerForTouch(0, &mainCandidate);
901
touchRegistry->addCandidateOwnerForTouch(0, &candicate2);
902
touchRegistry->addCandidateOwnerForTouch(0, &candicate3);
905
QList<QTouchEvent::TouchPoint> touchPoints;
906
touchPoints.append(QTouchEvent::TouchPoint(0));
907
touchPoints[0].setState(Qt::TouchPointMoved);
908
QTouchEvent touchEvent(QEvent::TouchUpdate,
913
touchRegistry->update(&touchEvent);
916
touchRegistry->requestTouchOwnership(0, &mainCandidate);
918
QCOMPARE(mainCandidate.ownedTouches.count(), 1);
919
QCOMPARE(candicate2.lostTouches.count(), 1);
920
QCOMPARE(candicate3.lostTouches.count(), 1);
867
923
////////////// TouchMemento //////////
869
925
TouchMemento::TouchMemento(const QTouchEvent *touchEvent)
898
954
if (touchOwnershipEvent->gained()) {
899
955
ownedTouches.insert(touchOwnershipEvent->touchId());
956
Q_EMIT gainedOwnership();
901
958
lostTouches.insert(touchOwnershipEvent->touchId());
959
Q_EMIT lostOwnership();
904
962
} else if (e->type() == UnownedTouchEvent::unownedTouchEventType()) {