Enabling the ImageFiltered(ImageFilter.matrix) page of macrobenchmark (#58277)
diff --git a/dev/benchmarks/macrobenchmarks/lib/common.dart b/dev/benchmarks/macrobenchmarks/lib/common.dart
index c4f015a..34297c3 100644
--- a/dev/benchmarks/macrobenchmarks/lib/common.dart
+++ b/dev/benchmarks/macrobenchmarks/lib/common.dart
@@ -13,3 +13,6 @@
const String kAnimatedPlaceholderRouteName = '/animated_placeholder';
const String kColorFilterAndFadeRouteName = '/color_filter_and_fade';
const String kFadingChildAnimationRouteName = '/fading_child_animation';
+const String kImageFilteredTransformAnimationRouteName = '/imagefiltered_transform_animation';
+
+const String kScrollableName = '/macrobenchmark_listview';
diff --git a/dev/benchmarks/macrobenchmarks/lib/main.dart b/dev/benchmarks/macrobenchmarks/lib/main.dart
index d7320eb..9097c8f 100644
--- a/dev/benchmarks/macrobenchmarks/lib/main.dart
+++ b/dev/benchmarks/macrobenchmarks/lib/main.dart
@@ -42,6 +42,7 @@
kAnimatedPlaceholderRouteName: (BuildContext context) => AnimatedPlaceholderPage(),
kColorFilterAndFadeRouteName: (BuildContext context) => ColorFilterAndFadePage(),
kFadingChildAnimationRouteName: (BuildContext context) => const FilteredChildAnimationPage(FilterType.opacity),
+ kImageFilteredTransformAnimationRouteName: (BuildContext context) => const FilteredChildAnimationPage(FilterType.rotateFilter),
},
);
}
@@ -55,6 +56,7 @@
return Scaffold(
appBar: AppBar(title: const Text(kMacrobenchmarks)),
body: ListView(
+ key: const Key(kScrollableName),
children: <Widget>[
RaisedButton(
key: const Key(kCullOpacityRouteName),
@@ -133,6 +135,13 @@
Navigator.pushNamed(context, kFadingChildAnimationRouteName);
},
),
+ RaisedButton(
+ key: const Key(kImageFilteredTransformAnimationRouteName),
+ child: const Text('ImageFiltered Transform Animation'),
+ onPressed: () {
+ Navigator.pushNamed(context, kImageFilteredTransformAnimationRouteName);
+ },
+ ),
],
),
);
diff --git a/dev/benchmarks/macrobenchmarks/lib/src/filtered_child_animation.dart b/dev/benchmarks/macrobenchmarks/lib/src/filtered_child_animation.dart
index 15abc52..cbc378d 100644
--- a/dev/benchmarks/macrobenchmarks/lib/src/filtered_child_animation.dart
+++ b/dev/benchmarks/macrobenchmarks/lib/src/filtered_child_animation.dart
@@ -42,8 +42,7 @@
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
final RenderBox childBox = _childKey.currentContext.findRenderObject() as RenderBox;
- final Offset localCenter = childBox.paintBounds.center;
- _childCenter = childBox.localToGlobal(localCenter);
+ _childCenter = childBox.paintBounds.center;
});
_controller = AnimationController(vsync: this, duration: const Duration(seconds: 2));
_controller.repeat();
diff --git a/dev/benchmarks/macrobenchmarks/test_driver/imagefiltered_transform_animation_perf.dart b/dev/benchmarks/macrobenchmarks/test_driver/imagefiltered_transform_animation_perf.dart
new file mode 100644
index 0000000..8169d13
--- /dev/null
+++ b/dev/benchmarks/macrobenchmarks/test_driver/imagefiltered_transform_animation_perf.dart
@@ -0,0 +1,11 @@
+// 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_driver/driver_extension.dart';
+import 'package:macrobenchmarks/main.dart' as app;
+
+void main() {
+ enableFlutterDriverExtension();
+ app.main();
+}
diff --git a/dev/benchmarks/macrobenchmarks/test_driver/imagefiltered_transform_animation_perf_test.dart b/dev/benchmarks/macrobenchmarks/test_driver/imagefiltered_transform_animation_perf_test.dart
new file mode 100644
index 0000000..1ed9943
--- /dev/null
+++ b/dev/benchmarks/macrobenchmarks/test_driver/imagefiltered_transform_animation_perf_test.dart
@@ -0,0 +1,16 @@
+// 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:macrobenchmarks/common.dart';
+
+import 'util.dart';
+
+void main() {
+ macroPerfTest(
+ 'imagefiltered_transform_animation_perf',
+ kImageFilteredTransformAnimationRouteName,
+ pageDelay: const Duration(seconds: 1),
+ duration: const Duration(seconds: 10),
+ );
+}
diff --git a/dev/benchmarks/macrobenchmarks/test_driver/util.dart b/dev/benchmarks/macrobenchmarks/test_driver/util.dart
index 0f5de24..e67e559 100644
--- a/dev/benchmarks/macrobenchmarks/test_driver/util.dart
+++ b/dev/benchmarks/macrobenchmarks/test_driver/util.dart
@@ -7,6 +7,8 @@
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
+import 'package:macrobenchmarks/common.dart';
+
void macroPerfTest(
String testName,
String routeName,
@@ -27,8 +29,11 @@
await driver.forceGC();
+ final SerializableFinder scrollable = find.byValueKey(kScrollableName);
+ expect(scrollable, isNotNull);
final SerializableFinder button = find.byValueKey(routeName);
expect(button, isNotNull);
+ await driver.scrollUntilVisible(scrollable, button, dyScroll: -50.0);
await driver.tap(button);
if (pageDelay != null) {
diff --git a/dev/devicelab/bin/tasks/imagefiltered_transform_animation_perf__timeline_summary.dart b/dev/devicelab/bin/tasks/imagefiltered_transform_animation_perf__timeline_summary.dart
new file mode 100644
index 0000000..c3901f0
--- /dev/null
+++ b/dev/devicelab/bin/tasks/imagefiltered_transform_animation_perf__timeline_summary.dart
@@ -0,0 +1,14 @@
+// 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 'dart:async';
+
+import 'package:flutter_devicelab/tasks/perf_tests.dart';
+import 'package:flutter_devicelab/framework/adb.dart';
+import 'package:flutter_devicelab/framework/framework.dart';
+
+Future<void> main() async {
+ deviceOperatingSystem = DeviceOperatingSystem.android;
+ await task(createImageFilteredTransformAnimationPerfTest());
+}
diff --git a/dev/devicelab/lib/tasks/perf_tests.dart b/dev/devicelab/lib/tasks/perf_tests.dart
index 40811b0..4343fb5 100644
--- a/dev/devicelab/lib/tasks/perf_tests.dart
+++ b/dev/devicelab/lib/tasks/perf_tests.dart
@@ -217,6 +217,14 @@
).run;
}
+TaskFunction createImageFilteredTransformAnimationPerfTest() {
+ return PerfTest(
+ '${flutterDirectory.path}/dev/benchmarks/macrobenchmarks',
+ 'test_driver/imagefiltered_transform_animation_perf.dart',
+ 'imagefiltered_transform_animation_perf',
+ ).run;
+}
+
/// Measure application startup performance.
class StartupTest {
const StartupTest(this.testDirectory, { this.reportMetrics = true });
diff --git a/dev/devicelab/manifest.yaml b/dev/devicelab/manifest.yaml
index 521f675..73ba319 100644
--- a/dev/devicelab/manifest.yaml
+++ b/dev/devicelab/manifest.yaml
@@ -213,6 +213,12 @@
stage: devicelab
required_agent_capabilities: ["mac/android"]
+ imagefiltered_transform_animation_perf__timeline_summary:
+ description: >
+ Measures the runtime performance of imagefiltered widget with transform on Android.
+ stage: devicelab
+ required_agent_capabilities: ["mac/android"]
+
flavors_test:
description: >
Checks that flavored builds work on Android.