Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add integration test
  • Loading branch information
Emmanuel Garcia committed Jun 21, 2022
commit cf3b220e07a032b03a0748804d4f823d0d13298a
2 changes: 1 addition & 1 deletion testing/android_systrace_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def main():
dest='activity_name',
action='store',
help='The activity to launch as it appears in AndroidManifest.xml, '
'e.g. .TextPlatformViewActivity'
'e.g. .PlatformViewsActivity'
)
parser.add_argument(
'--adb-path',
Expand Down
2 changes: 1 addition & 1 deletion testing/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ def RunAndroidTests(android_variant='android_debug_unopt', adb_path=None):
RunCmd([
systrace_test, '--adb-path', adb_path, '--apk-path', scenario_apk,
'--package-name', 'dev.flutter.scenarios', '--activity-name',
'.TextPlatformViewActivity'
'.PlatformViewsActivity'
])


Expand Down
7 changes: 5 additions & 2 deletions testing/scenario_app/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,19 @@ _android_sources = [
"app/src/androidTest/java/dev/flutter/scenariosui/MemoryLeakTests.java",
"app/src/androidTest/java/dev/flutter/scenariosui/PlatformTextureUiTests.java",
"app/src/androidTest/java/dev/flutter/scenariosui/PlatformViewUiTests.java",
"app/src/androidTest/java/dev/flutter/scenariosui/PlatformViewWithSurfaceViewUiTest.java",
"app/src/androidTest/java/dev/flutter/scenariosui/PlatformViewWithTextureViewUiTest.java",
"app/src/androidTest/java/dev/flutter/scenariosui/ScreenshotUtil.java",
"app/src/androidTest/java/dev/flutter/scenariosui/SpawnEngineTests.java",
"app/src/main/AndroidManifest.xml",
"app/src/main/java/dev/flutter/scenarios/PlatformViewsActivity.java",
"app/src/main/java/dev/flutter/scenarios/SpawnedEngineActivity.java",
"app/src/main/java/dev/flutter/scenarios/StrictModeFlutterActivity.java",
"app/src/main/java/dev/flutter/scenarios/SurfacePlatformViewFactory.java",
"app/src/main/java/dev/flutter/scenarios/TestActivity.java",
"app/src/main/java/dev/flutter/scenarios/TestableFlutterActivity.java",
"app/src/main/java/dev/flutter/scenarios/TextPlatformView.java",
"app/src/main/java/dev/flutter/scenarios/TextPlatformViewActivity.java",
"app/src/main/java/dev/flutter/scenarios/TextPlatformViewFactory.java",
"app/src/main/java/dev/flutter/scenarios/TexturePlatformViewFactory.java",
"build.gradle",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
import dev.flutter.scenarios.TextPlatformViewActivity;
import dev.flutter.scenarios.PlatformViewsActivity;
import leakcanary.FailTestOnLeak;
import org.junit.Rule;
import org.junit.Test;
Expand All @@ -19,9 +19,9 @@
@LargeTest
public class MemoryLeakTests {
@Rule @NonNull
public ActivityTestRule<TextPlatformViewActivity> activityRule =
public ActivityTestRule<PlatformViewsActivity> activityRule =
new ActivityTestRule<>(
TextPlatformViewActivity.class, /*initialTouchMode=*/ false, /*launchActivity=*/ false);
PlatformViewsActivity.class, /*initialTouchMode=*/ false, /*launchActivity=*/ false);

@Test
@FailTestOnLeak
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
import dev.flutter.scenarios.TextPlatformViewActivity;
import dev.flutter.scenarios.PlatformViewsActivity;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
Expand All @@ -21,15 +21,16 @@ public class PlatformTextureUiTests {
Intent intent;

@Rule @NonNull
public ActivityTestRule<TextPlatformViewActivity> activityRule =
public ActivityTestRule<PlatformViewsActivity> activityRule =
new ActivityTestRule<>(
TextPlatformViewActivity.class, /*initialTouchMode=*/ false, /*launchActivity=*/ false);
PlatformViewsActivity.class, /*initialTouchMode=*/ false, /*launchActivity=*/ false);

@Before
public void setUp() {
intent = new Intent(Intent.ACTION_MAIN);
// Render a texture.
intent.putExtra("use_android_view", false);
intent.putExtra("view_type", "scenarios/textPlatformView");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
import dev.flutter.scenarios.TextPlatformViewActivity;
import dev.flutter.scenarios.PlatformViewsActivity;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
Expand All @@ -21,15 +21,16 @@ public class PlatformViewUiTests {
Intent intent;

@Rule @NonNull
public ActivityTestRule<TextPlatformViewActivity> activityRule =
public ActivityTestRule<PlatformViewsActivity> activityRule =
new ActivityTestRule<>(
TextPlatformViewActivity.class, /*initialTouchMode=*/ false, /*launchActivity=*/ false);
PlatformViewsActivity.class, /*initialTouchMode=*/ false, /*launchActivity=*/ false);

@Before
public void setUp() {
intent = new Intent(Intent.ACTION_MAIN);
// Render a native android view.
intent.putExtra("use_android_view", true);
intent.putExtra("view_type", "scenarios/textPlatformView");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package dev.flutter.scenariosui;

import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
import dev.flutter.scenarios.PlatformViewsActivity;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
@LargeTest
public class PlatformViewWithSurfaceViewUiTest {
Intent intent;

@Rule @NonNull
public ActivityTestRule<PlatformViewsActivity> activityRule =
new ActivityTestRule<>(
PlatformViewsActivity.class, /*initialTouchMode=*/ false, /*launchActivity=*/ false);

@Before
public void setUp() {
intent = new Intent(Intent.ACTION_MAIN);
// Render a texture.
intent.putExtra("use_android_view", false);
intent.putExtra("view_type", "scenarios/surfacePlatformView");
}

@Test
public void testPlatformView() throws Exception {
intent.putExtra("scenario_name", "platform_view");
ScreenshotUtil.capture(
activityRule.launchActivity(intent), "PlatformViewWithSurfaceViewUiTest_testPlatformView");
}

@Test
public void testPlatformViewMultiple() throws Exception {
intent.putExtra("scenario_name", "platform_view_multiple");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithSurfaceViewUiTest_testPlatformViewMultiple");
}

@Test
public void testPlatformViewMultipleBackgroundForeground() throws Exception {
intent.putExtra("scenario_name", "platform_view_multiple_background_foreground");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithSurfaceViewUiTest_testPlatformViewMultipleBackgroundForeground");
}

@Test
public void testPlatformViewCliprect() throws Exception {
intent.putExtra("scenario_name", "platform_view_cliprect");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithSurfaceViewUiTest_testPlatformViewCliprect");
}

@Test
public void testPlatformViewCliprrect() throws Exception {
intent.putExtra("scenario_name", "platform_view_cliprrect");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithSurfaceViewUiTest_testPlatformViewCliprrect");
}

@Test
public void testPlatformViewClippath() throws Exception {
intent.putExtra("scenario_name", "platform_view_clippath");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithSurfaceViewUiTest_testPlatformViewClippath");
}

@Test
public void testPlatformViewTransform() throws Exception {
intent.putExtra("scenario_name", "platform_view_transform");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithSurfaceViewUiTest_testPlatformViewTransform");
}

@Test
public void testPlatformViewOpacity() throws Exception {
intent.putExtra("scenario_name", "platform_view_opacity");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithSurfaceViewUiTest_testPlatformViewOpacity");
}

@Test
public void testPlatformViewRotate() throws Exception {
intent.putExtra("scenario_name", "platform_view_rotate");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithSurfaceViewUiTest_testPlatformViewRotate");
}

@Test
public void testPlatformViewMultipleWithoutOverlays() throws Exception {
intent.putExtra("scenario_name", "platform_view_multiple_without_overlays");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithSurfaceViewUiTest_testPlatformViewMultipleWithoutOverlays");
}

@Test
public void testPlatformViewTwoIntersectingOverlays() throws Exception {
intent.putExtra("scenario_name", "platform_view_two_intersecting_overlays");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithSurfaceViewUiTest_testPlatformViewTwoIntersectingOverlays");
}

@Test
public void testPlatformViewWithoutOverlayIntersection() throws Exception {
intent.putExtra("scenario_name", "platform_view_no_overlay_intersection");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithSurfaceViewUiTest_testPlatformViewWithoutOverlayIntersection");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package dev.flutter.scenariosui;

import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
import dev.flutter.scenarios.PlatformViewsActivity;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
@LargeTest
public class PlatformViewWithTextureViewUiTest {
Intent intent;

@Rule @NonNull
public ActivityTestRule<PlatformViewsActivity> activityRule =
new ActivityTestRule<>(
PlatformViewsActivity.class, /*initialTouchMode=*/ false, /*launchActivity=*/ false);

@Before
public void setUp() {
intent = new Intent(Intent.ACTION_MAIN);
intent.putExtra("view_type", "scenarios/texturePlatformView");
}

@Test
public void testPlatformView() throws Exception {
intent.putExtra("scenario_name", "platform_view");
ScreenshotUtil.capture(
activityRule.launchActivity(intent), "PlatformViewWithTextureViewUiTest_testPlatformView");
}

@Test
public void testPlatformViewMultiple() throws Exception {
intent.putExtra("scenario_name", "platform_view_multiple");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithTextureViewUiTest_testPlatformViewMultiple");
}

@Test
public void testPlatformViewMultipleBackgroundForeground() throws Exception {
intent.putExtra("scenario_name", "platform_view_multiple_background_foreground");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithTextureViewUiTest_testPlatformViewMultipleBackgroundForeground");
}

@Test
public void testPlatformViewCliprect() throws Exception {
intent.putExtra("scenario_name", "platform_view_cliprect");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithTextureViewUiTest_testPlatformViewCliprect");
}

@Test
public void testPlatformViewCliprrect() throws Exception {
intent.putExtra("scenario_name", "platform_view_cliprrect");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithTextureViewUiTest_testPlatformViewCliprrect");
}

@Test
public void testPlatformViewClippath() throws Exception {
intent.putExtra("scenario_name", "platform_view_clippath");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithTextureViewUiTest_testPlatformViewClippath");
}

@Test
public void testPlatformViewTransform() throws Exception {
intent.putExtra("scenario_name", "platform_view_transform");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithTextureViewUiTest_testPlatformViewTransform");
}

@Test
public void testPlatformViewOpacity() throws Exception {
intent.putExtra("scenario_name", "platform_view_opacity");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithTextureViewUiTest_testPlatformViewOpacity");
}

@Test
public void testPlatformViewRotate() throws Exception {
intent.putExtra("scenario_name", "platform_view_rotate");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithTextureViewUiTest_testPlatformViewRotate");
}

@Test
public void testPlatformViewMultipleWithoutOverlays() throws Exception {
intent.putExtra("scenario_name", "platform_view_multiple_without_overlays");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithTextureViewUiTest_testPlatformViewMultipleWithoutOverlays");
}

@Test
public void testPlatformViewTwoIntersectingOverlays() throws Exception {
intent.putExtra("scenario_name", "platform_view_two_intersecting_overlays");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithTextureViewUiTest_testPlatformViewTwoIntersectingOverlays");
}

@Test
public void testPlatformViewWithoutOverlayIntersection() throws Exception {
intent.putExtra("scenario_name", "platform_view_no_overlay_intersection");
ScreenshotUtil.capture(
activityRule.launchActivity(intent),
"PlatformViewWithTextureViewUiTest_testPlatformViewWithoutOverlayIntersection");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".TextPlatformViewActivity"
android:name=".PlatformViewsActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
Expand Down
Loading