mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 17:37:05 +05:30
paparazzi-tests: switch MonthHeaderTest to TestParameterInjector
This commit is contained in:
parent
b282e47213
commit
5e3bc96493
7 changed files with 19 additions and 12 deletions
|
@ -67,6 +67,7 @@ sqldelight-androidDriver = { module = "app.cash.sqldelight:android-driver", vers
|
|||
sqldelight-extensions-coroutines = { module = "app.cash.sqldelight:coroutines-extensions-jvm", version.ref = "sqldelight" }
|
||||
sqldelight-jvmDriver = { module = "app.cash.sqldelight:sqlite-driver", version.ref = "sqldelight" }
|
||||
sqldelight-primitiveAdapters = { module = "app.cash.sqldelight:primitive-adapters", version.ref = "sqldelight" }
|
||||
testparameterinjector = "com.google.testparameterinjector:test-parameter-injector:1.8"
|
||||
|
||||
[plugins]
|
||||
android-test = { id = "com.android.test", version.ref = "agp" }
|
||||
|
|
|
@ -16,6 +16,7 @@ android {
|
|||
dependencies {
|
||||
testImplementation(kotlin("test-junit"))
|
||||
testImplementation(libs.kotlinx.datetime)
|
||||
testImplementation(libs.testparameterinjector)
|
||||
testImplementation(projects.common)
|
||||
}
|
||||
|
||||
|
|
|
@ -2,27 +2,22 @@ package dev.msfjarvis.claw.android.tests
|
|||
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import app.cash.paparazzi.Paparazzi
|
||||
import dev.msfjarvis.claw.common.theme.DarkThemeColors
|
||||
import dev.msfjarvis.claw.common.theme.LightThemeColors
|
||||
import com.google.testing.junit.testparameterinjector.TestParameter
|
||||
import com.google.testing.junit.testparameterinjector.TestParameterInjector
|
||||
import dev.msfjarvis.claw.common.ui.decorations.MonthHeader
|
||||
import kotlinx.datetime.Month
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(TestParameterInjector::class)
|
||||
class MonthHeaderTest {
|
||||
@get:Rule val paparazzi = Paparazzi()
|
||||
|
||||
@Test
|
||||
fun light_mode() {
|
||||
paparazzi.snapshot {
|
||||
MaterialTheme(colorScheme = LightThemeColors) { MonthHeader(Month.APRIL) }
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dark_mode() {
|
||||
paparazzi.snapshot {
|
||||
MaterialTheme(colorScheme = DarkThemeColors) { MonthHeader(Month.JANUARY) }
|
||||
fun verify(@TestParameter theme: Theme) {
|
||||
paparazzi.snapshot(name = theme.name) {
|
||||
MaterialTheme(colorScheme = theme.colors) { MonthHeader(Month.APRIL) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package dev.msfjarvis.claw.android.tests
|
||||
|
||||
import androidx.compose.material3.ColorScheme
|
||||
import dev.msfjarvis.claw.common.theme.DarkThemeColors
|
||||
import dev.msfjarvis.claw.common.theme.LightThemeColors
|
||||
|
||||
enum class Theme(val colors: ColorScheme) {
|
||||
Light(LightThemeColors),
|
||||
Dark(DarkThemeColors),
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 8.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
Loading…
Add table
Add a link
Reference in a new issue