Unverified Commit 0b686be3 authored by Polina Cherkasova's avatar Polina Cherkasova Committed by GitHub

Fix not disposed ImageInfo in tests. (#142287)

parent 827c94c4
...@@ -1082,8 +1082,12 @@ void main() { ...@@ -1082,8 +1082,12 @@ void main() {
expect(lastFrame, isNull); expect(lastFrame, isNull);
expect(lastFrameWasSync, isFalse); expect(lastFrameWasSync, isFalse);
expect(find.byType(RawImage), findsOneWidget); expect(find.byType(RawImage), findsOneWidget);
streamCompleter.setData(imageInfo: ImageInfo(image: image10x10));
final ImageInfo info = ImageInfo(image: image10x10);
addTearDown(info.dispose);
streamCompleter.setData(imageInfo: info);
await tester.pump(); await tester.pump();
expect(lastFrame, 0); expect(lastFrame, 0);
expect(lastFrameWasSync, isFalse); expect(lastFrameWasSync, isFalse);
}); });
...@@ -1261,8 +1265,12 @@ void main() { ...@@ -1261,8 +1265,12 @@ void main() {
expect(chunkEvents.length, 3); expect(chunkEvents.length, 3);
expect(find.text('loading 30 / 100'), findsOneWidget); expect(find.text('loading 30 / 100'), findsOneWidget);
expect(find.byType(RawImage), findsNothing); expect(find.byType(RawImage), findsNothing);
streamCompleter.setData(imageInfo: ImageInfo(image: image10x10));
final ImageInfo info = ImageInfo(image: image10x10);
addTearDown(info.dispose);
streamCompleter.setData(imageInfo: info);
await tester.pump(); await tester.pump();
expect(chunkEvents.length, 4); expect(chunkEvents.length, 4);
expect(find.byType(Text), findsNothing); expect(find.byType(Text), findsNothing);
expect(find.byType(RawImage), findsOneWidget); expect(find.byType(RawImage), findsOneWidget);
...@@ -1282,7 +1290,9 @@ void main() { ...@@ -1282,7 +1290,9 @@ void main() {
expect(tester.binding.hasScheduledFrame, isFalse); expect(tester.binding.hasScheduledFrame, isFalse);
streamCompleter.setData(chunkEvent: const ImageChunkEvent(cumulativeBytesLoaded: 10, expectedTotalBytes: 100)); streamCompleter.setData(chunkEvent: const ImageChunkEvent(cumulativeBytesLoaded: 10, expectedTotalBytes: 100));
expect(tester.binding.hasScheduledFrame, isFalse); expect(tester.binding.hasScheduledFrame, isFalse);
streamCompleter.setData(imageInfo: ImageInfo(image: image10x10)); final ImageInfo info = ImageInfo(image: image10x10);
addTearDown(info.dispose);
streamCompleter.setData(imageInfo: info);
expect(tester.binding.hasScheduledFrame, isTrue); expect(tester.binding.hasScheduledFrame, isTrue);
await tester.pump(); await tester.pump();
streamCompleter.setData(chunkEvent: const ImageChunkEvent(cumulativeBytesLoaded: 10, expectedTotalBytes: 100)); streamCompleter.setData(chunkEvent: const ImageChunkEvent(cumulativeBytesLoaded: 10, expectedTotalBytes: 100));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment