1package io.flutter.embedding.android;
3import static io.flutter.Build.API_LEVELS;
4import static junit.framework.TestCase.assertEquals;
5import static org.mockito.Mockito.inOrder;
6import static org.mockito.Mockito.mock;
7import static org.mockito.Mockito.never;
8import static org.mockito.Mockito.verify;
9import static org.mockito.Mockito.when;
11import android.annotation.TargetApi;
15import android.view.ViewConfiguration;
16import androidx.test.core.app.ApplicationProvider;
17import androidx.test.ext.junit.runners.AndroidJUnit4;
18import io.flutter.embedding.engine.renderer.FlutterRenderer;
19import java.nio.ByteBuffer;
20import java.util.concurrent.TimeUnit;
21import org.junit.Before;
23import org.junit.runner.RunWith;
24import org.mockito.ArgumentCaptor;
25import org.mockito.Captor;
26import org.mockito.InOrder;
27import org.mockito.Mock;
28import org.mockito.MockitoAnnotations;
29import org.robolectric.annotation.Config;
32@RunWith(AndroidJUnit4.class)
33@TargetApi(API_LEVELS.API_28)
41 final long eventTimeMilliseconds = 172800000;
42 final float pressure = 0.8f;
44 final int enginePrimaryStylusButton = 0x02;
48 MockitoAnnotations.openMocks(
this);
52 private long readTimeStamp(ByteBuffer
buffer) {
56 private long readPointerChange(ByteBuffer
buffer) {
57 return buffer.getLong(2 * AndroidTouchProcessor.BYTES_PER_FIELD);
60 private long readPointerDeviceKind(ByteBuffer
buffer) {
61 return buffer.getLong(3 * AndroidTouchProcessor.BYTES_PER_FIELD);
64 private long readPointerSignalKind(ByteBuffer
buffer) {
65 return buffer.getLong(4 * AndroidTouchProcessor.BYTES_PER_FIELD);
68 private long readDevice(ByteBuffer
buffer) {
69 return buffer.getLong(5 * AndroidTouchProcessor.BYTES_PER_FIELD);
72 private double readPointerPhysicalX(ByteBuffer
buffer) {
73 return buffer.getDouble(7 * AndroidTouchProcessor.BYTES_PER_FIELD);
76 private double readPointerPhysicalY(ByteBuffer
buffer) {
77 return buffer.getDouble(8 * AndroidTouchProcessor.BYTES_PER_FIELD);
80 private long readButtons(ByteBuffer
buffer) {
81 return buffer.getLong(11 * AndroidTouchProcessor.BYTES_PER_FIELD);
84 private double readObscured(ByteBuffer
buffer) {
85 return buffer.getDouble(12 * AndroidTouchProcessor.BYTES_PER_FIELD);
88 private double readSynthesized(ByteBuffer
buffer) {
89 return buffer.getDouble(13 * AndroidTouchProcessor.BYTES_PER_FIELD);
92 private double readPressure(ByteBuffer
buffer) {
93 return buffer.getDouble(14 * AndroidTouchProcessor.BYTES_PER_FIELD);
96 private double readPressureMin(ByteBuffer
buffer) {
97 return buffer.getDouble(15 * AndroidTouchProcessor.BYTES_PER_FIELD);
100 private double readPressureMax(ByteBuffer
buffer) {
101 return buffer.getDouble(16 * AndroidTouchProcessor.BYTES_PER_FIELD);
104 private double readDistance(ByteBuffer
buffer) {
105 return buffer.getDouble(17 * AndroidTouchProcessor.BYTES_PER_FIELD);
108 private double readDistanceMax(ByteBuffer
buffer) {
109 return buffer.getDouble(18 * AndroidTouchProcessor.BYTES_PER_FIELD);
112 private double readSize(ByteBuffer
buffer) {
113 return buffer.getDouble(19 * AndroidTouchProcessor.BYTES_PER_FIELD);
116 private double readRadiusMajor(ByteBuffer
buffer) {
117 return buffer.getDouble(20 * AndroidTouchProcessor.BYTES_PER_FIELD);
120 private double readRadiusMinor(ByteBuffer
buffer) {
121 return buffer.getDouble(21 * AndroidTouchProcessor.BYTES_PER_FIELD);
124 private double readRadiusMin(ByteBuffer
buffer) {
125 return buffer.getDouble(22 * AndroidTouchProcessor.BYTES_PER_FIELD);
128 private double readRadiusMax(ByteBuffer
buffer) {
129 return buffer.getDouble(23 * AndroidTouchProcessor.BYTES_PER_FIELD);
132 private double readStylusTilt(ByteBuffer
buffer) {
133 return buffer.getDouble(25 * AndroidTouchProcessor.BYTES_PER_FIELD);
136 private double readScrollDeltaX(ByteBuffer
buffer) {
137 return buffer.getDouble(27 * AndroidTouchProcessor.BYTES_PER_FIELD);
140 private double readScrollDeltaY(ByteBuffer
buffer) {
141 return buffer.getDouble(28 * AndroidTouchProcessor.BYTES_PER_FIELD);
144 private double readPointerPanX(ByteBuffer
buffer) {
145 return buffer.getDouble(29 * AndroidTouchProcessor.BYTES_PER_FIELD);
148 private double readPointerPanY(ByteBuffer
buffer) {
149 return buffer.getDouble(30 * AndroidTouchProcessor.BYTES_PER_FIELD);
152 private double readPointerPanDeltaX(ByteBuffer
buffer) {
153 return buffer.getDouble(31 * AndroidTouchProcessor.BYTES_PER_FIELD);
156 private double readPointerPanDeltaY(ByteBuffer
buffer) {
157 return buffer.getDouble(32 * AndroidTouchProcessor.BYTES_PER_FIELD);
160 private double readScale(ByteBuffer
buffer) {
161 return buffer.getDouble(33 * AndroidTouchProcessor.BYTES_PER_FIELD);
164 private double readRotation(ByteBuffer
buffer) {
165 return buffer.getDouble(34 * AndroidTouchProcessor.BYTES_PER_FIELD);
168 private class MotionEventMocker {
173 MotionEventMocker(
int pointerId,
int source,
int toolType) {
174 this.pointerId = pointerId;
176 this.toolType = toolType;
179 MotionEvent mockEvent(
int action,
float x,
float y,
int buttonState) {
180 return mockEvent(
action,
x,
y, buttonState,
x,
y,
x,
y,
x,
x,
y);
183 MotionEvent mockEvent(
195 MotionEvent
event = mock(MotionEvent.class);
196 when(
event.getDevice()).thenReturn(
null);
198 when(
event.getEventTime()).thenReturn(eventTimeMilliseconds);
199 when(
event.getPointerCount()).thenReturn(1);
201 final int actionIndex = 0;
202 when(
event.getActionIndex()).thenReturn(actionIndex);
203 when(
event.getButtonState()).thenReturn(buttonState);
204 when(
event.getPointerId(actionIndex)).thenReturn(pointerId);
205 when(
event.getX(actionIndex)).thenReturn(
x);
206 when(
event.getY(actionIndex)).thenReturn(
y);
207 when(
event.getToolType(actionIndex)).thenReturn(toolType);
208 when(
event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)).thenReturn(
true);
209 when(
event.getAxisValue(MotionEvent.AXIS_HSCROLL, pointerId)).thenReturn(hScroll);
210 when(
event.getAxisValue(MotionEvent.AXIS_VSCROLL, pointerId)).thenReturn(vScroll);
211 when(
event.getAxisValue(MotionEvent.AXIS_DISTANCE, pointerId)).thenReturn(axisDistance);
212 when(
event.getAxisValue(MotionEvent.AXIS_TILT, pointerId)).thenReturn(axisTilt);
213 when(
event.getPressure(actionIndex)).thenReturn(pressure);
214 when(
event.getSize(actionIndex)).thenReturn(
size);
215 when(
event.getToolMajor(actionIndex)).thenReturn(toolMajor);
216 when(
event.getToolMinor(actionIndex)).thenReturn(toolMinor);
223 MotionEventMocker mocker =
224 new MotionEventMocker(0, InputDevice.SOURCE_TOUCHSCREEN, MotionEvent.TOOL_TYPE_FINGER);
225 touchProcessor.
onTouchEvent(mocker.mockEvent(MotionEvent.ACTION_DOWN, 0.0f, 0.0f, 0));
226 InOrder inOrder = inOrder(mockRenderer);
228 .verify(mockRenderer)
229 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
230 ByteBuffer packet = packetCaptor.getValue();
234 assertEquals(0.0, readPointerPhysicalX(packet));
235 assertEquals(0.0, readPointerPhysicalY(packet));
236 touchProcessor.
onTouchEvent(mocker.mockEvent(MotionEvent.ACTION_MOVE, 10.0f, 5.0f, 0));
238 .verify(mockRenderer)
239 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
240 packet = packetCaptor.getValue();
244 assertEquals(10.0, readPointerPhysicalX(packet));
245 assertEquals(5.0, readPointerPhysicalY(packet));
246 touchProcessor.
onTouchEvent(mocker.mockEvent(MotionEvent.ACTION_UP, 10.0f, 5.0f, 0));
248 .verify(mockRenderer)
249 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
250 packet = packetCaptor.getValue();
254 assertEquals(10.0, readPointerPhysicalX(packet));
255 assertEquals(5.0, readPointerPhysicalY(packet));
256 inOrder.verifyNoMoreInteractions();
261 MotionEventMocker mocker =
262 new MotionEventMocker(1, InputDevice.SOURCE_MOUSE, MotionEvent.TOOL_TYPE_MOUSE);
263 touchProcessor.
onTouchEvent(mocker.mockEvent(MotionEvent.ACTION_DOWN, 0.0f, 0.0f, 0));
264 InOrder inOrder = inOrder(mockRenderer);
266 .verify(mockRenderer)
267 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
268 ByteBuffer packet = packetCaptor.getValue();
272 assertEquals(0.0, readPointerPhysicalX(packet));
273 assertEquals(0.0, readPointerPhysicalY(packet));
274 touchProcessor.
onTouchEvent(mocker.mockEvent(MotionEvent.ACTION_MOVE, 10.0f, 5.0f, 0));
276 .verify(mockRenderer)
277 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
278 packet = packetCaptor.getValue();
282 assertEquals(0.0, readPointerPhysicalX(packet));
283 assertEquals(0.0, readPointerPhysicalY(packet));
284 assertEquals(10.0, readPointerPanX(packet));
285 assertEquals(5.0, readPointerPanY(packet));
287 assertEquals(0.0, readPointerPanDeltaX(packet));
288 assertEquals(0.0, readPointerPanDeltaY(packet));
289 assertEquals(0.0, readRotation(packet));
291 assertEquals(1.0, readScale(packet));
292 touchProcessor.
onTouchEvent(mocker.mockEvent(MotionEvent.ACTION_UP, 10.0f, 5.0f, 0));
294 .verify(mockRenderer)
295 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
296 packet = packetCaptor.getValue();
300 assertEquals(0.0, readPointerPhysicalX(packet));
301 assertEquals(0.0, readPointerPhysicalY(packet));
302 inOrder.verifyNoMoreInteractions();
307 MotionEventMocker mocker =
308 new MotionEventMocker(2, InputDevice.SOURCE_MOUSE, MotionEvent.TOOL_TYPE_MOUSE);
309 touchProcessor.
onTouchEvent(mocker.mockEvent(MotionEvent.ACTION_DOWN, 0.0f, 0.0f, 1));
310 InOrder inOrder = inOrder(mockRenderer);
312 .verify(mockRenderer)
313 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
314 ByteBuffer packet = packetCaptor.getValue();
318 assertEquals(0.0, readPointerPhysicalX(packet));
319 assertEquals(0.0, readPointerPhysicalY(packet));
320 touchProcessor.
onTouchEvent(mocker.mockEvent(MotionEvent.ACTION_MOVE, 10.0f, 5.0f, 1));
322 .verify(mockRenderer)
323 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
324 packet = packetCaptor.getValue();
328 assertEquals(10.0, readPointerPhysicalX(packet));
329 assertEquals(5.0, readPointerPhysicalY(packet));
330 touchProcessor.
onTouchEvent(mocker.mockEvent(MotionEvent.ACTION_UP, 10.0f, 5.0f, 1));
332 .verify(mockRenderer)
333 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
334 packet = packetCaptor.getValue();
338 assertEquals(10.0, readPointerPhysicalX(packet));
339 assertEquals(5.0, readPointerPhysicalY(packet));
340 inOrder.verifyNoMoreInteractions();
346 MotionEventMocker mocker =
347 new MotionEventMocker(1, InputDevice.SOURCE_STYLUS, MotionEvent.TOOL_TYPE_STYLUS);
349 touchProcessor.
onTouchEvent(mocker.mockEvent(MotionEvent.ACTION_BUTTON_PRESS, 0.0f, 0.0f, 0));
350 verify(mockRenderer, never()).dispatchPointerDataPacket(ByteBuffer.allocate(0), 0);
355 public
void scrollWheelAbove26() {
357 final int pointerId = 0;
358 MotionEventMocker mocker =
359 new MotionEventMocker(
360 pointerId, InputDevice.SOURCE_CLASS_POINTER, MotionEvent.TOOL_TYPE_MOUSE);
361 final float horizontalScrollValue = -1
f;
362 final float verticalScrollValue = .5f;
363 final Context context = ApplicationProvider.getApplicationContext();
364 final double horizontalScaleFactor =
365 ViewConfiguration.get(context).getScaledHorizontalScrollFactor();
366 final double verticalScaleFactor =
367 ViewConfiguration.get(context).getScaledVerticalScrollFactor();
369 assertEquals(
"zero horizontal scale factor",
true, horizontalScaleFactor != 0);
370 assertEquals(
"zero vertical scale factor",
true, verticalScaleFactor != 0);
372 final MotionEvent
event =
374 MotionEvent.ACTION_SCROLL,
378 horizontalScrollValue,
387 InOrder inOrder = inOrder(mockRenderer);
389 .verify(mockRenderer)
390 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
391 ByteBuffer packet = packetCaptor.getValue();
393 assertEquals(-horizontalScrollValue * horizontalScaleFactor, readScrollDeltaX(packet));
394 assertEquals(-verticalScrollValue * verticalScaleFactor, readScrollDeltaY(packet));
395 verify(
event).getAxisValue(MotionEvent.AXIS_HSCROLL, pointerId);
396 verify(
event).getAxisValue(MotionEvent.AXIS_VSCROLL, pointerId);
398 inOrder.verifyNoMoreInteractions();
403 public
void scrollWheelBelow26() {
405 final int pointerId = 0;
406 MotionEventMocker mocker =
407 new MotionEventMocker(
408 pointerId, InputDevice.SOURCE_CLASS_POINTER, MotionEvent.TOOL_TYPE_MOUSE);
409 final float horizontalScrollValue = -1
f;
410 final float verticalScrollValue = .5f;
411 final Context context = ApplicationProvider.getApplicationContext();
413 final MotionEvent
event =
415 MotionEvent.ACTION_SCROLL,
419 horizontalScrollValue,
427 assertEquals(
true, handled);
429 InOrder inOrder = inOrder(mockRenderer);
431 .verify(mockRenderer)
432 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
433 ByteBuffer packet = packetCaptor.getValue();
436 final double magicScrollFactor = 64;
437 assertEquals(-horizontalScrollValue * magicScrollFactor, readScrollDeltaX(packet));
438 assertEquals(-verticalScrollValue * magicScrollFactor, readScrollDeltaY(packet));
439 verify(
event).getAxisValue(MotionEvent.AXIS_HSCROLL, pointerId);
440 verify(
event).getAxisValue(MotionEvent.AXIS_VSCROLL, pointerId);
445 .verify(mockRenderer)
446 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
447 packet = packetCaptor.getValue();
451 readScrollDeltaX(packet));
454 readScrollDeltaY(packet));
456 inOrder.verifyNoMoreInteractions();
461 final int pointerId = 0;
462 MotionEventMocker mocker =
463 new MotionEventMocker(
464 pointerId, InputDevice.SOURCE_CLASS_POINTER, MotionEvent.TOOL_TYPE_MOUSE);
466 final MotionEvent
event = mocker.mockEvent(MotionEvent.ACTION_SCROLL, 1
f, 1
f, 1);
469 InOrder inOrder = inOrder(mockRenderer);
471 .verify(mockRenderer)
472 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
473 ByteBuffer packet = packetCaptor.getValue();
475 assertEquals(TimeUnit.MILLISECONDS.toMicros(eventTimeMilliseconds), readTimeStamp(packet));
477 inOrder.verifyNoMoreInteractions();
482 final int pointerId = 2;
483 MotionEventMocker mocker =
484 new MotionEventMocker(
485 pointerId, InputDevice.SOURCE_CLASS_POINTER, MotionEvent.TOOL_TYPE_MOUSE);
487 final MotionEvent
event = mocker.mockEvent(MotionEvent.ACTION_SCROLL, 1
f, 1
f, 1);
490 InOrder inOrder = inOrder(mockRenderer);
492 .verify(mockRenderer)
493 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
494 ByteBuffer packet = packetCaptor.getValue();
496 assertEquals(pointerId, readDevice(packet));
497 verify(
event).getPointerId(0);
499 inOrder.verifyNoMoreInteractions();
504 MotionEventMocker mocker =
505 new MotionEventMocker(1, InputDevice.SOURCE_CLASS_POINTER, MotionEvent.TOOL_TYPE_MOUSE);
506 final float x = 10.0f;
507 final float y = 20.0f;
508 final MotionEvent
event = mocker.mockEvent(MotionEvent.ACTION_DOWN,
x,
y, 0);
511 InOrder inOrder = inOrder(mockRenderer);
513 .verify(mockRenderer)
514 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
515 ByteBuffer packet = packetCaptor.getValue();
517 assertEquals((
double)
x, readPointerPhysicalX(packet));
518 assertEquals((
double)
y, readPointerPhysicalY(packet));
520 inOrder.verifyNoMoreInteractions();
525 MotionEventMocker mocker =
526 new MotionEventMocker(1, InputDevice.SOURCE_CLASS_POINTER, MotionEvent.TOOL_TYPE_MOUSE);
527 final MotionEvent
event = mocker.mockEvent(MotionEvent.ACTION_DOWN, 10.0f, 20.0f, 0);
530 InOrder inOrder = inOrder(mockRenderer);
532 .verify(mockRenderer)
533 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
534 ByteBuffer packet = packetCaptor.getValue();
537 assertEquals(0.0, readObscured(packet));
539 inOrder.verifyNoMoreInteractions();
544 MotionEventMocker mocker =
545 new MotionEventMocker(1, InputDevice.SOURCE_CLASS_POINTER, MotionEvent.TOOL_TYPE_MOUSE);
546 final MotionEvent
event = mocker.mockEvent(MotionEvent.ACTION_DOWN, 10.0f, 20.0f, 0);
549 InOrder inOrder = inOrder(mockRenderer);
551 .verify(mockRenderer)
552 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
553 ByteBuffer packet = packetCaptor.getValue();
556 assertEquals(0.0, readSynthesized(packet));
558 inOrder.verifyNoMoreInteractions();
563 MotionEventMocker mocker =
564 new MotionEventMocker(1, InputDevice.SOURCE_CLASS_POINTER, MotionEvent.TOOL_TYPE_MOUSE);
565 final MotionEvent
event = mocker.mockEvent(MotionEvent.ACTION_DOWN, 10.0f, 20.0f, 0);
568 InOrder inOrder = inOrder(mockRenderer);
570 .verify(mockRenderer)
571 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
572 ByteBuffer packet = packetCaptor.getValue();
575 assertEquals((
double) pressure, readPressure(packet));
577 assertEquals(0.0, readPressureMin(packet));
578 assertEquals(1.0, readPressureMax(packet));
580 inOrder.verifyNoMoreInteractions();
585 MotionEventMocker mocker =
586 new MotionEventMocker(0, InputDevice.SOURCE_STYLUS, MotionEvent.TOOL_TYPE_STYLUS);
588 final float tilt = 20.0f;
589 final MotionEvent
event =
591 MotionEvent.ACTION_DOWN,
594 MotionEvent.BUTTON_STYLUS_PRIMARY,
604 InOrder inOrder = inOrder(mockRenderer);
606 .verify(mockRenderer)
607 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
608 ByteBuffer packet = packetCaptor.getValue();
610 assertEquals((
double)
distance, readDistance(packet));
612 assertEquals(0.0, readDistanceMax(packet));
613 assertEquals((
double) tilt, readStylusTilt(packet));
614 assertEquals(enginePrimaryStylusButton, readButtons(packet));
616 inOrder.verifyNoMoreInteractions();
621 MotionEventMocker mocker =
622 new MotionEventMocker(0, InputDevice.SOURCE_STYLUS, MotionEvent.TOOL_TYPE_STYLUS);
623 final float size = 10.0f;
624 final float radiusMajor = 20.0f;
625 final float radiusMinor = 30.0f;
626 final MotionEvent
event =
628 MotionEvent.ACTION_DOWN,
641 InOrder inOrder = inOrder(mockRenderer);
643 .verify(mockRenderer)
644 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
645 ByteBuffer packet = packetCaptor.getValue();
647 verify(
event).getSize(0);
648 verify(
event).getToolMajor(0);
649 verify(
event).getToolMinor(0);
651 assertEquals((
double)
size, readSize(packet));
652 assertEquals((
double) radiusMajor, readRadiusMajor(packet));
653 assertEquals((
double) radiusMinor, readRadiusMinor(packet));
655 assertEquals(0.0, readRadiusMin(packet));
656 assertEquals(0.0, readRadiusMax(packet));
658 inOrder.verifyNoMoreInteractions();
664 MotionEventMocker mocker =
665 new MotionEventMocker(0, InputDevice.SOURCE_MOUSE, MotionEvent.TOOL_TYPE_MOUSE);
667 touchProcessor.
onTouchEvent(mocker.mockEvent(MotionEvent.ACTION_DOWN, 0.0f, 0.0f, 0));
668 InOrder inOrder = inOrder(mockRenderer);
670 .verify(mockRenderer)
671 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
672 ByteBuffer packet = packetCaptor.getValue();
676 assertEquals(0.0, readPointerPhysicalX(packet));
677 assertEquals(0.0, readPointerPhysicalY(packet));
679 touchProcessor.
onTouchEvent(mocker.mockEvent(MotionEvent.ACTION_MOVE, 10.0f, 5.0f, 0));
681 .verify(mockRenderer)
682 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
683 packet = packetCaptor.getValue();
687 assertEquals(0.0, readPointerPhysicalX(packet));
688 assertEquals(0.0, readPointerPhysicalY(packet));
689 assertEquals(10.0, readPointerPanX(packet));
690 assertEquals(5.0, readPointerPanY(packet));
693 mocker.mockEvent(MotionEvent.ACTION_SCROLL, 0.0f, 0.0f, 0),
694 ApplicationProvider.getApplicationContext());
696 .verify(mockRenderer)
697 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
698 packet = packetCaptor.getValue();
700 while (packet.hasRemaining()) {
701 assertEquals(0, packet.get());
704 touchProcessor.
onTouchEvent(mocker.mockEvent(MotionEvent.ACTION_UP, 10.0f, 5.0f, 0));
706 .verify(mockRenderer)
707 .dispatchPointerDataPacket(packetCaptor.capture(), packetSizeCaptor.capture());
708 packet = packetCaptor.getValue();
712 assertEquals(0.0, readPointerPhysicalX(packet));
713 assertEquals(0.0, readPointerPhysicalY(packet));
714 inOrder.verifyNoMoreInteractions();
void unexpectedPointerChange()
void physicalXPhysicalY()
ArgumentCaptor< Integer > packetSizeCaptor
void unexpectedMaskedAction()
AndroidTouchProcessor touchProcessor
ArgumentCaptor< ByteBuffer > packetCaptor
FlutterRenderer mockRenderer
static final int DEFAULT_HORIZONTAL_SCROLL_FACTOR
boolean onTouchEvent(@NonNull MotionEvent event)
static final int DEFAULT_VERTICAL_SCROLL_FACTOR
static final int BYTES_PER_FIELD
boolean onGenericMotionEvent(@NonNull MotionEvent event, @NonNull Context context)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size