Fix a typo so that the secure input view is properly initialized (flutter/engine#17816)

This commit is contained in:
LongCatIsLooong
2020-04-20 11:39:55 -07:00
committed by GitHub
parent 5439fdc086
commit c399be3ab7
2 changed files with 37 additions and 1 deletions

View File

@@ -819,7 +819,7 @@ static NSString* uniqueIdFromDictionary(NSDictionary* dictionary) {
if (self) {
_nonAutofillInputView = [[FlutterTextInputView alloc] init];
_nonAutofillInputView.secureTextEntry = NO;
_nonAutofillInputView = [[FlutterTextInputView alloc] init];
_nonAutofillSecureInputView = [[FlutterTextInputView alloc] init];
_nonAutofillSecureInputView.secureTextEntry = YES;
_inputViews = [[NSMutableArray alloc] init];

View File

@@ -14,7 +14,43 @@ FLUTTER_ASSERT_ARC
@end
@implementation FlutterTextInputPluginTest
- (void)testSecureInput {
// Setup test.
id engine = OCMClassMock([FlutterEngine class]);
FlutterTextInputPlugin* textInputPlugin = [[FlutterTextInputPlugin alloc] init];
textInputPlugin.textInputDelegate = engine;
NSDictionary* config = @{
@"inputType" : @{@"name" : @"TextInuptType.text"},
@"keyboardAppearance" : @"Brightness.light",
@"obscureText" : @YES,
@"inputAction" : @"TextInputAction.unspecified",
@"smartDashesType" : @"0",
@"smartQuotesType" : @"0",
@"autocorrect" : @YES
};
FlutterMethodCall* setClientCall =
[FlutterMethodCall methodCallWithMethodName:@"TextInput.setClient"
arguments:@[ @123, config ]];
[textInputPlugin handleMethodCall:setClientCall
result:^(id _Nullable result){
}];
// Find all input views in the input hider view.
NSArray<FlutterTextInputView*>* inputFields =
[[[textInputPlugin textInputView] superview] subviews];
// Find the inactive autofillable input field.
FlutterTextInputView* inputView = inputFields[0];
// Verify secureTextEntry is set to the correct value.
XCTAssertTrue(inputView.secureTextEntry);
// Clean up mocks
[engine stopMocking];
}
- (void)testAutofillInputViews {
// Setup test.
id engine = OCMClassMock([FlutterEngine class]);