Skip to content

Commit

Permalink
Fix #2614: Profile Chooser First Time A11y Fixes (#2742)
Browse files Browse the repository at this point in the history
* Profile Chooser First Time A11y fixes

* Rename test

* Nit fix

* Renamed string

Co-authored-by: Rajat Talesra <[email protected]>
  • Loading branch information
rt4914 and Rajat Talesra authored Feb 19, 2021
1 parent 2de692a commit 6107ecd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".app.profile.ProfileChooserActivity"
android:label="@string/profile_chooser_activity_label"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.profileprogress.ProfilePictureActivity"
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 @@ -186,6 +186,7 @@
</plurals>
<string name="bar_separator">\u0020|\u0020</string>
<!-- ProfileChooserFragment -->
<string name="profile_chooser_activity_label">Profile selection page</string>
<string name="profile_chooser_admin">Administrator</string>
<string name="profile_chooser_select">Select your profile</string>
<string name="profile_chooser_add">Add Profile</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.test.espresso.matcher.ViewMatchers.isRoot
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.rule.ActivityTestRule
import com.google.common.truth.Truth.assertThat
import dagger.Component
import org.hamcrest.Matchers.not
Expand Down Expand Up @@ -88,6 +89,10 @@ import javax.inject.Singleton
)
class ProfileChooserFragmentTest {

private val activityTestRule: ActivityTestRule<ProfileChooserActivity> = ActivityTestRule(
ProfileChooserActivity::class.java, /* initialTouchMode= */ true, /* launchActivity= */ false
)

@Inject
lateinit var profileTestHelper: ProfileTestHelper

Expand Down Expand Up @@ -117,6 +122,15 @@ class ProfileChooserFragmentTest {
ApplicationProvider.getApplicationContext<TestApplication>().inject(this)
}

@Test
fun testProfileChooserActivity_hasCorrectLabel() {
activityTestRule.launchActivity(/* startIntent= */ null)
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.profile_chooser_activity_label))
}

@Test
fun testProfileChooserFragment_initializeProfiles_checkProfilesAreShown() {
profileTestHelper.initializeProfiles()
Expand Down

0 comments on commit 6107ecd

Please sign in to comment.