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

Material3 OutlinedTextField outline is drawn behind label during screenshot test #1032

Closed
kikin81 opened this issue Aug 1, 2023 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@kikin81
Copy link

kikin81 commented Aug 1, 2023

Description
When taking a paparazzi screenshot of a Material3 OutlinedTextField you can see the outline drawn behind the label text. This is not present in the Android Studio compose preview.

Steps to Reproduce
Example paparazzi test:

class LaunchViewTest {
    @get:Rule
    val paparazzi = Paparazzi(
        deviceConfig = PIXEL_5,
        theme = "android:Theme.Material.Light.NoActionBar"
    )

    @Test
    fun launchComposable() {
        paparazzi.snapshot {
            Column(
                modifier = Modifier
                    .fillMaxWidth()
                    .background(color = Color.White)
                    .padding(16.dp)
            ) {
                OutlinedTextField(
                    label = {
                        Text(text = "Example of a label")
                    },
                    value = "user input string",
                    onValueChange = { },
                    modifier = Modifier.fillMaxWidth()
                )
            }
        }
    }
}

Expected behavior
The paparazzi screenshot test should match the Android Studio preview which does not show the outline behind the label

Additional information:

  • Paparazzi Version: 1.3.1 (also in 1.2.0)
  • OS: Android 13
  • Compile SDK: 34
  • Gradle Version: 8.2
  • Android Gradle Plugin Version: 8.0.2

Screenshots

Expected result (AS Preview) Actual result (paparazzi screenshot)
Screenshot 2023-08-01 at 3 01 00 PM us kikin android paparazzitest_LaunchViewTest_launchComposable
@kikin81 kikin81 added the bug Something isn't working label Aug 1, 2023
@jrodbx jrodbx added this to the 1.3.3 milestone Jan 22, 2024
@BrianGardnerAtl
Copy link
Collaborator

Hey! I checked in on this and it seems to be an animation issue. The border is created by the BorderBox composable, where the border stroke is created from the animateBorderStrokeAsState function. I actually found this through preview where I noticed if you change the value you will see the non-cutout border for one frame before it settles. Running the test with gif shows that only the first frame has the border and the cutout is applied afterwards.

I filed an issue on the compose bug tracker to see if this is intentional and also filed a feature request for paparazzi to provide a way to snapshot after these types of animations.

I don't think this is something we can solve right now but using the gif api can show the border cut out for this component.

@jrodbx
Copy link
Collaborator

jrodbx commented Jan 25, 2024

Closing per @BrianGardnerAtl 's response, will continue to track this and similar issues under #1261. Thanks!

@jrodbx jrodbx closed this as completed Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants