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 #2822 : Add label AppVersionActivity #2905

Merged
merged 13 commits into from
Mar 30, 2021
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.administratorcontrols.appversion.AppVersionActivity"
android:label="@string/app_version_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.completedstorylist.CompletedStoryListActivity"
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 @@ -332,6 +332,7 @@
<!-- AppVersionFragment -->
<string name="app_version_name">App Version %s</string>
<string name="app_last_update_date">The last update was installed on %s. Use the above version number to send feedback about bugs.</string>
<string name="app_version_activity_title">App Version</string>
<!-- OptionsActivity -->
<string name="title_reading_text_size">Reading Text Size</string>
<string name="title_app_language">App Language</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ 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 dagger.Component
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.oppia.android.R
Expand Down Expand Up @@ -75,6 +77,8 @@ import org.robolectric.annotation.LooperMode
import java.util.Locale
import javax.inject.Inject
import javax.inject.Singleton
import com.google.common.truth.Truth.assertThat
import org.oppia.android.app.administratorcontrols.appversion.AppVersionActivity.Companion.createAppVersionActivityIntent

/** Tests for [AppVersionActivity]. */
@RunWith(AndroidJUnit4::class)
Expand All @@ -84,6 +88,10 @@ import javax.inject.Singleton
qualifiers = "port-xxhdpi"
)
class AppVersionActivityTest {
@get:Rule
val activityTestRule: ActivityTestRule<AppVersionActivity> = ActivityTestRule(
AppVersionActivity::class.java, /* initialTouchMode= */ true, /* launchActivity= */ false
)

@Inject
lateinit var context: Context
Expand All @@ -103,6 +111,20 @@ class AppVersionActivityTest {
val lastUpdateDateTime = context.getLastUpdateTime()
lastUpdateDate = getDateTime(lastUpdateDateTime)!!
}
@Test
fun testAppVersionActivity_hasCorrectActivityLabel() {
activityTestRule.launchActivity(createAppVersionActivityIntent())
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.app_version_activity_title))
}

private fun createAppVersionActivityIntent(): Intent {
return AppVersionActivity.createAppVersionActivityIntent(
ApplicationProvider.getApplicationContext())
rt4914 marked this conversation as resolved.
Show resolved Hide resolved
}

@After
fun tearDown() {
Expand Down