mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[macos] Move TextInputPlugin outside of visible area (flutter/engine#39031)
* [macos] Move TextInputPlugin outside of visible area * Make plugin empty and add test
This commit is contained in:
parent
d7963e6fa1
commit
d06ef7a5bf
@ -245,8 +245,9 @@ static char markerKey;
|
||||
}
|
||||
|
||||
- (instancetype)initWithViewController:(FlutterViewController*)viewController {
|
||||
// The view needs a non-zero frame.
|
||||
self = [super initWithFrame:NSMakeRect(0, 0, 1, 1)];
|
||||
// The view needs an empty frame otherwise it is visible on dark background.
|
||||
// https://github.com/flutter/flutter/issues/118504
|
||||
self = [super initWithFrame:NSZeroRect];
|
||||
if (self != nil) {
|
||||
_flutterViewController = viewController;
|
||||
_channel = [FlutterMethodChannel methodChannelWithName:kTextInputChannel
|
||||
|
||||
@ -1532,4 +1532,20 @@ TEST(FlutterTextInputPluginTest, IsAddedAndRemovedFromViewHierarchy) {
|
||||
ASSERT_FALSE(window.firstResponder == viewController.textInputPlugin);
|
||||
}
|
||||
|
||||
TEST(FlutterTextInputPluginTest, HasZeroSize) {
|
||||
id engineMock = OCMClassMock([FlutterEngine class]);
|
||||
id binaryMessengerMock = OCMProtocolMock(@protocol(FlutterBinaryMessenger));
|
||||
OCMStub( // NOLINT(google-objc-avoid-throwing-exception)
|
||||
[engineMock binaryMessenger])
|
||||
.andReturn(binaryMessengerMock);
|
||||
FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:engineMock
|
||||
nibName:@""
|
||||
bundle:nil];
|
||||
|
||||
FlutterTextInputPlugin* plugin =
|
||||
[[FlutterTextInputPlugin alloc] initWithViewController:viewController];
|
||||
|
||||
ASSERT_TRUE(NSIsEmptyRect(plugin.frame));
|
||||
}
|
||||
|
||||
} // namespace flutter::testing
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user