Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #4737: No meaningful label of the revision screen navigation cards during talkback. #5113

2 changes: 2 additions & 0 deletions app/src/main/res/layout-sw600dp/revision_card_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
android:paddingEnd="@dimen/topic_revision_summary_view_subtopic_title_text_view_padding_end"
android:paddingBottom="16dp"
android:text="@{viewModel.computeTitleText(viewModel.previousSubtopicLiveData)}"
android:contentDescription="@{viewModel.computeContentDescriptionText(viewModel.previousSubtopicLiveData)}"
android:textColor="@color/component_color_shared_secondary_4_text_color"
android:textSize="14sp"
android:textStyle="bold"
Expand Down Expand Up @@ -166,6 +167,7 @@
android:paddingEnd="@dimen/topic_revision_summary_view_subtopic_title_text_view_padding_end"
android:paddingBottom="16dp"
android:text="@{viewModel.computeTitleText(viewModel.nextSubtopicLiveData)}"
android:contentDescription="@{viewModel.computeContentDescriptionText(viewModel.nextSubtopicLiveData)}"
android:textColor="@color/component_color_shared_secondary_4_text_color"
android:textSize="14sp"
android:textStyle="bold"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.test.espresso.intent.Intents.intended
import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent
import androidx.test.espresso.intent.matcher.IntentMatchers.hasExtra
import androidx.test.espresso.matcher.RootMatchers.isDialog
import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.isRoot
import androidx.test.espresso.matcher.ViewMatchers.withId
Expand Down Expand Up @@ -183,6 +184,94 @@ class RevisionCardFragmentTest {
Intents.release()
}

@Test
fun testRevisionCard_previousSubtopicTitle_hasCorrectContentDescription() {
launch<RevisionCardActivity>(
createRevisionCardActivityIntent(
context,
profileId.internalId,
"test_topic_id_0",
subtopicId = 1,
FRACTIONS_SUBTOPIC_LIST_SIZE
)
).use {
testCoroutineDispatchers.runCurrent()
onView(withId(R.id.prev_subtopic_title)).check(
matches(
ViewMatchers.withContentDescription(
"The previous subtopic is "
)
)
)
}
}

@Test
fun testRevisionCard_nextSubtopicTitle_hasCorrectContentDescription() {
launch<RevisionCardActivity>(
createRevisionCardActivityIntent(
context,
profileId.internalId,
"test_topic_id_0",
subtopicId = 1,
FRACTIONS_SUBTOPIC_LIST_SIZE
)
).use {
testCoroutineDispatchers.runCurrent()
onView(withId(R.id.next_subtopic_title)).check(
matches(
ViewMatchers.withContentDescription(
"The next subtopic is "
adhiamboperes marked this conversation as resolved.
Show resolved Hide resolved
)
)
)
}
}

@Test
fun testRevisionCard_previousSubtopicTitle_whatIsAFraction_hasCorrectContentDescription() {
launch<RevisionCardActivity>(
createRevisionCardActivityIntent(
context,
profileId.internalId,
FRACTIONS_TOPIC_ID,
subtopicId = 2,
FRACTIONS_SUBTOPIC_LIST_SIZE
)
).use {
testCoroutineDispatchers.runCurrent()
onView(withId(R.id.prev_subtopic_title)).check(
matches(
ViewMatchers.withContentDescription(
"The previous subtopic is What is a Fraction?"
adhiamboperes marked this conversation as resolved.
Show resolved Hide resolved
)
)
)
}
}

@Test
fun testRevisionCard_nextSubtopicTitle_mixedNumbers_hasCorrectContentDescription() {
launch<RevisionCardActivity>(
createRevisionCardActivityIntent(
context,
profileId.internalId,
FRACTIONS_TOPIC_ID,
subtopicId = 2,
FRACTIONS_SUBTOPIC_LIST_SIZE
)
).use {
testCoroutineDispatchers.runCurrent()
onView(withId(R.id.next_subtopic_title)).check(
matches(
ViewMatchers.withContentDescription(
"The next subtopic is Mixed Numbers"
adhiamboperes marked this conversation as resolved.
Show resolved Hide resolved
)
)
)
}
}

@Test
fun testRevisionCardTest_initialise_openBottomSheet_showsBottomSheet() {
launch<ExplorationActivity>(
Expand Down
Loading