@@ -452,6 +452,74 @@ void main() {
452452 );
453453 });
454454
455+ testWidgets ('ImageStream emits the completer debugLabel (static image)' , (
456+ WidgetTester tester,
457+ ) async {
458+ final mockCodec = MockCodec ();
459+ mockCodec.frameCount = 1 ;
460+ final codecStream = StreamController <Codec >();
461+
462+ const String debugLabel = 'debug label' ;
463+ final ImageStreamCompleter imageStream = MultiImageStreamCompleter (
464+ codec: codecStream.stream,
465+ scale: 1.0 ,
466+ debugLabel: debugLabel,
467+ );
468+
469+ final emittedImages = < ImageInfo > [];
470+ imageStream.addListener (
471+ ImageStreamListener ((ImageInfo image, bool synchronousCall) {
472+ emittedImages.add (image);
473+ }),
474+ );
475+
476+ codecStream.add (mockCodec);
477+ await tester.idle ();
478+
479+ mockCodec.completeNextFrame (
480+ FakeFrameInfo (const Duration (milliseconds: 200 ), image20x10),
481+ );
482+ await tester.idle ();
483+
484+ expect (emittedImages.single.debugLabel, debugLabel);
485+ });
486+
487+ testWidgets ('ImageStream emits the completer debugLabel (animated images)' , (
488+ WidgetTester tester,
489+ ) async {
490+ final mockCodec = MockCodec ();
491+ mockCodec.frameCount = 2 ;
492+ mockCodec.repetitionCount = 0 ;
493+ final codecStream = StreamController <Codec >();
494+
495+ const String debugLabel = 'debug label' ;
496+ final ImageStreamCompleter imageStream = MultiImageStreamCompleter (
497+ codec: codecStream.stream,
498+ scale: 1.0 ,
499+ debugLabel: debugLabel,
500+ );
501+
502+ final emittedImages = < ImageInfo > [];
503+ imageStream.addListener (
504+ ImageStreamListener ((ImageInfo image, bool synchronousCall) {
505+ emittedImages.add (image);
506+ }),
507+ );
508+
509+ codecStream.add (mockCodec);
510+ await tester.idle ();
511+
512+ mockCodec.completeNextFrame (
513+ FakeFrameInfo (const Duration (milliseconds: 200 ), image20x10),
514+ );
515+ await tester.idle ();
516+
517+ // Animated images are emitted on an animation tick instead of directly.
518+ await tester.pump ();
519+
520+ expect (emittedImages.single.debugLabel, debugLabel);
521+ });
522+
455523 testWidgets ('ImageStream emits frames (animated images)' , (
456524 WidgetTester tester,
457525 ) async {
0 commit comments