@@ -49,6 +49,8 @@ void main() {
49
49
} else {
50
50
expect (e.toString (), contains ('Codec failed' ));
51
51
}
52
+ } finally {
53
+ codec.dispose ();
52
54
}
53
55
});
54
56
@@ -64,6 +66,7 @@ void main() {
64
66
frameInfo.image.height,
65
67
]);
66
68
}
69
+ codec.dispose ();
67
70
expect (
68
71
decodedFrameInfos,
69
72
equals (< List <int >> [
@@ -88,6 +91,7 @@ void main() {
88
91
frameInfo.image.height,
89
92
]);
90
93
}
94
+ codec.dispose ();
91
95
expect (
92
96
decodedFrameInfos,
93
97
equals (< List <int >> [
@@ -115,6 +119,7 @@ void main() {
115
119
frameInfo.image.height,
116
120
]);
117
121
}
122
+ codec.dispose ();
118
123
expect (
119
124
decodedFrameInfos,
120
125
equals (< List <int >> [
@@ -136,6 +141,7 @@ void main() {
136
141
} on Exception catch (e) {
137
142
expect (e.toString (), contains ('Decoded image has been disposed' ));
138
143
}
144
+ codec.dispose ();
139
145
});
140
146
141
147
test ('Animated gif can reuse across multiple frames' , () async {
@@ -153,6 +159,7 @@ void main() {
153
159
for (int i = 0 ; i < 4 ; i++ ) {
154
160
frameInfo = await codec.getNextFrame ();
155
161
}
162
+ codec.dispose ();
156
163
157
164
final ui.Image image = frameInfo.image;
158
165
final ByteData imageData = (await image.toByteData (format: ui.ImageByteFormat .png))! ;
@@ -180,6 +187,7 @@ void main() {
180
187
for (int i = 0 ; i < 69 ; i++ ) {
181
188
frameInfo = await codec.getNextFrame ();
182
189
}
190
+ codec.dispose ();
183
191
184
192
final ui.Image image = frameInfo.image;
185
193
final ByteData imageData = (await image.toByteData (format: ui.ImageByteFormat .png))! ;
@@ -220,6 +228,7 @@ void main() {
220
228
expect (imageData.buffer.asUint8List (), goldenData);
221
229
}
222
230
}
231
+ codec.dispose ();
223
232
});
224
233
225
234
test ('Animated apng alpha type handling' , () async {
@@ -237,6 +246,7 @@ void main() {
237
246
image = (await codec.getNextFrame ()).image;
238
247
imageData = (await image.toByteData ())! ;
239
248
expect (imageData.getUint32 (0 ), 0x99000099 );
249
+ codec.dispose ();
240
250
});
241
251
242
252
test ('Animated apng background color restore' , () async {
@@ -261,6 +271,7 @@ void main() {
261
271
image = (await codec.getNextFrame ()).image;
262
272
imageData = (await image.toByteData ())! ;
263
273
expect (imageData.getUint32 (imageData.lengthInBytes - 4 ), 0x00000000 );
274
+ codec.dispose ();
264
275
});
265
276
266
277
test ('Animated apng frame decode does not crash with invalid destination region' , () async {
@@ -277,6 +288,8 @@ void main() {
277
288
} else {
278
289
expect (e.toString (), contains ('Codec failed' ));
279
290
}
291
+ } finally {
292
+ codec.dispose ();
280
293
}
281
294
});
282
295
@@ -298,6 +311,8 @@ void main() {
298
311
} else {
299
312
expect (e.toString (), contains ('Codec failed' ));
300
313
}
314
+ } finally {
315
+ codec.dispose ();
301
316
}
302
317
},
303
318
);
0 commit comments