Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request - Pseudolocal samples #399

Open
yschimke opened this issue Jun 6, 2024 · 3 comments · May be fixed by #400
Open

Feature Request - Pseudolocal samples #399

yschimke opened this issue Jun 6, 2024 · 3 comments · May be fixed by #400

Comments

@yschimke
Copy link
Contributor

yschimke commented Jun 6, 2024

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
Copy link
Contributor Author

yschimke commented Jun 6, 2024

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
Copy link
Owner

I wasn't able to reproduce the issue. Could you check the sample code I added?
#400
image

@takahirom takahirom linked a pull request Jun 7, 2024 that will close this issue
@yschimke
Copy link
Contributor Author

yschimke commented Jun 7, 2024

Perfect, bug in my code then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants