Loading tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java +5 −7 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.settings.bluetooth; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.doReturn; Loading @@ -29,15 +30,17 @@ import android.content.DialogInterface; import android.widget.Button; import android.widget.EditText; import androidx.appcompat.app.AlertDialog; import com.android.settings.R; import com.android.settings.testutils.FakeFeatureFactory; import com.android.settings.testutils.SettingsRobolectricTestRunner; import com.android.settings.testutils.shadow.SettingsShadowResourcesImpl; import com.android.settings.testutils.shadow.ShadowDynamicLayout; import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.settingslib.testutils.FragmentTestUtils; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Answers; Loading @@ -46,10 +49,8 @@ import org.mockito.MockitoAnnotations; import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowDialog; import androidx.appcompat.app.AlertDialog; @RunWith(SettingsRobolectricTestRunner.class) @Config(shadows = SettingsShadowResourcesImpl.class) @Config(shadows = {SettingsShadowResourcesImpl.class, ShadowDynamicLayout.class}) public class RemoteDeviceNameDialogFragmentTest { @Mock(answer = Answers.RETURNS_DEEP_STUBS) Loading Loading @@ -81,7 +82,6 @@ public class RemoteDeviceNameDialogFragmentTest { } @Test @Ignore public void deviceNameDisplayIsCorrect() { String deviceName = "ABC Corp Headphones"; AlertDialog dialog = startDialog(deviceName); Loading @@ -97,7 +97,6 @@ public class RemoteDeviceNameDialogFragmentTest { } @Test @Ignore public void deviceNameEditSucceeds() { String deviceNameInitial = "ABC Corp Headphones"; String deviceNameModified = "My Headphones"; Loading @@ -120,7 +119,6 @@ public class RemoteDeviceNameDialogFragmentTest { } @Test @Ignore public void deviceNameEditThenCancelDoesntRename() { String deviceNameInitial = "ABC Corp Headphones"; String deviceNameModified = "My Headphones"; Loading tests/robotests/src/com/android/settings/testutils/shadow/ShadowDynamicLayout.java 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.testutils.shadow; import android.text.DynamicLayout; import android.text.Layout.Directions; import org.robolectric.annotation.Implementation; import org.robolectric.annotation.Implements; @Implements(DynamicLayout.class) public class ShadowDynamicLayout { @Implementation public int getLineTop(int line) { return 0; } @Implementation public int getLineStart(int line) { return 0; } @Implementation public final Directions getLineDirections(int line) { return new Directions(new int[]{0, 1}); } } No newline at end of file Loading
tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java +5 −7 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.settings.bluetooth; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.doReturn; Loading @@ -29,15 +30,17 @@ import android.content.DialogInterface; import android.widget.Button; import android.widget.EditText; import androidx.appcompat.app.AlertDialog; import com.android.settings.R; import com.android.settings.testutils.FakeFeatureFactory; import com.android.settings.testutils.SettingsRobolectricTestRunner; import com.android.settings.testutils.shadow.SettingsShadowResourcesImpl; import com.android.settings.testutils.shadow.ShadowDynamicLayout; import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.settingslib.testutils.FragmentTestUtils; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Answers; Loading @@ -46,10 +49,8 @@ import org.mockito.MockitoAnnotations; import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowDialog; import androidx.appcompat.app.AlertDialog; @RunWith(SettingsRobolectricTestRunner.class) @Config(shadows = SettingsShadowResourcesImpl.class) @Config(shadows = {SettingsShadowResourcesImpl.class, ShadowDynamicLayout.class}) public class RemoteDeviceNameDialogFragmentTest { @Mock(answer = Answers.RETURNS_DEEP_STUBS) Loading Loading @@ -81,7 +82,6 @@ public class RemoteDeviceNameDialogFragmentTest { } @Test @Ignore public void deviceNameDisplayIsCorrect() { String deviceName = "ABC Corp Headphones"; AlertDialog dialog = startDialog(deviceName); Loading @@ -97,7 +97,6 @@ public class RemoteDeviceNameDialogFragmentTest { } @Test @Ignore public void deviceNameEditSucceeds() { String deviceNameInitial = "ABC Corp Headphones"; String deviceNameModified = "My Headphones"; Loading @@ -120,7 +119,6 @@ public class RemoteDeviceNameDialogFragmentTest { } @Test @Ignore public void deviceNameEditThenCancelDoesntRename() { String deviceNameInitial = "ABC Corp Headphones"; String deviceNameModified = "My Headphones"; Loading
tests/robotests/src/com/android/settings/testutils/shadow/ShadowDynamicLayout.java 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.testutils.shadow; import android.text.DynamicLayout; import android.text.Layout.Directions; import org.robolectric.annotation.Implementation; import org.robolectric.annotation.Implements; @Implements(DynamicLayout.class) public class ShadowDynamicLayout { @Implementation public int getLineTop(int line) { return 0; } @Implementation public int getLineStart(int line) { return 0; } @Implementation public final Directions getLineDirections(int line) { return new Directions(new int[]{0, 1}); } } No newline at end of file