[iOSTextInput] remove floating cursor asserts (flutter/engine#28868)

This commit is contained in:
LongCatIsLooong
2021-09-27 11:08:16 -07:00
committed by GitHub
parent 8afe6ab3cc
commit 047a8acf2d
2 changed files with 11 additions and 5 deletions

View File

@@ -1368,7 +1368,6 @@ static FlutterAutofillType autofillTypeOf(NSDictionary* configuration) {
// It seems impossible to use a negative "width" or "height", as the "convertRect"
// call always turns a CGRect's negative dimensions into non-negative values, e.g.,
// (1, 2, -3, -4) would become (-2, -2, 3, 4).
NSAssert(!_isFloatingCursorActive, @"Another floating cursor is currently active.");
_isFloatingCursorActive = true;
[self.textInputDelegate updateFloatingCursor:FlutterFloatingCursorDragStateStart
withClient:_textInputClient
@@ -1376,16 +1375,13 @@ static FlutterAutofillType autofillTypeOf(NSDictionary* configuration) {
}
- (void)updateFloatingCursorAtPoint:(CGPoint)point {
NSAssert(_isFloatingCursorActive,
@"updateFloatingCursorAtPoint is called without an active floating cursor.");
_isFloatingCursorActive = true;
[self.textInputDelegate updateFloatingCursor:FlutterFloatingCursorDragStateUpdate
withClient:_textInputClient
withPosition:@{@"X" : @(point.x), @"Y" : @(point.y)}];
}
- (void)endFloatingCursor {
NSAssert(_isFloatingCursorActive,
@"endFloatingCursor is called without an active floating cursor.");
_isFloatingCursorActive = false;
[self.textInputDelegate updateFloatingCursor:FlutterFloatingCursorDragStateEnd
withClient:_textInputClient

View File

@@ -825,6 +825,16 @@ FLUTTER_ASSERT_ARC
}
}
- (void)testFloatingCursorDoesNotThrow {
// The keyboard implementation may send unbalanced calls to the input view.
FlutterTextInputView* inputView = [[FlutterTextInputView alloc] init];
[inputView beginFloatingCursorAtPoint:CGPointMake(123, 321)];
[inputView beginFloatingCursorAtPoint:CGPointMake(123, 321)];
[inputView endFloatingCursor];
[inputView beginFloatingCursorAtPoint:CGPointMake(123, 321)];
[inputView endFloatingCursor];
}
- (void)testBoundsForFloatingCursor {
FlutterTextInputView* inputView = [[FlutterTextInputView alloc] init];