-
Notifications
You must be signed in to change notification settings - Fork 214
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
"Width (0) and height (0) cannot be <= 0" error or font resource loading error or empty screenshot issue #1288
Comments
I started getting this after specifically updating Material3 to 1.2.0. Any previews that display text with custom font will fail and the snapshot comes out blank. |
@alashow thanks for reopening. without a repro, this remains a challenge to solve. Also, how certain are you that the two variants are related, i.e., the same bug? @JeremiahStephenson re: "any previews that display text will fail" so this might be an layoutlib issue? One thing I just noticed is that Have you updated the environment accordingly, i.e.,
? |
@jrodbx No, that doesn't fix my issue. The issue for me only came up after updating material3 to the latest stable version |
Both errors show up after updating composeBom to latest, so that's the only reason I think they're related.
Yes, I did apply the fix from #1025, |
Indeed, only tests using After debugging I found out that it only fails when using custom fontFamily. I changed our default fontFamily from custom one to FontFamily.Default, and re-recorded tests - all tests got recorded / didn't fail with above errors. Then I tried specifying FontFamily(
fonts = listOf(
Font(
resId = R.font.customFont,
weight = FontWeight.Thin,
style = FontStyle.Normal,
loadingStrategy= FontLoadingStrategy.Async,
)
...,
) and again screenshot test didn't fail when running. Changing So if this is a layoutlib issue, does it mean the same components using |
I think it also was reading sent under note and day and date was only saying today or yesterday also but I did notice if you reset your camera in settings for just the camera it works like new only once in settings u have to adjust it then like right away. |
I think just a simple reset would change it all unless u have a cheap phone |
@renovater8 what are you going on about? |
@alashow |
@jrodbx any updates on this? |
We had this issue on our project when we ran Paparazzi tests with JUnit 5 enabled. When we rewrote our tests to use JUnit 4 and completely disabled JUnit 5, the issue has gone. I don't know why JUnit version matters, but this our case. |
We're using JUnit 4 (4.13.2 specifically) |
It fails for me when using a custom font in Compose Multiplatform. I've got a workaround which is far from perfect but at least it lets me run the screenshot tests: It consists in mocking the That of course means the fonts needs to get copied over to the Android test font resource folder. I'm using Mockposable along with Mockk for mocking the composable function. Something like this: mockkStatic("my.package.FontFamilyKt")
everyComposable { fontFamily() } answersComposable { androidFontFamily() } |
Description
Note: re-opening #1054 because it was closed and now it's failing with upgrading composeBom to latest stable vs alpha version of constraintLayout.
When upgrading from composeBom
2023.10.01
to2024.02.00
, screenshot tests start failing with empty screens or these errors:Steps to Reproduce
Not able to cleanly reproduce this yet. Before it was happening with constraintLayout alpha versions, now not sure what library is causing this exactly.
Project sample fails with different error when adding all composeBom library dependencies (PlatformTextInputPluginRegistryImpl classnotfound error)
Additional information:
Screenshots
See screenshots in #1054
The text was updated successfully, but these errors were encountered: