test: Add basic test for compose about screen

This commit is contained in:
LooKeR
2025-11-19 20:59:12 +05:30
committed by Sylvia van Os
parent 7a44108cf6
commit 94beaef74b

View File

@@ -0,0 +1,43 @@
package protect.card_locker
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.assertIsNotDisplayed
import androidx.compose.ui.test.junit4.ComposeContentTestRule
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import org.junit.Rule
import org.junit.Test
class ComposeAboutActivityTest {
@get:Rule
val rule: ComposeContentTestRule = createComposeRule()
@Test
fun testPasses(): Unit = with(rule) {
setContent {
AboutScreenContent(
content = AboutContent(LocalContext.current),
showDonate = true,
showRateOnGooglePlay = false,
onBackPressedDispatcher = null
)
}
onNodeWithTag("topbar_catima").assertIsDisplayed()
}
@Test
fun testFails(): Unit = with(rule) {
setContent {
AboutScreenContent(
content = AboutContent(LocalContext.current),
showDonate = true,
showRateOnGooglePlay = false,
onBackPressedDispatcher = null
)
}
onNodeWithTag("topbar_catima").assertIsNotDisplayed()
}
}