From d1385a48271f95356c2f186f5a45076a2c146be2 Mon Sep 17 00:00:00 2001 From: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Date: Tue, 3 Sep 2024 09:41:30 -0700 Subject: [PATCH] Adds wide gamut framework test (#153319) issue: https://github.com/flutter/flutter/issues/127855 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --- .../integration_test/app_test.dart | 9 +++++++++ .../wide_gamut_test/lib/main.dart | 15 +++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/dev/integration_tests/wide_gamut_test/integration_test/app_test.dart b/dev/integration_tests/wide_gamut_test/integration_test/app_test.dart index 10d615b9a2..a120d1c2ae 100644 --- a/dev/integration_tests/wide_gamut_test/integration_test/app_test.dart +++ b/dev/integration_tests/wide_gamut_test/integration_test/app_test.dart @@ -166,5 +166,14 @@ void main() { await channel.invokeMethod('test') as List; expect(_findColor(result, [0.0, 1.0, 0.0]), isTrue); }); + testWidgets('draw container with wide gamut works', (WidgetTester tester) async { + app.run(app.Setup.container); + await tester.pumpAndSettle(const Duration(seconds: 2)); + + const MethodChannel channel = MethodChannel('flutter/screenshot'); + final List result = + await channel.invokeMethod('test') as List; + expect(_findColor(result, _deepRed), isTrue); + }); }); } diff --git a/dev/integration_tests/wide_gamut_test/lib/main.dart b/dev/integration_tests/wide_gamut_test/lib/main.dart index caeb9cc909..3d7d035098 100644 --- a/dev/integration_tests/wide_gamut_test/lib/main.dart +++ b/dev/integration_tests/wide_gamut_test/lib/main.dart @@ -137,7 +137,7 @@ const String _displayP3Logo = 'gr3yrjmlwqXLjmWw1O2I5Wmp9Xxjyh+AVIZ6ADIAqcwClakzeMgApDILVKbO4CED' 'kMosUJk6g4dUBuRfvf1am9VRqzYAAAAASUVORK5CYII='; -void main() => run(Setup.drawnImage); +void main() => run(Setup.container); enum Setup { none, @@ -145,6 +145,7 @@ enum Setup { canvasSaveLayer, blur, drawnImage, + container, } void run(Setup setup) { @@ -264,7 +265,7 @@ class _MyHomePageState extends State { _loadImage().then((ui.Image? value) => setState(() { _image = value; })); case Setup.drawnImage: _drawImage().then((ui.Image? value) => setState(() { _image = value; })); - case Setup.image || Setup.blur || Setup.none: + case Setup.image || Setup.blur || Setup.none || Setup.container: break; } super.initState(); @@ -297,6 +298,16 @@ class _MyHomePageState extends State { child: Image.memory(base64Decode(_displayP3Logo))), ], ); + case Setup.container: + imageWidget = Container( + width: 100, + height: 100, + color: const Color.from( + alpha: 1, + red: 1, + green: 0, + blue: 0, + colorSpace: ui.ColorSpace.displayP3)); } return Scaffold(