5package io.flutter.plugin.platform;
7import static io.flutter.Build.API_LEVELS;
8import static org.junit.Assert.*;
9import static org.mockito.ArgumentMatchers.*;
10import static org.mockito.Mockito.*;
12import android.annotation.TargetApi;
16import android.graphics.SurfaceTexture;
19import androidx.test.core.app.ApplicationProvider;
20import androidx.test.ext.junit.runners.AndroidJUnit4;
21import io.flutter.view.TextureRegistry.SurfaceTextureEntry;
23import org.junit.runner.RunWith;
25@TargetApi(API_LEVELS.API_31)
26@RunWith(AndroidJUnit4.class)
28 private final Context ctx = ApplicationProvider.getApplicationContext();
32 final Canvas canvas = mock(Canvas.class);
33 final Surface
surface = mock(Surface.class);
34 when(
surface.lockHardwareCanvas()).thenReturn(canvas);
35 when(
surface.isValid()).thenReturn(
true);
36 final SurfaceTexture surfaceTexture = mock(SurfaceTexture.class);
38 when(surfaceTextureEntry.
surfaceTexture()).thenReturn(surfaceTexture);
39 when(surfaceTexture.isReleased()).thenReturn(
false);
44 protected Surface createSurface() {
50 final View platformView =
53 public void draw(Canvas canvas) {
55 canvas.drawColor(
Color.RED);
60 platformView.layout(0, 0,
size,
size);
64 final Canvas c =
s.lockHardwareCanvas();
66 s.unlockCanvasAndPost(c);
72 verifyNoMoreInteractions(
surface);
77 final Canvas canvas = mock(Canvas.class);
78 final Surface
surface = mock(Surface.class);
79 when(
surface.lockHardwareCanvas()).thenReturn(canvas);
80 when(
surface.isValid()).thenReturn(
true);
81 final SurfaceTexture surfaceTexture = mock(SurfaceTexture.class);
83 when(surfaceTextureEntry.
surfaceTexture()).thenReturn(surfaceTexture);
84 when(surfaceTexture.isReleased()).thenReturn(
false);
88 protected Surface createSurface() {
94 final Canvas c =
s.lockHardwareCanvas();
95 s.unlockCanvasAndPost(c);
98 reset(surfaceTexture);
105 verifyNoMoreInteractions(
surface);
106 verifyNoMoreInteractions(surfaceTexture);
static SkISize times(const SkISize &size, float factor)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
void viewDraw_writesToBuffer()
SurfaceTexture surfaceTexture()
SK_API sk_sp< SkShader > Color(SkColor)
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