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;
14import android.view.SurfaceHolder;
15import androidx.test.core.app.ApplicationProvider;
16import androidx.test.ext.junit.runners.AndroidJUnit4;
17import io.flutter.embedding.engine.FlutterJNI;
18import io.flutter.embedding.engine.renderer.FlutterRenderer;
20import org.junit.runner.RunWith;
21import org.robolectric.annotation.Config;
24@RunWith(AndroidJUnit4.class)
25@TargetApi(API_LEVELS.API_30)
46 SurfaceHolder fakeSurfaceHolder = mock(SurfaceHolder.class);
47 Surface fakeSurface = mock(Surface.class);
48 when(surfaceView.getHolder()).thenReturn(fakeSurfaceHolder);
49 when(fakeSurfaceHolder.getSurface()).thenReturn(fakeSurface);
50 when(surfaceView.isSurfaceAvailableForRendering()).thenReturn(
true);
51 when(surfaceView.getWindowToken()).thenReturn(mock(
android.os.IBinder.class));
57 verify(fakeFlutterJNI,
times(1)).onSurfaceCreated(
any(Surface.class));
63 verify(fakeFlutterJNI,
times(1)).onSurfaceDestroyed();
69 verify(fakeFlutterJNI, never()).onSurfaceWindowChanged(
any(Surface.class));
70 verify(fakeFlutterJNI,
times(2)).onSurfaceCreated(
any(Surface.class));
static SkISize times(const SkISize &size, float factor)
void itShouldCreateANewSurfaceWhenReattachedAfterDetachingFromRenderer()
void detachFromRenderer()
void attachToRenderer(@NonNull FlutterRenderer renderer)
SIT bool any(const Vec< 1, T > &x)