-
Notifications
You must be signed in to change notification settings - Fork 79
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
Support threshold in DesktopScreenshotTestRule
#1603
base: jb-main
Are you sure you want to change the base?
Conversation
public static fun getEntries ()Lkotlin/enums/EnumEntries; | ||
public static fun valueOf (Ljava/lang/String;)Landroidx/compose/ui/test/junit4/ScreenshotResultProto$Status; | ||
public static fun values ()[Landroidx/compose/ui/test/junit4/ScreenshotResultProto$Status; | ||
public final class androidx/compose/ui/test/junit4/DesktopScreenshotTestRule_desktopKt { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for this PR, but we need to move this out of ui-test-juint4
to a private module in the future.
val SSIMTotal = calculateSSIM(expected, given, width, height) | ||
|
||
val stats = | ||
"[MSSIM] Required SSIM: $threshold, Actual " + "SSIM: " + "%.3f".format(SSIMTotal) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we have this exception:
Image mismatch! Comparison stats: '[MSSIM] Required SSIM: 0.99, Actual SSIM: 0.976'
Before the change we had:
java.lang.AssertionError: java.lang.AssertionError: Image mismatch! Expected image compose/ui/ui-desktop/platform/androidx_compose_ui_platform_GraphicsLayerTest_rotationXYZ.png, actual: compose/ui/ui-desktop/platform/androidx_compose_ui_platform_GraphicsLayerTest_rotationXYZ_actual.png. FS location: /home/teamcity/agent/work/8a20760945d0aeba/golden
We need to add paths to files
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GraphicsLayerTest.scale
is successful when i change scaleY:
@Test
fun scale() {
val snapshot = renderComposeScene(width = 40, height = 40) {
Box(
Modifier
.graphicsLayer(
scaleX = 2f,
scaleY = 1.0f,
transformOrigin = TransformOrigin(0f, 0f)
)
.requiredSize(10f.dp, 10f.dp).background(Color.Red)
)
Box(
Modifier
.graphicsLayer(
translationX = 10f,
translationY = 20f,
scaleX = 2f,
scaleY = 0.5f
)
.requiredSize(10f.dp, 10f.dp).background(Color.Blue)
)
}
screenshotRule.assertImageAgainstGolden(snapshot)
}
and set threshold to 1.00.
Adoption of approximate image comparison for internal screenshot tests from Android.
Now it reports the percentage of similarity:
and corresponding diff as a separate image:
Fixes CMP-5310