Changeset View
Changeset View
Standalone View
Standalone View
autotests/client/test_pointer_constraints.cpp
Show First 20 Lines • Show All 244 Lines • ▼ Show 20 Line(s) | 180 | { | |||
---|---|---|---|---|---|
245 | QCOMPARE(serverLockedPointer->isLocked(), true); | 245 | QCOMPARE(serverLockedPointer->isLocked(), true); | ||
246 | m_seatInterface->setPointerPos(QPoint(1, 1)); | 246 | m_seatInterface->setPointerPos(QPoint(1, 1)); | ||
247 | QCOMPARE(lockedChangedSpy.count(), 1); | 247 | QCOMPARE(lockedChangedSpy.count(), 1); | ||
248 | QCOMPARE(pointerMotionSpy.count(), 1); | 248 | QCOMPARE(pointerMotionSpy.count(), 1); | ||
249 | QVERIFY(lockedSpy.isEmpty()); | 249 | QVERIFY(lockedSpy.isEmpty()); | ||
250 | QVERIFY(lockedSpy.wait()); | 250 | QVERIFY(lockedSpy.wait()); | ||
251 | QVERIFY(unlockedSpy.isEmpty()); | 251 | QVERIFY(unlockedSpy.isEmpty()); | ||
252 | 252 | | |||
253 | const QPointF hint = QPointF(1.5, 0.5); | ||||
254 | QSignalSpy hintChangedSpy(serverLockedPointer.data(), &LockedPointerInterface::cursorPositionHintChanged); | ||||
255 | lockedPointer->setCursorPositionHint(hint); | ||||
256 | QCOMPARE(serverLockedPointer->cursorPositionHint(), QPointF(-1., -1.)); | ||||
257 | surface->commit(Surface::CommitFlag::None); | ||||
258 | QVERIFY(hintChangedSpy.wait()); | ||||
davidedmundson: We should check the value of hintChangedSpy.first() to properly test it.
Also, use something… | |||||
259 | QCOMPARE(serverLockedPointer->cursorPositionHint(), hint); | ||||
260 | | ||||
253 | // and unlock again | 261 | // and unlock again | ||
254 | serverLockedPointer->setLocked(false); | 262 | serverLockedPointer->setLocked(false); | ||
255 | QCOMPARE(serverLockedPointer->isLocked(), false); | 263 | QCOMPARE(serverLockedPointer->isLocked(), false); | ||
264 | QCOMPARE(serverLockedPointer->cursorPositionHint(), QPointF(-1., -1.)); | ||||
256 | QCOMPARE(lockedChangedSpy.count(), 2); | 265 | QCOMPARE(lockedChangedSpy.count(), 2); | ||
257 | QTEST(!serverSurface->lockedPointer().isNull(), "hasConstraintAfterUnlock"); | 266 | QTEST(!serverSurface->lockedPointer().isNull(), "hasConstraintAfterUnlock"); | ||
258 | QTEST(pointerConstraintsChangedSpy.count(), "pointerChangedCount"); | 267 | QTEST(pointerConstraintsChangedSpy.count(), "pointerChangedCount"); | ||
259 | QVERIFY(unlockedSpy.wait()); | 268 | QVERIFY(unlockedSpy.wait()); | ||
260 | QCOMPARE(unlockedSpy.count(), 1); | 269 | QCOMPARE(unlockedSpy.count(), 1); | ||
261 | QCOMPARE(lockedSpy.count(), 1); | 270 | QCOMPARE(lockedSpy.count(), 1); | ||
262 | 271 | | |||
263 | // now motion should work again | 272 | // now motion should work again | ||
▲ Show 20 Lines • Show All 180 Lines • Show Last 20 Lines |
We should check the value of hintChangedSpy.first() to properly test it.
Also, use something better than 1,0 to check y is set correctly