You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Attempting to record a diff image on a failed Compose screenshot test leads to a java.lang.RuntimeException: Buffer not large enough for pixels error
This issue relates to:
The Kotlin library
The Gradle plugin
The IntelliJ Platform plugin
The sample code
The documentation
To Reproduce
Steps to reproduce the behavior:
Create a screenshot test using the ComposableScreenshotRule and enable the TestifyFeatures.GenerateDiffs option. Create a screenshot reference and then update the UI such that it is different. Then run the test (expected to fail). An updated screenshot is written out (as expected) but the diff image is not created. In the logs it appears there is an error that is thrown when creating the diff image (java.lang.RuntimeException: Buffer not large enough for pixels)
Here is the call stack I'm seeing in the logs:
java.lang.RuntimeException: Buffer not large enough for pixels
at android.graphics.Bitmap.copyPixelsToBuffer(Bitmap.java:636)
at dev.testify.internal.processor.ParallelPixelProcessor.prepareBuffers(ParallelPixelProcessor.kt:39)
at dev.testify.internal.processor.ParallelPixelProcessor.transform(ParallelPixelProcessor.kt:97)
at dev.testify.internal.processor.diff.HighContrastDiff.generate(HighContrastDiff.kt:24)
at dev.testify.ScreenshotRule.generateHighContrastDiff(ScreenshotRule.kt:423)
at dev.testify.ScreenshotRule.assertSame(ScreenshotRule.kt:534)
at com.xxxx.android.example.ExampleComposeSnapshotTests$test_instrumentation_snapshot_tests_integration_for_compose$3.invoke(ExampleComposeSnapshotTests.kt:20)
at com.xxxx.android.example.ExampleComposeSnapshotTests$test_instrumentation_snapshot_tests_integration_for_compose$3.invoke(ExampleComposeSnapshotTests.kt:15)
at com.kaspersky.kaspresso.testcases.core.TestRunner.runMainTestSection(TestRunner.kt:146)
at com.kaspersky.kaspresso.testcases.core.TestRunner.run(TestRunner.kt:59)
at com.kaspersky.kaspresso.testcases.core.sections.MainTestSection.run(MainTestSection.kt:29)
at com.xxxx.android.example.ExampleComposeSnapshotTests.test_instrumentation_snapshot_tests_integration_for_compose(ExampleComposeSnapshotTests.kt:15)
Here is our setup for the rule:
@get:Rule
val composeScreenshotRule = ComposableScreenshotRule()
.configure {
exactness = 0.95f
}
.withExperimentalFeatureEnabled(TestifyFeatures.GenerateDiffs)
as ComposableScreenshotRule
Is there any insight you can provide here about what might be causing this issue or how we might fix this? / Does our setup look correct for this approach?
Thanks for any help you can provide!
Expected behavior
I would expect the diff image file is created and written to disk. Note: The ScreenshotRule with similar setup works fine and outputs a diff image.
Screenshots
If applicable, add screenshots to help explain your problem.
Target Android Device (please complete the following information):
Device: Android Emulator and actual device on AWS DeviceFarm (Samsung Galaxy S21)
The text was updated successfully, but these errors were encountered:
philipsawyer
added
the
Bug
Any behaviour the deviates from the documentation, expected outcome or API contract.
label
Jul 18, 2023
Describe the bug
Attempting to record a diff image on a failed Compose screenshot test leads to a
java.lang.RuntimeException: Buffer not large enough for pixels
errorThis issue relates to:
To Reproduce
Steps to reproduce the behavior:
Create a screenshot test using the
ComposableScreenshotRule
and enable theTestifyFeatures.GenerateDiffs
option. Create a screenshot reference and then update the UI such that it is different. Then run the test (expected to fail). An updated screenshot is written out (as expected) but the diff image is not created. In the logs it appears there is an error that is thrown when creating the diff image (java.lang.RuntimeException: Buffer not large enough for pixels
)Here is the call stack I'm seeing in the logs:
Here is our setup for the rule:
Is there any insight you can provide here about what might be causing this issue or how we might fix this? / Does our setup look correct for this approach?
Thanks for any help you can provide!
Expected behavior
I would expect the diff image file is created and written to disk. Note: The
ScreenshotRule
with similar setup works fine and outputs a diff image.Screenshots
If applicable, add screenshots to help explain your problem.
Target Android Device (please complete the following information):
The text was updated successfully, but these errors were encountered: