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

Fix part of #2637: Added accessibilty label to the RevisionCardActivity #3009

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.topic.revisioncard.RevisionCardActivity"
android:theme="@style/OppiaThemeWithoutActionBar" />
android:theme="@style/OppiaThemeWithoutActionBar"
android:label="@string/revision_card_activity_title" />
<activity
android:name=".app.topic.TopicActivity"
android:theme="@style/OppiaThemeWithoutActionBar"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -435,4 +435,5 @@
<string name="coming_soon">Coming Soon</string>
<string name="recommended_stories">Recommended Stories</string>
<string name="stories_for_you">Stories For You</string>
<string name="revision_card_activity_title">Skill page</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package org.oppia.android.app.topic.revisioncard

import android.content.Context
import android.content.Intent
import androidx.test.core.app.ApplicationProvider
import androidx.test.rule.ActivityTestRule
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
import org.oppia.android.R
import org.oppia.android.domain.topic.TEST_TOPIC_ID_0
import javax.inject.Inject

class RevisionCardActivityTest {

@Inject
lateinit var context: Context

private val internalProfileId = 0

private val subTopicId = 0

private fun createRevisionCardActivityIntent(
internalProfileId: Int,
topicId: String,
subTopicId: Int
): Intent {
return RevisionCardActivity.createRevisionCardActivityIntent(
ApplicationProvider.getApplicationContext(),
internalProfileId,
topicId,
subTopicId
)
}

@get:Rule
val activityTestRule: ActivityTestRule<RevisionCardActivity> = ActivityTestRule(
RevisionCardActivity::class.java,
/* initialTouchMode= */ true,
/* launchActivity= */ false
)

@Test
fun testRevisionCardActivity_hasCorrectLabel() {
activityTestRule.launchActivity(
createRevisionCardActivityIntent(
internalProfileId = internalProfileId,
topicId = TEST_TOPIC_ID_0,
subTopicId = subTopicId
)
)
val title = activityTestRule.activity.title

// Verify that the activity label is correct as a proxy to verify TalkBack will announce the
// correct string when it's read out.
assertThat(title).isEqualTo(context.getString(R.string.revision_card_activity_title))
}
}