Skip to content

Commit

Permalink
Add screenshot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yschimke committed Feb 24, 2024
1 parent ce19232 commit 70532d7
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,14 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onRoot
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.github.takahirom.roborazzi.ExperimentalRoborazziApi
import com.github.takahirom.roborazzi.RoborazziOptions
import com.github.takahirom.roborazzi.ThresholdValidator
import com.github.takahirom.roborazzi.captureRoboImage
import kotlinx.coroutines.flow.MutableStateFlow
import org.junit.Assume
import org.junit.Assume.assumeFalse
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.ParameterizedRobolectricTestRunner
import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config
import org.robolectric.annotation.GraphicsMode
Expand All @@ -38,12 +33,15 @@ abstract class ClockScreenshotTest {

abstract val device: WearDevice

open val roborazziOptions: RoborazziOptions = RoborazziOptions(
compareOptions = RoborazziOptions.CompareOptions(
// generous to allow for mac/linux differences
resultValidator = ThresholdValidator(0.01f)
// generous to allow for mac/linux differences
open val tolerance = 0.01f

open val roborazziOptions: RoborazziOptions
get() = RoborazziOptions(
compareOptions = RoborazziOptions.CompareOptions(
resultValidator = ThresholdValidator(tolerance)
)
)
)

@Before
fun check() {
Expand Down

0 comments on commit 70532d7

Please sign in to comment.