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

Function TEST

snap_drawing/test/src/WheelGestureRecognizer_tests.cpp:9–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7namespace snap::drawing {
8
9TEST(DragGestureRecognizer, doesHandleWheel) {
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 wheelSnapshot = addWheelGesture(childView);
16
17 container->dispatchEvent(TouchEventTypeWheel, 30, 35, 0, 10);
18 ASSERT_EQ(GestureRecognizerStateBegan, wheelSnapshot->state);
19 ASSERT_EQ(5, wheelSnapshot->location.x);
20 ASSERT_EQ(10, wheelSnapshot->location.y);
21 ASSERT_EQ(0, wheelSnapshot->direction.dx);
22 ASSERT_EQ(10, wheelSnapshot->direction.dy);
23
24 container->dispatchEvent(TouchEventTypeWheel, 35, 40, 5, 5);
25 ASSERT_EQ(GestureRecognizerStateBegan, wheelSnapshot->state);
26 ASSERT_EQ(10, wheelSnapshot->location.x);
27 ASSERT_EQ(15, wheelSnapshot->location.y);
28 ASSERT_EQ(5, wheelSnapshot->direction.dx);
29 ASSERT_EQ(5, wheelSnapshot->direction.dy);
30
31 ASSERT_TRUE(container->root->getTouchDispatcher().isEmpty());
32}
33
34} // namespace snap::drawing

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected