Merge "Fix a11y for controls header" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2639c3b316
@@ -608,6 +608,7 @@ class ControlsUiControllerImpl @Inject constructor (
|
|||||||
if (items.size == 1) {
|
if (items.size == 1) {
|
||||||
spinner.setBackground(null)
|
spinner.setBackground(null)
|
||||||
anchor.setOnClickListener(null)
|
anchor.setOnClickListener(null)
|
||||||
|
anchor.isClickable = false
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
spinner.background = parent.context.resources
|
spinner.background = parent.context.resources
|
||||||
|
|||||||
@@ -200,6 +200,56 @@ class ControlsUiControllerImplTest : SysuiTestCase() {
|
|||||||
verify(taskViewFactory).create(eq(context), eq(uiExecutor), any())
|
verify(taskViewFactory).create(eq(context), eq(uiExecutor), any())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testSingleAppHeaderIsNotClickable() {
|
||||||
|
mockLayoutInflater()
|
||||||
|
val packageName = "pkg"
|
||||||
|
`when`(authorizedPanelsRepository.getAuthorizedPanels()).thenReturn(setOf(packageName))
|
||||||
|
val panel = SelectedItem.PanelItem("App name", ComponentName(packageName, "cls"))
|
||||||
|
val serviceInfo = setUpPanel(panel)
|
||||||
|
|
||||||
|
underTest.show(parent, {}, context)
|
||||||
|
|
||||||
|
val captor = argumentCaptor<ControlsListingController.ControlsListingCallback>()
|
||||||
|
|
||||||
|
verify(controlsListingController).addCallback(capture(captor))
|
||||||
|
|
||||||
|
captor.value.onServicesUpdated(listOf(serviceInfo))
|
||||||
|
FakeExecutor.exhaustExecutors(uiExecutor, bgExecutor)
|
||||||
|
|
||||||
|
val header: View = parent.requireViewById(R.id.controls_header)
|
||||||
|
assertThat(header.isClickable).isFalse()
|
||||||
|
assertThat(header.hasOnClickListeners()).isFalse()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testMultipleAppHeaderIsClickable() {
|
||||||
|
mockLayoutInflater()
|
||||||
|
val packageName1 = "pkg"
|
||||||
|
val panel1 = SelectedItem.PanelItem("App name 1", ComponentName(packageName1, "cls"))
|
||||||
|
val serviceInfo1 = setUpPanel(panel1)
|
||||||
|
|
||||||
|
val packageName2 = "pkg"
|
||||||
|
val panel2 = SelectedItem.PanelItem("App name 2", ComponentName(packageName2, "cls"))
|
||||||
|
val serviceInfo2 = setUpPanel(panel2)
|
||||||
|
|
||||||
|
`when`(authorizedPanelsRepository.getAuthorizedPanels())
|
||||||
|
.thenReturn(setOf(packageName1, packageName2))
|
||||||
|
|
||||||
|
underTest.show(parent, {}, context)
|
||||||
|
|
||||||
|
val captor = argumentCaptor<ControlsListingController.ControlsListingCallback>()
|
||||||
|
|
||||||
|
verify(controlsListingController).addCallback(capture(captor))
|
||||||
|
|
||||||
|
captor.value.onServicesUpdated(listOf(serviceInfo1, serviceInfo2))
|
||||||
|
FakeExecutor.exhaustExecutors(uiExecutor, bgExecutor)
|
||||||
|
|
||||||
|
val header: View = parent.requireViewById(R.id.controls_header)
|
||||||
|
assertThat(header.isClickable).isTrue()
|
||||||
|
assertThat(header.hasOnClickListeners()).isTrue()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testPanelControllerStartActivityWithCorrectArguments() {
|
fun testPanelControllerStartActivityWithCorrectArguments() {
|
||||||
mockLayoutInflater()
|
mockLayoutInflater()
|
||||||
|
|||||||
Reference in New Issue
Block a user