5package io.flutter.plugin.platform;
7import static android.os.Looper.getMainLooper;
8import static io.flutter.Build.API_LEVELS;
9import static org.junit.Assert.*;
10import static org.mockito.ArgumentMatchers.*;
11import static org.mockito.Mockito.*;
12import static org.robolectric.Shadows.shadowOf;
14import android.annotation.TargetApi;
18import android.graphics.PorterDuff;
22import androidx.test.core.app.ApplicationProvider;
23import androidx.test.ext.junit.runners.AndroidJUnit4;
24import io.flutter.view.TextureRegistry.ImageTextureEntry;
26import org.junit.runner.RunWith;
28@TargetApi(API_LEVELS.API_29)
29@RunWith(AndroidJUnit4.class)
31 private final Context ctx = ApplicationProvider.getApplicationContext();
34 private Image lastPushedImage;
41 if (this.lastPushedImage !=
null) {
42 this.lastPushedImage.close();
47 if (this.lastPushedImage !=
null) {
48 this.lastPushedImage.close();
50 this.lastPushedImage =
image;
54 Image r = this.lastPushedImage;
55 this.lastPushedImage =
null;
66 final View platformView =
69 public void draw(Canvas canvas) {
71 canvas.drawColor(
Color.RED);
76 platformView.layout(0, 0,
size,
size);
85 final Canvas targetCanvas =
s.lockHardwareCanvas();
86 assertNotNull(targetCanvas);
91 targetCanvas.drawColor(
Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
93 platformView.draw(targetCanvas);
96 s.unlockCanvasAndPost(targetCanvas);
101 shadowOf(getMainLooper()).idle();
105 assertNotNull(pushedImage);
106 assertEquals(pushedImage.getWidth(),
size);
107 assertEquals(pushedImage.getHeight(),
size);
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
void pushImage(Image image)
Image acquireLatestImage()
sk_sp< const SkImage > image
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