5package dev.flutter.scenariosui;
7import android.app.Instrumentation;
9import android.content.pm.ActivityInfo;
10import androidx.annotation.NonNull;
11import androidx.test.ext.junit.runners.AndroidJUnit4;
12import androidx.test.filters.LargeTest;
13import androidx.test.platform.app.InstrumentationRegistry;
14import androidx.test.rule.ActivityTestRule;
15import dev.flutter.scenarios.PlatformViewsActivity;
16import org.junit.Before;
17import org.junit.Ignore;
20import org.junit.runner.RunWith;
22@RunWith(AndroidJUnit4.class)
25 private Instrumentation instrumentation;
26 private Intent intent;
30 new ActivityTestRule<>(
33 private static String goldName(String
suffix) {
34 return "PlatformViewWithSurfaceViewUiTest_" +
suffix;
39 instrumentation = InstrumentationRegistry.getInstrumentation();
40 intent =
new Intent(Intent.ACTION_MAIN);
42 intent.putExtra(
"use_android_view",
false);
48 intent.putExtra(
"scenario_name",
"platform_view");
54 intent.putExtra(
"scenario_name",
"platform_view_multiple");
56 activityRule.launchActivity(intent), goldName(
"testPlatformViewMultiple"));
61 intent.putExtra(
"scenario_name",
"platform_view_multiple_background_foreground");
64 goldName(
"testPlatformViewMultipleBackgroundForeground"));
69 intent.putExtra(
"scenario_name",
"platform_view_cliprect");
71 activityRule.launchActivity(intent), goldName(
"testPlatformViewCliprect"));
76 intent.putExtra(
"scenario_name",
"platform_view_cliprrect");
78 activityRule.launchActivity(intent), goldName(
"testPlatformViewCliprrect"));
83 intent.putExtra(
"scenario_name",
"platform_view_clippath");
85 activityRule.launchActivity(intent), goldName(
"testPlatformViewClippath"));
90 intent.putExtra(
"scenario_name",
"platform_view_transform");
92 activityRule.launchActivity(intent), goldName(
"testPlatformViewTransform"));
97 intent.putExtra(
"scenario_name",
"platform_view_opacity");
99 activityRule.launchActivity(intent), goldName(
"testPlatformViewOpacity"));
104 intent.putExtra(
"scenario_name",
"platform_view_rotate");
106 activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
107 instrumentation.waitForIdleSync();
113 intent.putExtra(
"scenario_name",
"platform_view_multiple_without_overlays");
115 activityRule.launchActivity(intent), goldName(
"testPlatformViewMultipleWithoutOverlays"));
120 intent.putExtra(
"scenario_name",
"platform_view_two_intersecting_overlays");
122 activityRule.launchActivity(intent), goldName(
"testPlatformViewTwoIntersectingOverlays"));
127 intent.putExtra(
"scenario_name",
"platform_view_no_overlay_intersection");
130 goldName(
"testPlatformViewWithoutOverlayIntersection"));
135 @Ignore(
"not safe until https://github.com/flutter/flutter/issues/31990 is resolved")
139 intent.putExtra(
"scenario_name",
"platform_view_larger_than_display_size");
141 activityRule.launchActivity(intent), goldName(
"testPlatformViewLargerThanDisplaySize"));
static void capture(@NonNull TestableFlutterActivity activity, @NonNull String captureName)