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]. <!-- Links --> [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
This commit is contained in:
parent
29af4a174c
commit
d1385a4827
@ -166,5 +166,14 @@ void main() {
|
|||||||
await channel.invokeMethod('test') as List<Object?>;
|
await channel.invokeMethod('test') as List<Object?>;
|
||||||
expect(_findColor(result, <double>[0.0, 1.0, 0.0]), isTrue);
|
expect(_findColor(result, <double>[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<Object?> result =
|
||||||
|
await channel.invokeMethod('test') as List<Object?>;
|
||||||
|
expect(_findColor(result, _deepRed), isTrue);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ const String _displayP3Logo =
|
|||||||
'gr3yrjmlwqXLjmWw1O2I5Wmp9Xxjyh+AVIZ6ADIAqcwClakzeMgApDILVKbO4CED'
|
'gr3yrjmlwqXLjmWw1O2I5Wmp9Xxjyh+AVIZ6ADIAqcwClakzeMgApDILVKbO4CED'
|
||||||
'kMosUJk6g4dUBuRfvf1am9VRqzYAAAAASUVORK5CYII=';
|
'kMosUJk6g4dUBuRfvf1am9VRqzYAAAAASUVORK5CYII=';
|
||||||
|
|
||||||
void main() => run(Setup.drawnImage);
|
void main() => run(Setup.container);
|
||||||
|
|
||||||
enum Setup {
|
enum Setup {
|
||||||
none,
|
none,
|
||||||
@ -145,6 +145,7 @@ enum Setup {
|
|||||||
canvasSaveLayer,
|
canvasSaveLayer,
|
||||||
blur,
|
blur,
|
||||||
drawnImage,
|
drawnImage,
|
||||||
|
container,
|
||||||
}
|
}
|
||||||
|
|
||||||
void run(Setup setup) {
|
void run(Setup setup) {
|
||||||
@ -264,7 +265,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
_loadImage().then((ui.Image? value) => setState(() { _image = value; }));
|
_loadImage().then((ui.Image? value) => setState(() { _image = value; }));
|
||||||
case Setup.drawnImage:
|
case Setup.drawnImage:
|
||||||
_drawImage().then((ui.Image? value) => setState(() { _image = value; }));
|
_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;
|
break;
|
||||||
}
|
}
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -297,6 +298,16 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
child: Image.memory(base64Decode(_displayP3Logo))),
|
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(
|
return Scaffold(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user