Add a content description to the app info button.

This resolves an issue where Talkback would call the
app info button "unlabelled."

Change-Id: I59d8639584c48d8eeb7640bdac3d18bc7667009f
Fixes: 35338852
Test: Settings Robotest
This commit is contained in:
Daniel Nishi
2017-02-28 11:04:05 -08:00
parent a24d7d4ccd
commit 93e08ebf80
2 changed files with 22 additions and 0 deletions

View File

@@ -52,6 +52,7 @@ import org.robolectric.shadows.ShadowApplication;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -233,6 +234,25 @@ public class AppHeaderControllerTest {
.isEqualTo(View.GONE);
}
@Test
public void bindButton_hasAppInfo_shouldHaveContentDescription() {
final View appLinks = mLayoutInflater
.inflate(R.layout.app_details, null /* root */);
when(mFragment.getActivity()).thenReturn(mock(Activity.class));
when(mContext.getString(eq(R.string.application_info_label))).thenReturn("App Info");
mController = new AppHeaderController(mContext, mFragment, appLinks);
mController.setPackageName("123")
.setUid(UserHandle.USER_SYSTEM)
.setButtonActions(
AppHeaderController.ActionType.ACTION_APP_INFO,
AppHeaderController.ActionType.ACTION_NOTIF_PREFERENCE);
mController.done();
assertThat(appLinks.findViewById(R.id.left_button).getContentDescription())
.isEqualTo("App Info");
}
@Test
public void bindButton_hasAppNotifIntent_shouldShowButton() {
final View appLinks = mLayoutInflater