@@ -758,7 +758,7 @@ void main() {
758
758
expect (cursorOffsetSpaces.dx, inputWidth - _kCaretGap);
759
759
});
760
760
761
- testWidgets ('obscureText control test' , (WidgetTester tester) async {
761
+ testWidgets ('mobile obscureText control test' , (WidgetTester tester) async {
762
762
await tester.pumpWidget (
763
763
overlay (
764
764
child: const TextField (
@@ -796,7 +796,46 @@ void main() {
796
796
797
797
editText = findRenderEditable (tester).text.text;
798
798
expect (editText.substring (editText.length - 1 ), '\u 2022' );
799
- });
799
+ }, variant: const TargetPlatformVariant (< TargetPlatform > { TargetPlatform .iOS, TargetPlatform .android }));
800
+
801
+ testWidgets ('desktop obscureText control test' , (WidgetTester tester) async {
802
+ await tester.pumpWidget (
803
+ overlay (
804
+ child: const TextField (
805
+ obscureText: true ,
806
+ decoration: InputDecoration (
807
+ hintText: 'Placeholder' ,
808
+ ),
809
+ ),
810
+ ),
811
+ );
812
+ await tester.showKeyboard (find.byType (TextField ));
813
+
814
+ const String testValue = 'ABC' ;
815
+ tester.testTextInput.updateEditingValue (const TextEditingValue (
816
+ text: testValue,
817
+ selection: TextSelection .collapsed (offset: testValue.length),
818
+ ));
819
+
820
+ await tester.pump ();
821
+
822
+ // Enter a character into the obscured field and verify that the character
823
+ // isn't shown to the user.
824
+ const String newChar = 'X' ;
825
+ tester.testTextInput.updateEditingValue (const TextEditingValue (
826
+ text: testValue + newChar,
827
+ selection: TextSelection .collapsed (offset: testValue.length + 1 ),
828
+ ));
829
+
830
+ await tester.pump ();
831
+
832
+ final String editText = findRenderEditable (tester).text.text;
833
+ expect (editText.substring (editText.length - 1 ), '\u 2022' );
834
+ }, variant: const TargetPlatformVariant (< TargetPlatform > {
835
+ TargetPlatform .macOS,
836
+ TargetPlatform .linux,
837
+ TargetPlatform .windows,
838
+ }));
800
839
801
840
testWidgets ('Caret position is updated on tap' , (WidgetTester tester) async {
802
841
final TextEditingController controller = TextEditingController ();
0 commit comments