@@ -636,5 +636,57 @@ void main() {
636
636
expect (find.text ('Cut' ), findsOneWidget);
637
637
expect (find.text ('Paste' ), findsOneWidget);
638
638
expect (find.text ('Select all' ), findsOneWidget);
639
- }, skip: isBrowser);
639
+ }, skip: isBrowser, variant: const TargetPlatformVariant (< TargetPlatform > { TargetPlatform .android }));
640
+
641
+ // TODO(justinmc): https://github.com/flutter/flutter/issues/60145
642
+ testWidgets ('Paste always appears regardless of clipboard content on iOS' , (WidgetTester tester) async {
643
+ final TextEditingController controller = TextEditingController (
644
+ text: 'Atwater Peel Sherbrooke Bonaventure' ,
645
+ );
646
+ await tester.pumpWidget (
647
+ MaterialApp (
648
+ home: Material (
649
+ child: Column (
650
+ children: < Widget > [
651
+ TextField (
652
+ controller: controller,
653
+ ),
654
+ ],
655
+ ),
656
+ ),
657
+ ),
658
+ );
659
+
660
+ // Make sure the clipboard is empty.
661
+ await Clipboard .setData (const ClipboardData (text: '' ));
662
+
663
+ // Double tap to select the first word.
664
+ const int index = 4 ;
665
+ await tester.tapAt (textOffsetToPosition (tester, index));
666
+ await tester.pump (const Duration (milliseconds: 50 ));
667
+ await tester.tapAt (textOffsetToPosition (tester, index));
668
+ await tester.pumpAndSettle ();
669
+
670
+ // Paste is showing even though clipboard is empty.
671
+ expect (find.text ('Paste' ), findsOneWidget);
672
+ expect (find.text ('Copy' ), findsOneWidget);
673
+ expect (find.text ('Cut' ), findsOneWidget);
674
+
675
+ // Tap copy to add something to the clipboard and close the menu.
676
+ await tester.tapAt (tester.getCenter (find.text ('Copy' )));
677
+ await tester.pumpAndSettle ();
678
+ expect (find.text ('Copy' ), findsNothing);
679
+ expect (find.text ('Cut' ), findsNothing);
680
+
681
+ // Double tap to show the menu again.
682
+ await tester.tapAt (textOffsetToPosition (tester, index));
683
+ await tester.pump (const Duration (milliseconds: 50 ));
684
+ await tester.tapAt (textOffsetToPosition (tester, index));
685
+ await tester.pumpAndSettle ();
686
+
687
+ // Paste still shows.
688
+ expect (find.text ('Copy' ), findsOneWidget);
689
+ expect (find.text ('Cut' ), findsOneWidget);
690
+ expect (find.text ('Paste' ), findsOneWidget);
691
+ }, skip: isBrowser, variant: const TargetPlatformVariant (< TargetPlatform > { TargetPlatform .iOS }));
640
692
}
0 commit comments