Delete un-tested hybrid_android_views, add layering to android_engine_test. (#162903)

Another large test suite that has never been running.

The underlying thing I _think_ it wanted tested, which was hybrid
composition, is now tested by `android_engine_test`. I also added a red
square on top of each platform view so that, like
`hybrid_android_views`, we can make sure layering is working as
expected.

Any other ideas? Can also be follow-up PRs?
This commit is contained in:
Matan Lurey
2025-02-07 13:51:54 -08:00
committed by GitHub
parent 2c5c1143c2
commit 6e631c5a46
33 changed files with 50 additions and 2534 deletions

View File

@@ -61,7 +61,8 @@ class NativeDriverSupportPlugin :
selector = NativeSelector.ByContentDescription(call.argument("label")!!)
}
"byNativeIntegerId" -> {
selector = NativeSelector.ByViewId(call.argument("id")!!)
val stringId = call.argument<String>("id")!!
selector = NativeSelector.ByViewId(stringId.toInt())
}
else -> {
result.error("INVALID_SELECTOR", "Not supported", kind)

View File

@@ -0,0 +1,23 @@
// Copyright 2014 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.
import 'package:flutter/material.dart';
final class MainApp extends StatelessWidget {
const MainApp({super.key, required this.platformView});
final Widget platformView;
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Stack(
children: <Widget>[
platformView,
Center(child: Container(width: 100, height: 100, color: Colors.red)),
],
),
);
}
}

View File

@@ -11,6 +11,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_driver/driver_extension.dart';
import '../src/allow_list_devices.dart';
import '_shared.dart';
void main() async {
ensureAndroidDevice();
@@ -18,19 +19,13 @@ void main() async {
// Run on full screen.
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
runApp(const MainApp());
}
final class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
debugShowCheckedModeBanner: false,
home: _HybridCompositionAndroidPlatformView(viewType: 'blue_orange_gradient_platform_view'),
);
}
runApp(
const MainApp(
platformView: _HybridCompositionAndroidPlatformView(
viewType: 'blue_orange_gradient_platform_view',
),
),
);
}
final class _HybridCompositionAndroidPlatformView extends StatelessWidget {

View File

@@ -8,6 +8,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_driver/driver_extension.dart';
import '../src/allow_list_devices.dart';
import '_shared.dart';
void main() async {
ensureAndroidDevice();
@@ -15,22 +16,12 @@ void main() async {
// Run on full screen.
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
runApp(const MainApp());
}
final class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
debugShowCheckedModeBanner: false,
// It is assumed:
// - The Android SDK version is >= 23 (the test driver checks)
// - This view does NOT use a SurfaceView
//
// See https://github.com/flutter/flutter/blob/main/docs/platforms/android/Android-Platform-Views.md.
home: AndroidView(viewType: 'blue_orange_gradient_platform_view'),
);
}
runApp(
// It is assumed:
// - The Android SDK version is >= 23 (the test driver checks)
// - This view does NOT use a SurfaceView
//
// See https://github.com/flutter/flutter/blob/main/docs/platforms/android/Android-Platform-Views.md.
const MainApp(platformView: AndroidView(viewType: 'blue_orange_gradient_platform_view')),
);
}

View File

@@ -8,6 +8,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_driver/driver_extension.dart';
import '../src/allow_list_devices.dart';
import '_shared.dart';
void main() async {
ensureAndroidDevice();
@@ -15,22 +16,14 @@ void main() async {
// Run on full screen.
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
runApp(const MainApp());
}
final class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
debugShowCheckedModeBanner: false,
runApp(
const MainApp(
// It is assumed:
// - The Android SDK version is >= 23 (the test driver checks)
// - This view DOES use a SurfaceView
//
// See https://github.com/flutter/flutter/blob/main/docs/platforms/android/Android-Platform-Views.md.
home: AndroidView(viewType: 'blue_orange_gradient_surface_view_platform_view'),
);
}
platformView: AndroidView(viewType: 'blue_orange_gradient_surface_view_platform_view'),
),
);
}

View File

@@ -13,12 +13,12 @@ import '../_luci_skia_gold_prelude.dart';
///
/// ```sh
/// # Checkout HEAD, i.e. *before* changes you want to test.
/// UPDATE_GOLDENS=1 flutter drive lib/platform_view/hybrid_compoisition_platform_view_main.dart
/// UPDATE_GOLDENS=1 flutter drive lib/platform_view/hybrid_composition_platform_view_main.dart
///
/// # Make your changes.
///
/// # Run the test against baseline.
/// flutter drive lib/platform_view/hybrid_compoisition_platform_view_main.dart
/// flutter drive lib/platform_view/hybrid_composition_platform_view_main.dart
/// ```
///
/// For a convenient way to deflake a test, see `tool/deflake.dart`.