Skip to content

Commit ce82cc6

Browse files
authored
Fix Dart 2 issues in editable_text_test. (flutter#14632)
Need to use `typed(any)` instead of `any` in Dart 2.
1 parent 33ea7f8 commit ce82cc6

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

packages/flutter/test/widgets/editable_text_test.dart

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -591,16 +591,16 @@ void main() {
591591
controller.selection = new TextSelection.collapsed(offset: controller.text.length);
592592

593593
controls = new MockTextSelectionControls();
594-
when(controls.buildHandle(any, any, any)).thenReturn(new Container());
595-
when(controls.buildToolbar(any, any, any, any)).thenReturn(new Container());
594+
when(controls.buildHandle(typed(any), typed(any), typed(any))).thenReturn(new Container());
595+
when(controls.buildToolbar(typed(any), typed(any), typed(any), typed(any))).thenReturn(new Container());
596596
});
597597

598598
testWidgets('are exposed', (WidgetTester tester) async {
599599
final SemanticsTester semantics = new SemanticsTester(tester);
600600

601-
when(controls.canCopy(any)).thenReturn(false);
602-
when(controls.canCut(any)).thenReturn(false);
603-
when(controls.canPaste(any)).thenReturn(false);
601+
when(controls.canCopy(typed(any))).thenReturn(false);
602+
when(controls.canCut(typed(any))).thenReturn(false);
603+
when(controls.canPaste(typed(any))).thenReturn(false);
604604

605605
await _buildApp(controls, tester);
606606
await tester.tap(find.byType(EditableText));
@@ -614,7 +614,7 @@ void main() {
614614
],
615615
));
616616

617-
when(controls.canCopy(any)).thenReturn(true);
617+
when(controls.canCopy(typed(any))).thenReturn(true);
618618
await _buildApp(controls, tester);
619619
expect(semantics, includesNodeWith(
620620
value: 'test',
@@ -625,8 +625,8 @@ void main() {
625625
],
626626
));
627627

628-
when(controls.canCopy(any)).thenReturn(false);
629-
when(controls.canPaste(any)).thenReturn(true);
628+
when(controls.canCopy(typed(any))).thenReturn(false);
629+
when(controls.canPaste(typed(any))).thenReturn(true);
630630
await _buildApp(controls, tester);
631631
expect(semantics, includesNodeWith(
632632
value: 'test',
@@ -637,8 +637,8 @@ void main() {
637637
],
638638
));
639639

640-
when(controls.canPaste(any)).thenReturn(false);
641-
when(controls.canCut(any)).thenReturn(true);
640+
when(controls.canPaste(typed(any))).thenReturn(false);
641+
when(controls.canCut(typed(any))).thenReturn(true);
642642
await _buildApp(controls, tester);
643643
expect(semantics, includesNodeWith(
644644
value: 'test',
@@ -649,9 +649,9 @@ void main() {
649649
],
650650
));
651651

652-
when(controls.canCopy(any)).thenReturn(true);
653-
when(controls.canCut(any)).thenReturn(true);
654-
when(controls.canPaste(any)).thenReturn(true);
652+
when(controls.canCopy(typed(any))).thenReturn(true);
653+
when(controls.canCut(typed(any))).thenReturn(true);
654+
when(controls.canPaste(typed(any))).thenReturn(true);
655655
await _buildApp(controls, tester);
656656
expect(semantics, includesNodeWith(
657657
value: 'test',
@@ -670,9 +670,9 @@ void main() {
670670
testWidgets('can copy/cut/paste with a11y', (WidgetTester tester) async {
671671
final SemanticsTester semantics = new SemanticsTester(tester);
672672

673-
when(controls.canCopy(any)).thenReturn(true);
674-
when(controls.canCut(any)).thenReturn(true);
675-
when(controls.canPaste(any)).thenReturn(true);
673+
when(controls.canCopy(typed(any))).thenReturn(true);
674+
when(controls.canCut(typed(any))).thenReturn(true);
675+
when(controls.canPaste(typed(any))).thenReturn(true);
676676
await _buildApp(controls, tester);
677677
await tester.tap(find.byType(EditableText));
678678
await tester.pump();
@@ -703,13 +703,13 @@ void main() {
703703
), ignoreRect: true, ignoreTransform: true));
704704

705705
owner.performAction(expectedNodeId, SemanticsAction.copy);
706-
verify(controls.handleCopy(any)).called(1);
706+
verify(controls.handleCopy(typed(any))).called(1);
707707

708708
owner.performAction(expectedNodeId, SemanticsAction.cut);
709-
verify(controls.handleCut(any)).called(1);
709+
verify(controls.handleCut(typed(any))).called(1);
710710

711711
owner.performAction(expectedNodeId, SemanticsAction.paste);
712-
verify(controls.handlePaste(any)).called(1);
712+
verify(controls.handlePaste(typed(any))).called(1);
713713

714714
semantics.dispose();
715715
});

0 commit comments

Comments
 (0)