1package io.flutter.embedding.android;
3import static io.flutter.Build.API_LEVELS;
4import static org.mockito.ArgumentMatchers.any;
5import static org.mockito.Mockito.mock;
6import static org.mockito.Mockito.never;
7import static org.mockito.Mockito.spy;
8import static org.mockito.Mockito.times;
9import static org.mockito.Mockito.verify;
10import static org.mockito.Mockito.when;
12import android.annotation.TargetApi;
13import android.graphics.SurfaceTexture;
16import androidx.test.core.app.ApplicationProvider;
17import androidx.test.ext.junit.runners.AndroidJUnit4;
18import io.flutter.embedding.engine.FlutterJNI;
19import io.flutter.embedding.engine.renderer.FlutterRenderer;
21import org.junit.runner.RunWith;
22import org.robolectric.annotation.Config;
25@RunWith(AndroidJUnit4.class)
26@TargetApi(API_LEVELS.API_30)
32 final Surface mockRenderSurface = mock(Surface.class);
34 textureView.setRenderSurface(mockRenderSurface);
36 final TextureView.SurfaceTextureListener listener = textureView.getSurfaceTextureListener();
37 listener.onSurfaceTextureDestroyed(mock(SurfaceTexture.class));
39 verify(mockRenderSurface).release();
61 when(textureView.isSurfaceAvailableForRendering()).thenReturn(
true);
62 when(textureView.getSurfaceTexture()).thenReturn(mock(SurfaceTexture.class));
63 when(textureView.getWindowToken()).thenReturn(mock(
android.os.IBinder.class));
69 verify(fakeFlutterJNI,
times(1)).onSurfaceCreated(
any(Surface.class));
75 verify(fakeFlutterJNI,
times(1)).onSurfaceDestroyed();
81 verify(fakeFlutterJNI, never()).onSurfaceWindowChanged(
any(Surface.class));
82 verify(fakeFlutterJNI,
times(2)).onSurfaceCreated(
any(Surface.class));
static SkISize times(const SkISize &size, float factor)
void itShouldCreateANewSurfaceWhenReattachedAfterDetachingFromRenderer()
void surfaceTextureListenerReleasesRenderer()
void detachFromRenderer()
void attachToRenderer(@NonNull FlutterRenderer renderer)
SIT bool any(const Vec< 1, T > &x)