[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: add support for TextInputType.none #26585

Merged
merged 8 commits into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Test that TextInputType.NONE is actually honored
  • Loading branch information
jpnurmi committed Jun 22, 2021
commit 5df062aea9057ecae06f596bbb76b0997c592e2d
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ private boolean canShowTextInput() {
return configuration.inputType.type != TextInputChannel.TextInputType.NONE;
}

private void showTextInput(View view) {
@VisibleForTesting
void showTextInput(View view) {
if (canShowTextInput()) {
view.requestFocus();
mImm.showSoftInput(view, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,33 @@ public void inputConnection_textInputTypeNone() {
assertEquals(connection, null);
}

@Test
public void showTextInput_textInputTypeNone() {
TestImm testImm =
Shadow.extract(
RuntimeEnvironment.application.getSystemService(Context.INPUT_METHOD_SERVICE));
View testView = new View(RuntimeEnvironment.application);
DartExecutor dartExecutor = mock(DartExecutor.class);
TextInputChannel textInputChannel = new TextInputChannel(dartExecutor);
TextInputPlugin textInputPlugin =
new TextInputPlugin(testView, textInputChannel, mock(PlatformViewsController.class));
textInputPlugin.setTextInputClient(
0,
new TextInputChannel.Configuration(
false,
false,
true,
TextInputChannel.TextCapitalization.NONE,
new TextInputChannel.InputType(TextInputChannel.TextInputType.NONE, false, false),
null,
null,
null,
null));

textInputPlugin.showTextInput(testView);
assertEquals(testImm.isSoftInputVisible(), false);
}

// -------- Start: Autofill Tests -------
@Test
public void autofill_onProvideVirtualViewStructure() {
Expand Down