31 {
32 final AndroidTouchProcessor touchProcessor = mock(AndroidTouchProcessor.class);
34 final FlutterMutatorsStack mutatorStack = mock(FlutterMutatorsStack.class);
35
36 assertTrue(view.onInterceptTouchEvent(mock(MotionEvent.class)));
37
38 {
39 view.readyToDisplay(mutatorStack, 1, 2, 0, 0);
40 view.onTouchEvent(MotionEvent.obtain(0, 0, MotionEvent.ACTION_DOWN, 0.0f, 0.0f, 0));
41 final ArgumentCaptor<Matrix> matrixCaptor = ArgumentCaptor.forClass(Matrix.class);
42 verify(touchProcessor).onTouchEvent(
any(), matrixCaptor.capture());
43
44 final Matrix screenMatrix = new Matrix();
45 screenMatrix.postTranslate(1, 2);
46 assertTrue(matrixCaptor.getValue().equals(screenMatrix));
47 }
48
49 reset(touchProcessor);
50
51 {
52 view.readyToDisplay(mutatorStack, 3, 4, 0, 0);
53 view.onTouchEvent(MotionEvent.obtain(0, 0, MotionEvent.ACTION_MOVE, 0.0f, 0.0f, 0));
54 final ArgumentCaptor<Matrix> matrixCaptor = ArgumentCaptor.forClass(Matrix.class);
55 verify(touchProcessor).onTouchEvent(
any(), matrixCaptor.capture());
56
57 final Matrix screenMatrix = new Matrix();
58 screenMatrix.postTranslate(1, 2);
59 assertTrue(matrixCaptor.getValue().equals(screenMatrix));
60 }
61
62 reset(touchProcessor);
63
64 {
65 view.readyToDisplay(mutatorStack, 5, 6, 0, 0);
66 view.onTouchEvent(MotionEvent.obtain(0, 0, MotionEvent.ACTION_MOVE, 0.0f, 0.0f, 0));
67 final ArgumentCaptor<Matrix> matrixCaptor = ArgumentCaptor.forClass(Matrix.class);
68 verify(touchProcessor).onTouchEvent(
any(), matrixCaptor.capture());
69
70 final Matrix screenMatrix = new Matrix();
71 screenMatrix.postTranslate(3, 4);
72 assertTrue(matrixCaptor.getValue().equals(screenMatrix));
73 }
74
75 reset(touchProcessor);
76
77 {
78 view.readyToDisplay(mutatorStack, 7, 8, 0, 0);
79 view.onTouchEvent(MotionEvent.obtain(0, 0, MotionEvent.ACTION_DOWN, 0.0f, 0.0f, 0));
80 final ArgumentCaptor<Matrix> matrixCaptor = ArgumentCaptor.forClass(Matrix.class);
81 verify(touchProcessor).onTouchEvent(
any(), matrixCaptor.capture());
82
83 final Matrix screenMatrix = new Matrix();
84 screenMatrix.postTranslate(7, 8);
85 assertTrue(matrixCaptor.getValue().equals(screenMatrix));
86 }
87 }
SIT bool any(const Vec< 1, T > &x)