From 2e05ec36d5f17868bd6479161ac83402f3fae0dc Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Tue, 17 Nov 2020 19:27:47 -0800 Subject: [PATCH] Fix and clean up scenario app for Android (#22540) --- testing/scenario_app/README.md | 2 +- .../.cache/daemon/5.6.4/registry.bin | Bin 0 -> 73 bytes .../flutter/scenariosui/ScreenshotUtil.java | 32 +--------- .../android/app/src/main/AndroidManifest.xml | 3 +- .../app/src/main/res/values/styles.xml | 8 ++- ...atformTextureUiTests__testPlatformView.png | Bin 29557 -> 31938 bytes ...xtureUiTests__testPlatformViewClippath.png | Bin 19560 -> 18199 bytes ...xtureUiTests__testPlatformViewCliprect.png | Bin 18389 -> 16886 bytes ...tureUiTests__testPlatformViewCliprrect.png | Bin 20209 -> 18706 bytes ...xtureUiTests__testPlatformViewMultiple.png | Bin 25037 -> 27158 bytes ...atformViewMultipleBackgroundForeground.png | Bin 11452 -> 11562 bytes ...estPlatformViewMultipleWithoutOverlays.png | Bin 43916 -> 48858 bytes ...extureUiTests__testPlatformViewOpacity.png | Bin 22231 -> 23729 bytes ...TextureUiTests__testPlatformViewRotate.png | Bin 22559 -> 24156 bytes ...tureUiTests__testPlatformViewTransform.png | Bin 22950 -> 23490 bytes ...estPlatformViewTwoIntersectingOverlays.png | Bin 30760 -> 33122 bytes ....PlatformViewUiTests__testPlatformView.png | Bin 32713 -> 38945 bytes ...mViewUiTests__testPlatformViewClippath.png | Bin 24012 -> 28561 bytes ...mViewUiTests__testPlatformViewCliprect.png | Bin 18636 -> 18269 bytes ...ViewUiTests__testPlatformViewCliprrect.png | Bin 25946 -> 30127 bytes ...mViewUiTests__testPlatformViewMultiple.png | Bin 28040 -> 33432 bytes ...atformViewMultipleBackgroundForeground.png | Bin 12557 -> 13088 bytes ...estPlatformViewMultipleWithoutOverlays.png | Bin 50031 -> 63377 bytes ...rmViewUiTests__testPlatformViewOpacity.png | Bin 25349 -> 29758 bytes ...ormViewUiTests__testPlatformViewRotate.png | Bin 24657 -> 28477 bytes ...ViewUiTests__testPlatformViewTransform.png | Bin 26722 -> 34243 bytes ...estPlatformViewTwoIntersectingOverlays.png | Bin 33889 -> 39875 bytes testing/scenario_app/compile_android_jit.sh | 2 +- .../UnobstructedPlatformViewTests.m | 12 ++-- .../scenario_app/lib/src/platform_view.dart | 58 ++++-------------- 30 files changed, 28 insertions(+), 89 deletions(-) create mode 100644 testing/scenario_app/android/android/gradle-home/.cache/daemon/5.6.4/registry.bin diff --git a/testing/scenario_app/README.md b/testing/scenario_app/README.md index 131f7186f..23685c4de 100644 --- a/testing/scenario_app/README.md +++ b/testing/scenario_app/README.md @@ -46,7 +46,7 @@ The test is run on a x86 emulator. To run the test locally, you must create an e ``` hw.lcd.density = 480 -hw.lcd.height = 1920 +hw.lcd.height = 1680 hw.lcd.width = 1080 lcd.depth = 16 ``` diff --git a/testing/scenario_app/android/android/gradle-home/.cache/daemon/5.6.4/registry.bin b/testing/scenario_app/android/android/gradle-home/.cache/daemon/5.6.4/registry.bin new file mode 100644 index 0000000000000000000000000000000000000000..0f3905597f5bd4e03874f3612dabc22511cc807f GIT binary patch literal 73 zcmZQ%fB;4Y2FB7${x_N-T%kxtCPoJB#I%ysB88HSRE3np)ZF|$g`(8-%;J)wN`<7< T 0) { - statusBarHeight = context.getResources().getDimensionPixelSize(resourceId); - } - return statusBarHeight; - } - - private static int getActionBarHeight(Activity activity) { - int actionBarHeight = 0; - final android.content.res.TypedArray styledAttributes = - activity.getTheme().obtainStyledAttributes(new int[] {android.R.attr.actionBarSize}); - actionBarHeight = (int) styledAttributes.getDimension(0, 0); - styledAttributes.recycle(); - return actionBarHeight; - } - /** * Captures a screenshot of {@code TestableFlutterActivity}. * @@ -182,13 +158,7 @@ public class ScreenshotUtil { Bitmap bitmap = InstrumentationRegistry.getInstrumentation().getUiAutomation().takeScreenshot(); // Remove the status and action bars from the screenshot capture. - bitmap = - Bitmap.createBitmap( - bitmap, - 0, - getStatusBarHeight(), - bitmap.getWidth(), - bitmap.getHeight() - getStatusBarHeight() - getActionBarHeight(activity)); + bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight()); final String screenshotName = String.format("%s__%s", testClass, testName); // Write bitmap to the album. diff --git a/testing/scenario_app/android/app/src/main/AndroidManifest.xml b/testing/scenario_app/android/app/src/main/AndroidManifest.xml index 1ddceaf51..d5a088de8 100644 --- a/testing/scenario_app/android/app/src/main/AndroidManifest.xml +++ b/testing/scenario_app/android/app/src/main/AndroidManifest.xml @@ -14,7 +14,8 @@ android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:launchMode="singleTop" - android:windowSoftInputMode="adjustResize"> + android:windowSoftInputMode="adjustResize" + android:theme="@style/FullScreenScreenshot"> diff --git a/testing/scenario_app/android/app/src/main/res/values/styles.xml b/testing/scenario_app/android/app/src/main/res/values/styles.xml index 545b9c6d2..26fb23014 100644 --- a/testing/scenario_app/android/app/src/main/res/values/styles.xml +++ b/testing/scenario_app/android/app/src/main/res/values/styles.xml @@ -8,9 +8,11 @@ @color/colorAccent -