Flutter Engine
The Flutter Engine
PlatformOverlayViewTest.java
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5package io.flutter.plugin.platform;
6
7import static org.mockito.ArgumentMatchers.any;
8import static org.mockito.ArgumentMatchers.eq;
9import static org.mockito.Mockito.mock;
10import static org.mockito.Mockito.times;
11import static org.mockito.Mockito.verify;
12import static org.mockito.Mockito.when;
13
14import android.content.Context;
15import android.os.SystemClock;
16import android.view.MotionEvent;
17import androidx.test.core.app.ApplicationProvider;
18import androidx.test.ext.junit.runners.AndroidJUnit4;
19import org.junit.Test;
20import org.junit.runner.RunWith;
21
22@RunWith(AndroidJUnit4.class)
24 private final Context ctx = ApplicationProvider.getApplicationContext();
25
26 @Test
28 final AccessibilityEventsDelegate mockAccessibilityDelegate =
30 when(mockAccessibilityDelegate.onAccessibilityHoverEvent(any(), eq(true))).thenReturn(true);
31
32 final int size = 10;
33 final PlatformOverlayView imageView =
34 new PlatformOverlayView(ctx, size, size, mockAccessibilityDelegate);
35 MotionEvent event =
36 MotionEvent.obtain(
37 SystemClock.uptimeMillis(),
38 SystemClock.uptimeMillis(),
39 MotionEvent.ACTION_HOVER_MOVE,
40 size / 2,
41 size / 2,
42 0);
43 imageView.onHoverEvent(event);
44
45 verify(mockAccessibilityDelegate, times(1)).onAccessibilityHoverEvent(event, true);
46 }
47}
static SkISize times(const SkISize &size, float factor)
static bool eq(const SkM44 &a, const SkM44 &b, float tol)
Definition: M44Test.cpp:18
boolean onAccessibilityHoverEvent(MotionEvent event, boolean ignorePlatformViews)
boolean onHoverEvent(@NonNull MotionEvent event)
FlKeyEvent * event
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
Definition: switches.h:259
SIT bool any(const Vec< 1, T > &x)
Definition: SkVx.h:530