mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-15 02:18:04 -04:00
Fixed HelpFragmentTest and PlayStoreRestrictionTest on api level 24
This commit is contained in:
parent
90dc8ec292
commit
b572d02e6c
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.kiwix.kiwixmobile.help
|
package org.kiwix.kiwixmobile.help
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
@ -83,6 +84,7 @@ class HelpFragmentTest : BaseActivityTest() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun verifyHelpActivityWithPlayStoreRestriction() {
|
fun verifyHelpActivityWithPlayStoreRestriction() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
setShowPlayStoreRestriction(true)
|
setShowPlayStoreRestriction(true)
|
||||||
activityScenario.onActivity {
|
activityScenario.onActivity {
|
||||||
it.navigate(R.id.helpFragment)
|
it.navigate(R.id.helpFragment)
|
||||||
@ -104,6 +106,7 @@ class HelpFragmentTest : BaseActivityTest() {
|
|||||||
}
|
}
|
||||||
LeakAssertions.assertNoLeaks()
|
LeakAssertions.assertNoLeaks()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setShowPlayStoreRestriction(showRestriction: Boolean) {
|
private fun setShowPlayStoreRestriction(showRestriction: Boolean) {
|
||||||
context.let {
|
context.let {
|
||||||
|
@ -78,6 +78,7 @@ class PlayStoreRestrictionDialogTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun showPlayStoreRestrictionDialog() {
|
fun showPlayStoreRestrictionDialog() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
setShowPlayStoreRestrictionDialog(true)
|
setShowPlayStoreRestrictionDialog(true)
|
||||||
activityScenario = ActivityScenario.launch(KiwixMainActivity::class.java).apply {
|
activityScenario = ActivityScenario.launch(KiwixMainActivity::class.java).apply {
|
||||||
moveToState(Lifecycle.State.RESUMED)
|
moveToState(Lifecycle.State.RESUMED)
|
||||||
@ -89,9 +90,11 @@ class PlayStoreRestrictionDialogTest {
|
|||||||
}
|
}
|
||||||
LeakAssertions.assertNoLeaks()
|
LeakAssertions.assertNoLeaks()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testPlayStoreDialogShowOnlyOnce() {
|
fun testPlayStoreDialogShowOnlyOnce() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
setShowPlayStoreRestrictionDialog(false)
|
setShowPlayStoreRestrictionDialog(false)
|
||||||
activityScenario = ActivityScenario.launch(KiwixMainActivity::class.java).apply {
|
activityScenario = ActivityScenario.launch(KiwixMainActivity::class.java).apply {
|
||||||
moveToState(Lifecycle.State.RESUMED)
|
moveToState(Lifecycle.State.RESUMED)
|
||||||
@ -102,6 +105,7 @@ class PlayStoreRestrictionDialogTest {
|
|||||||
}
|
}
|
||||||
LeakAssertions.assertNoLeaks()
|
LeakAssertions.assertNoLeaks()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setShowPlayStoreRestrictionDialog(showDialog: Boolean) {
|
private fun setShowPlayStoreRestrictionDialog(showDialog: Boolean) {
|
||||||
context?.let {
|
context?.let {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user