@@ -557,5 +557,38 @@ void main() {
557
557
check (position).isGreaterThan (basePosition);
558
558
check (platform.position).equals (position);
559
559
});
560
+
561
+ testWidgets ('video can be zoomed in and out' , (tester) async {
562
+ await setupPage (tester, videoSrc: Uri .parse (kTestVideoUrl));
563
+ check (platform.isPlaying).isTrue ();
564
+
565
+ final initialRect = tester.getRect (find.byType (VideoPlayer ));
566
+ final bottomRight = initialRect.bottomRight;
567
+ // Define initial positions for two fingers near bottom right corner:
568
+ // In the case of mismatch between media and device orientation,
569
+ // the zoom gesture is still expected to work,
570
+ // even if the fingers are not in the image's frame.
571
+ final Offset finger1Start = bottomRight + const Offset (- 70.0 , - 70.0 );
572
+ final Offset finger2Start = bottomRight + const Offset (- 20.0 , - 20.0 );
573
+ final TestGesture gesture1 = await tester.startGesture (finger1Start);
574
+ final TestGesture gesture2 = await tester.startGesture (finger2Start);
575
+ await tester.pump ();
576
+
577
+ // Simulate pinch out (zoom in)
578
+ await gesture1.moveBy (const Offset (- 20.0 , - 20.0 ));
579
+ await gesture2.moveBy (const Offset (20.0 , 20.0 ));
580
+ await tester.pump ();
581
+ final zoomedInRect = tester.getRect (find.byType (VideoPlayer ));
582
+ check (zoomedInRect.width).isGreaterThan (initialRect.width);
583
+ check (zoomedInRect.height).isGreaterThan (initialRect.height);
584
+
585
+ // Simulate pinch out (zoom in)
586
+ await gesture1.moveBy (const Offset (30.0 , 30.0 ));
587
+ await gesture2.moveBy (const Offset (- 30.0 , - 30.0 ));
588
+ await tester.pump ();
589
+ final zoomedOutRect = tester.getRect (find.byType (VideoPlayer ));
590
+ check (zoomedOutRect.width).isLessThan (zoomedInRect.width);
591
+ check (zoomedOutRect.height).isLessThan (zoomedInRect.height);
592
+ });
560
593
});
561
594
}
0 commit comments