forked from firka/flutter
[EditableText] honor the "brieflyShowPassword" system setting (#97769)
This commit is contained in:
@@ -271,6 +271,15 @@ class TestWindow implements ui.SingletonFlutterWindow {
|
||||
platformDispatcher.onTextScaleFactorChanged = callback;
|
||||
}
|
||||
|
||||
@override
|
||||
bool get brieflyShowPassword => _brieflyShowPasswordTestValue ?? platformDispatcher.brieflyShowPassword;
|
||||
bool? _brieflyShowPasswordTestValue;
|
||||
/// Hides the real [brieflyShowPassword] and reports the given
|
||||
/// `brieflyShowPasswordTestValue` instead.
|
||||
set brieflyShowPasswordTestValue(bool brieflyShowPasswordTestValue) { // ignore: avoid_setters_without_getters
|
||||
_brieflyShowPasswordTestValue = brieflyShowPasswordTestValue;
|
||||
}
|
||||
|
||||
@override
|
||||
ui.FrameCallback? get onBeginFrame => platformDispatcher.onBeginFrame;
|
||||
@override
|
||||
|
||||
@@ -127,6 +127,18 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('TestWindow can fake brieflyShowPassword', (WidgetTester tester) async {
|
||||
verifyThatTestWindowCanFakeProperty<bool>(
|
||||
tester: tester,
|
||||
realValue: ui.window.brieflyShowPassword,
|
||||
fakeValue: !ui.window.brieflyShowPassword,
|
||||
propertyRetriever: () => WidgetsBinding.instance!.window.brieflyShowPassword,
|
||||
propertyFaker: (TestWidgetsFlutterBinding binding, bool fakeValue) {
|
||||
binding.window.brieflyShowPasswordTestValue = fakeValue;
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('TestWindow can fake default route name', (WidgetTester tester) async {
|
||||
verifyThatTestWindowCanFakeProperty<String>(
|
||||
tester: tester,
|
||||
|
||||
Reference in New Issue
Block a user