MCPcopy Create free account
hub / github.com/Snapchat/Valdi / TEST

Function TEST

snap_drawing/test/src/RotateGestureRecognizer_tests.cpp:9–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7namespace snap::drawing {
8
9TEST(RotateGestureRecognizer, canHandleRotateTwoPointers) {
10 auto container = makeContainer(0, 0, 100, 100);
11
12 auto childView = createView(25, 25, 25, 25);
13 container->view->addChild(childView);
14
15 auto rotateSnapshot = addRotateGesture(childView);
16
17 container->dispatchEvent(TouchEventTypeDown, 30, 35, 1, 1, 2);
18 ASSERT_EQ(GestureRecognizerStateBegan, rotateSnapshot->state);
19 ASSERT_FLOAT_EQ(0, rotateSnapshot->rotateEvent.rotation);
20
21 container->dispatchEvent(TouchEventTypeMoved, 35, 40, 1, 2, 2);
22 ASSERT_EQ(GestureRecognizerStateChanged, rotateSnapshot->state);
23 ASSERT_FLOAT_EQ(0.32175058, rotateSnapshot->rotateEvent.rotation);
24
25 container->dispatchEvent(TouchEventTypePointerUp, 35, 40, 1, 2, 2);
26 ASSERT_EQ(GestureRecognizerStateChanged, rotateSnapshot->state);
27 ASSERT_FLOAT_EQ(0.32175058, rotateSnapshot->rotateEvent.rotation);
28
29 container->dispatchEvent(TouchEventTypeUp, 35, 40, 1, 2, 1);
30 ASSERT_EQ(GestureRecognizerStateEnded, rotateSnapshot->state);
31 ASSERT_FLOAT_EQ(0.32175058, rotateSnapshot->rotateEvent.rotation);
32
33 ASSERT_TRUE(container->root->getTouchDispatcher().isEmpty());
34}
35
36TEST(RotateGestureRecognizer, canHandleRotateTwoPointersInterrupted) {
37 auto container = makeContainer(0, 0, 100, 100);

Callers

nothing calls this directly

Calls 6

makeContainerFunction · 0.85
createViewFunction · 0.85
addRotateGestureFunction · 0.85
addChildMethod · 0.45
dispatchEventMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected