takahirom / roborazzi

Make JVM Android integration test visible 🤖📸
https://takahirom.github.io/roborazzi/
Apache License 2.0
649 stars 24 forks source link

Feature Request - Pseudolocal samples #399

Open yschimke opened 4 weeks ago

yschimke commented 4 weeks ago

Samples or possibly support for LayoutDirection tests.

I'm testing on https://github.com/google/horologist/pull/2258/files

I guess it's mainly

Plugin enables pseudolocales for tests

    buildTypes {
        debug {
            isPseudoLocalesEnabled = true
        }
    }

Samples showing and confirming pseudolocales are kicking in

    @Test
    @Config(qualifiers = "+ar-rXB-ldrtl")
    fun mirroredRtl() {

image

yschimke commented 4 weeks ago

1 possible bug in a) my tests, b) roborazzi, c) robolectric

The compose LocalLayoutDirection appears to reset back to Ltr for the screenshot. Not sure why.

    @Composable
    public open fun ComponentScaffold(content: @Composable () -> Unit) {
        // TODO why needed
        val layoutDirection = when (LocalConfiguration.current.layoutDirection) {
            RTL -> LayoutDirection.Rtl
            else -> LayoutDirection.Ltr
        }
        CompositionLocalProvider(value = LocalLayoutDirection provides layoutDirection) {
            content()
        }
    }

I have this workaround, so am curious if you get the same error.

takahirom commented 3 weeks ago

I wasn't able to reproduce the issue. Could you check the sample code I added? https://github.com/takahirom/roborazzi/pull/400

image
yschimke commented 3 weeks ago

Perfect, bug in my code then.