1package io.flutter.embedding.engine.renderer;
3import static io.flutter.Build.API_LEVELS;
4import static org.junit.Assert.assertEquals;
5import static org.mockito.Mockito.mock;
6import static org.robolectric.Shadows.shadowOf;
8import android.annotation.TargetApi;
10import android.graphics.SurfaceTexture;
14import androidx.test.ext.junit.runners.AndroidJUnit4;
15import io.flutter.embedding.engine.FlutterJNI;
16import java.util.concurrent.atomic.AtomicInteger;
18import org.junit.runner.RunWith;
20@RunWith(AndroidJUnit4.class)
21@TargetApi(API_LEVELS.API_26)
30 final Handler handler =
new Handler(Looper.getMainLooper());
35 AtomicInteger frames =
new AtomicInteger();
38 .setOnFrameAvailableListener(
43 frames.getAndIncrement();
48 Canvas canvas =
surface.lockHardwareCanvas();
49 canvas.drawARGB(255, 255, 0, 0);
50 surface.unlockCanvasAndPost(canvas);
51 shadowOf(Looper.getMainLooper()).idle();
52 assertEquals(frames.get(), 1);
56 canvas =
surface.lockHardwareCanvas();
57 canvas.drawARGB(255, 255, 0, 0);
58 surface.unlockCanvasAndPost(canvas);
59 shadowOf(Looper.getMainLooper()).idle();
60 assertEquals(frames.get(), 2);
void detachFromNativeAndReleaseResources()
SurfaceTextureEntry registerSurfaceTexture(@NonNull SurfaceTexture surfaceTexture)
void createsSurfaceTextureOfGivenSizeAndResizesWhenRequested()
SurfaceTexture getSurfaceTexture()
void setSize(int width, int height)