Skip to content

Commit

Permalink
Fix broken Gradle tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
BenHenning committed Aug 15, 2024
1 parent 10a72b4 commit ea51fbc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def filesToExclude = [
'**/*AppLanguageLocaleHandlerTest*.kt',
'**/*AppLanguageResourceHandlerTest*.kt',
'**/*AppLanguageWatcherMixinTest*.kt',
'**/*ActivityLanguageLocaleHandlerTest*.kt'
'**/*ActivityLanguageLocaleHandlerTest*.kt',
'**/*OptionsFragmentTest*.kt', // Excludes 2 tests.
]
_excludeSourceFiles(filesToExclude)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ import org.oppia.android.domain.platformparameter.PlatformParameterModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.testing.BuildEnvironment
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.RunOn
import org.oppia.android.testing.TestLogReportingModule
import org.oppia.android.testing.firebase.TestAuthenticationModule
import org.oppia.android.testing.junit.InitializeDefaultLocaleRule
Expand Down Expand Up @@ -180,8 +182,10 @@ class ReadingTextSizeFragmentTest {
}
}

// Requires language configurations.
@Test
@Config(qualifiers = "sw600dp")
@RunOn(buildEnvironments = [BuildEnvironment.BAZEL])
fun testTextSize_changeTextSizeToMedium_mediumItemIsSelected() {
launch<OptionsActivity>(createOptionActivityIntent(0, true)).use {
testCoroutineDispatchers.runCurrent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import kotlinx.coroutines.async
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import org.junit.After
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.oppia.android.app.model.AudioLanguage.ARABIC_LANGUAGE
Expand All @@ -34,7 +35,10 @@ import org.oppia.android.domain.oppialogger.ApplicationIdSeed
import org.oppia.android.domain.oppialogger.LogStorageModule
import org.oppia.android.domain.oppialogger.LoggingIdentifierController
import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule
import org.oppia.android.testing.BuildEnvironment
import org.oppia.android.testing.FakeAnalyticsEventLogger
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.RunOn
import org.oppia.android.testing.TestLogReportingModule
import org.oppia.android.testing.data.DataProviderTestMonitor
import org.oppia.android.testing.logging.EventLogSubject.Companion.assertThat
Expand Down Expand Up @@ -77,6 +81,7 @@ import javax.inject.Singleton
@LooperMode(LooperMode.Mode.PAUSED)
@Config(application = ProfileManagementControllerTest.TestApplication::class)
class ProfileManagementControllerTest {
@get:Rule val oppiaTestRule = OppiaTestRule()
@Inject lateinit var context: Context
@Inject lateinit var profileTestHelper: ProfileTestHelper
@Inject lateinit var profileManagementController: ProfileManagementController
Expand Down Expand Up @@ -716,7 +721,9 @@ class ProfileManagementControllerTest {
assertThat(profile.readingTextSize).isEqualTo(MEDIUM_TEXT_SIZE)
}

// Requires language configurations.
@Test
@RunOn(buildEnvironments = [BuildEnvironment.BAZEL])
fun testGetAudioLanguage_initialProfileCreation_defaultsToEnglish() {
setUpTestApplicationComponent()

Expand Down Expand Up @@ -779,7 +786,9 @@ class ProfileManagementControllerTest {
monitor.ensureNextResultIsSuccess()
}

// Requires language configurations.
@Test
@RunOn(buildEnvironments = [BuildEnvironment.BAZEL])
fun testUpdateAudioLanguage_updateToHindi_updateChangesAudioLanguage() {
setUpTestApplicationComponent()
addTestProfiles()
Expand All @@ -793,7 +802,9 @@ class ProfileManagementControllerTest {
assertThat(audioLanguage).isEqualTo(HINDI_AUDIO_LANGUAGE)
}

// Requires language configurations.
@Test
@RunOn(buildEnvironments = [BuildEnvironment.BAZEL])
fun testUpdateAudioLanguage_updateToBrazilianPortuguese_updateChangesAudioLanguage() {
setUpTestApplicationComponent()
addTestProfiles()
Expand All @@ -807,7 +818,9 @@ class ProfileManagementControllerTest {
assertThat(audioLanguage).isEqualTo(BRAZILIAN_PORTUGUESE_LANGUAGE)
}

// Requires language configurations.
@Test
@RunOn(buildEnvironments = [BuildEnvironment.BAZEL])
fun testUpdateAudioLanguage_updateToArabic_updateChangesAudioLanguage() {
setUpTestApplicationComponent()
addTestProfiles()
Expand All @@ -821,7 +834,9 @@ class ProfileManagementControllerTest {
assertThat(audioLanguage).isEqualTo(ARABIC_LANGUAGE)
}

// Requires language configurations.
@Test
@RunOn(buildEnvironments = [BuildEnvironment.BAZEL])
fun testUpdateAudioLanguage_updateToNigerianPidgin_updateChangesAudioLanguage() {
setUpTestApplicationComponent()
addTestProfiles()
Expand All @@ -835,7 +850,9 @@ class ProfileManagementControllerTest {
assertThat(audioLanguage).isEqualTo(NIGERIAN_PIDGIN_LANGUAGE)
}

// Requires language configurations.
@Test
@RunOn(buildEnvironments = [BuildEnvironment.BAZEL])
fun testUpdateAudioLanguage_updateToArabicThenEnglish_updateChangesAudioLanguageToEnglish() {
setUpTestApplicationComponent()
addTestProfiles()
Expand All @@ -852,7 +869,9 @@ class ProfileManagementControllerTest {
assertThat(audioLanguage).isEqualTo(ENGLISH_AUDIO_LANGUAGE)
}

// Requires language configurations.
@Test
@RunOn(buildEnvironments = [BuildEnvironment.BAZEL])
fun testUpdateAudioLanguage_updateProfile1ToArabic_profile2IsUnchanged() {
setUpTestApplicationComponent()
addTestProfiles()
Expand Down

0 comments on commit ea51fbc

Please sign in to comment.