Add setIconContentDescription to EntityHeaderController
This lets us set a contentDescription on the icon in entity headers for accessibility. Bug: 62068874 Test: make RunSettingsRoboTests Change-Id: I1af7aad34aa65b616cf4edb8b144f315040a9fdd
This commit is contained in:
@@ -233,6 +233,33 @@ public class EntityHeaderControllerTest {
|
||||
.isEqualTo("App info");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void iconContentDescription_shouldWorkWithSetIcon() {
|
||||
final View view = mLayoutInflater
|
||||
.inflate(R.layout.settings_entity_header, null /* root */);
|
||||
when(mFragment.getActivity()).thenReturn(mock(Activity.class));
|
||||
mController = EntityHeaderController.newInstance(mActivity, mFragment, view);
|
||||
String description = "Fake Description";
|
||||
mController.setIcon(mShadowContext.getDrawable(R.drawable.ic_add));
|
||||
mController.setIconContentDescription(description);
|
||||
mController.done(mActivity);
|
||||
assertThat(view.findViewById(R.id.entity_header_icon).getContentDescription().toString())
|
||||
.isEqualTo(description);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void iconContentDescription_shouldWorkWithoutSetIcon() {
|
||||
final View view = mLayoutInflater
|
||||
.inflate(R.layout.settings_entity_header, null /* root */);
|
||||
when(mFragment.getActivity()).thenReturn(mock(Activity.class));
|
||||
mController = EntityHeaderController.newInstance(mActivity, mFragment, view);
|
||||
String description = "Fake Description";
|
||||
mController.setIconContentDescription(description);
|
||||
mController.done(mActivity);
|
||||
assertThat(view.findViewById(R.id.entity_header_icon).getContentDescription().toString())
|
||||
.isEqualTo(description);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindButton_hasAppNotifIntent_shouldShowButton() {
|
||||
final View appLinks = mLayoutInflater
|
||||
|
Reference in New Issue
Block a user