Accept new bluetooth device name on enter press.
When physical keyboard is connected, on enter press accept the new name and dismiss the dialog. Bug: 319621722 Test: atest BluetoothNameDialogFragmentTest Flag: NA Change-Id: Ibc4812ad559d65eb97156d83d2a6124893ffd3a6
This commit is contained in:
@@ -33,6 +33,8 @@ public class BluetoothNameDialogFragmentTest {
|
||||
private TestBluetoothNameDialogFragment mBluetoothNameDialogFragment;
|
||||
private TextView mTextView;
|
||||
|
||||
private static final String NAME_FOR_TEST = "test_device_name";
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
@@ -51,12 +53,24 @@ public class BluetoothNameDialogFragmentTest {
|
||||
null)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onEditorAction_ImeNull_setsDeviceName() {
|
||||
|
||||
|
||||
mTextView.setText(NAME_FOR_TEST);
|
||||
assertThat(
|
||||
mBluetoothNameDialogFragment.onEditorAction(mTextView, EditorInfo.IME_NULL,
|
||||
null)).isTrue();
|
||||
assertThat(mBluetoothNameDialogFragment.getDeviceName()).isEqualTo(NAME_FOR_TEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test fragment for {@link BluetoothNameDialogFragment} to test common methods
|
||||
*/
|
||||
public static class TestBluetoothNameDialogFragment extends BluetoothNameDialogFragment {
|
||||
|
||||
private String mName;
|
||||
|
||||
@Override
|
||||
protected int getDialogTitle() {
|
||||
return 0;
|
||||
@@ -64,12 +78,12 @@ public class BluetoothNameDialogFragmentTest {
|
||||
|
||||
@Override
|
||||
protected String getDeviceName() {
|
||||
return null;
|
||||
return mName;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setDeviceName(String deviceName) {
|
||||
|
||||
mName = deviceName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user