mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 19:57:04 +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-extensions-coroutines = { module = "app.cash.sqldelight:coroutines-extensions-jvm", version.ref = "sqldelight" }
|
||||||
sqldelight-jvmDriver = { module = "app.cash.sqldelight:sqlite-driver", 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" }
|
sqldelight-primitiveAdapters = { module = "app.cash.sqldelight:primitive-adapters", version.ref = "sqldelight" }
|
||||||
|
testparameterinjector = "com.google.testparameterinjector:test-parameter-injector:1.8"
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
android-test = { id = "com.android.test", version.ref = "agp" }
|
android-test = { id = "com.android.test", version.ref = "agp" }
|
||||||
|
|
|
@ -16,6 +16,7 @@ android {
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation(kotlin("test-junit"))
|
testImplementation(kotlin("test-junit"))
|
||||||
testImplementation(libs.kotlinx.datetime)
|
testImplementation(libs.kotlinx.datetime)
|
||||||
|
testImplementation(libs.testparameterinjector)
|
||||||
testImplementation(projects.common)
|
testImplementation(projects.common)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,27 +2,22 @@ package dev.msfjarvis.claw.android.tests
|
||||||
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import app.cash.paparazzi.Paparazzi
|
import app.cash.paparazzi.Paparazzi
|
||||||
import dev.msfjarvis.claw.common.theme.DarkThemeColors
|
import com.google.testing.junit.testparameterinjector.TestParameter
|
||||||
import dev.msfjarvis.claw.common.theme.LightThemeColors
|
import com.google.testing.junit.testparameterinjector.TestParameterInjector
|
||||||
import dev.msfjarvis.claw.common.ui.decorations.MonthHeader
|
import dev.msfjarvis.claw.common.ui.decorations.MonthHeader
|
||||||
import kotlinx.datetime.Month
|
import kotlinx.datetime.Month
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
|
@RunWith(TestParameterInjector::class)
|
||||||
class MonthHeaderTest {
|
class MonthHeaderTest {
|
||||||
@get:Rule val paparazzi = Paparazzi()
|
@get:Rule val paparazzi = Paparazzi()
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun light_mode() {
|
fun verify(@TestParameter theme: Theme) {
|
||||||
paparazzi.snapshot {
|
paparazzi.snapshot(name = theme.name) {
|
||||||
MaterialTheme(colorScheme = LightThemeColors) { MonthHeader(Month.APRIL) }
|
MaterialTheme(colorScheme = theme.colors) { MonthHeader(Month.APRIL) }
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun dark_mode() {
|
|
||||||
paparazzi.snapshot {
|
|
||||||
MaterialTheme(colorScheme = DarkThemeColors) { MonthHeader(Month.JANUARY) }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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