Skip to content

Commit 0a35de0

Browse files
authored
[web] Format AVIF decoder tests with dart format
1 parent 9e9ba96 commit 0a35de0

1 file changed

Lines changed: 34 additions & 46 deletions

File tree

‎engine/src/flutter/lib/web_ui/test/ui/image_decoder_test.dart‎

Lines changed: 34 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -105,55 +105,43 @@ Future<void> testMain() async {
105105
});
106106

107107
// Regression test for https://github.com/flutter/flutter/issues/160600
108-
test(
109-
'ImageDecoder-based codec decodes still AVIF images',
110-
() async {
111-
final HttpFetchResponse response = await httpFetch('/test_images/dog.avif');
112-
final Uint8List avifBytes = (await response.payload.asByteBuffer()).asUint8List();
113-
114-
final ui.Codec codec = await renderer.instantiateImageCodec(avifBytes);
115-
addTearDown(codec.dispose);
116-
expect(codec.frameCount, 1);
108+
test('ImageDecoder-based codec decodes still AVIF images', () async {
109+
final HttpFetchResponse response = await httpFetch('/test_images/dog.avif');
110+
final Uint8List avifBytes = (await response.payload.asByteBuffer()).asUint8List();
117111

118-
final ui.FrameInfo frame = await codec.getNextFrame();
119-
addTearDown(frame.image.dispose);
120-
expect(frame.image.width, 180);
121-
expect(frame.image.height, 180);
122-
},
123-
skip: !browserSupportsImageDecoder,
124-
);
125-
126-
test(
127-
'ImageDecoder-based codec reports multiple frames for animated AVIF images',
128-
() async {
129-
final HttpFetchResponse response = await httpFetch('/test_images/alphabetAnim.avif');
130-
final Uint8List avifBytes = (await response.payload.asByteBuffer()).asUint8List();
131-
132-
final ui.Codec codec = await renderer.instantiateImageCodec(avifBytes);
133-
addTearDown(codec.dispose);
134-
expect(codec.frameCount, greaterThan(1));
135-
},
136-
skip: !browserSupportsImageDecoder,
137-
);
112+
final ui.Codec codec = await renderer.instantiateImageCodec(avifBytes);
113+
addTearDown(codec.dispose);
114+
expect(codec.frameCount, 1);
138115

139-
test(
140-
'ImageDecoder-based codec decodes still AVIF images loaded from a URL',
141-
() async {
142-
// The test server serves .avif files as image/avif, so the response body
143-
// is streamed directly to ImageDecoder instead of being sniffed.
144-
final ui.Codec codec = await renderer.instantiateImageCodecFromUrl(
145-
Uri(path: '/test_images/dog.avif'),
146-
);
147-
addTearDown(codec.dispose);
148-
expect(codec.frameCount, 1);
116+
final ui.FrameInfo frame = await codec.getNextFrame();
117+
addTearDown(frame.image.dispose);
118+
expect(frame.image.width, 180);
119+
expect(frame.image.height, 180);
120+
}, skip: !browserSupportsImageDecoder);
121+
122+
test('ImageDecoder-based codec reports multiple frames for animated AVIF images', () async {
123+
final HttpFetchResponse response = await httpFetch('/test_images/alphabetAnim.avif');
124+
final Uint8List avifBytes = (await response.payload.asByteBuffer()).asUint8List();
125+
126+
final ui.Codec codec = await renderer.instantiateImageCodec(avifBytes);
127+
addTearDown(codec.dispose);
128+
expect(codec.frameCount, greaterThan(1));
129+
}, skip: !browserSupportsImageDecoder);
130+
131+
test('ImageDecoder-based codec decodes still AVIF images loaded from a URL', () async {
132+
// The test server serves .avif files as image/avif, so the response body
133+
// is streamed directly to ImageDecoder instead of being sniffed.
134+
final ui.Codec codec = await renderer.instantiateImageCodecFromUrl(
135+
Uri(path: '/test_images/dog.avif'),
136+
);
137+
addTearDown(codec.dispose);
138+
expect(codec.frameCount, 1);
149139

150-
final ui.FrameInfo frame = await codec.getNextFrame();
151-
addTearDown(frame.image.dispose);
152-
expect(frame.image.width, 180);
153-
expect(frame.image.height, 180);
154-
},
155-
skip: !browserSupportsImageDecoder,
156-
);
140+
final ui.FrameInfo frame = await codec.getNextFrame();
141+
addTearDown(frame.image.dispose);
142+
expect(frame.image.width, 180);
143+
expect(frame.image.height, 180);
144+
}, skip: !browserSupportsImageDecoder);
157145

158146
test(
159147
'_BrowserEngineCodec.getNextFrame() throws StateError and cleans up if disposed during decode',

0 commit comments

Comments
 (0)