Closed SethTisue closed 3 years ago
Thanks for the report. I run into this from time to time and I think this is due to differences in Java2D rendering between JVM versions and OS versions. What JVM version does the 2.13.6 build use, and, if Doodle is in the 3 build, does it differ from that? Thanks!
On Sun, Aug 29, 2021 at 4:26 PM Seth Tisue @.***> wrote:
++2.13.6 followed by golden/test gives
==> X doodle.golden.Text.text-color 0.045s munit.ComparisonFailException: /Users/tisue/doodle/golden/src/test/scala/doodle/golden/Text.scala:40 39: 40: testPicture("text-color") { 41: textAlgebra, Drawing Heights differ => Obtained 34 => Diff (- obtained, + expected) -34 +33 at munit.FunSuite.assertEquals(FunSuite.scala:11) at doodle.golden.GoldenPicture.assertGoldenPicture(GoldenPicture.scala:32) at doodle.golden.GoldenPicture.assertGoldenPicture$(GoldenPicture.scala:16) at doodle.golden.Text.assertGoldenPicture(Text.scala:11) at doodle.golden.GoldenPicture.$anonfun$testPicture$1(GoldenPicture.scala:59)
this came up in the Scala 2.13 community build
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/creativescala/doodle/issues/103, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAH5XFNDEGKBNJ2A7W5CCDT7JGRDANCNFSM5DALA4AA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
I am not sure if I have seen it fail on our Jenkins (which runs Ubuntu) or not.
But I know I'm able to reproduce it locally on macOS 11.5.2 on GraalVM 11:
~/doodle % java -version
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment GraalVM CE 21.2.0 (build 11.0.12+6-jvmci-21.2-b08)
OpenJDK 64-Bit Server VM GraalVM CE 21.2.0 (build 11.0.12+6-jvmci-21.2-b08, mixed mode, sharing)
and also AdoptOpenJDK 8:
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)
So far I've been treating the CI results (Github actions on Ubuntu) for the golden tests as definitive, and mostly ignoring what happens on my local machine beyond visual inspection of the generated images. I could make the image diffing more robust to differences in size. In general image diffing is a hard problem, and I'm not sure how much effort to invest in this.
I've added some code that might address this.
it still fails for me. (after #104, which is needed for the tests to even compile.)
It does fail with a different error message, though, right? I can make the code print out the offending image and the diff, which might go some way to debugging this. I fear writing an acceptable image diff algorithm may become a project in its own right.
currently the error is:
==> X doodle.golden.Text.text-color 0.021s munit.FailException: /Users/tisue/doodle/golden/src/test/scala/doodle/golden/Text.scala:44 Height or width differ by more than one pixel
43: .beside(text[Algebra, Drawing]("Blue").strokeColor(Color.blue))
44: }
45:}
at munit.FunSuite.assert(FunSuite.scala:11)
at doodle.golden.Golden.imageDiff(Golden.scala:74)
at doodle.golden.Golden.imageDiff$(Golden.scala:13)
at doodle.golden.Text.imageDiff(Text.scala:11)
at doodle.golden.GoldenPicture.assertGoldenPicture(GoldenPicture.scala:28)
I think you could reasonably mark the test as to be skipped except on Linux.
I've updated the error message so there should hopefully be much more useful output. If you can paste that in we'll be able to tell if its a spurious error or not, and take action accordingly.
AdoptOpenJDK Java 1.8.0_292, macOS:
==> X doodle.golden.Text.text-color 0.039s munit.FailException: /Users/tisue/doodle/golden/src/test/scala/doodle/golden/Text.scala:44
43: .beside(text[Algebra, Drawing]("Blue").strokeColor(Color.blue))
44: }
45:}
The dimensions (width x height) of the actual image are 67 by 34
The dimensions (width x height) of the expected image are 71 by 33
The actual image, PNG and Base 64 encoded is
iVBORw0KGgoAAAANSUhEUgAAAFcAAAA2CAYAAACyYAWTAAACsklEQVR42u2YyytFURTGPUqepTwmZCIipZABhgaUGBhTklIM/AOUgTyKKO+BGJCJEgMMKEOPiBKFIlJEyZtSH6vVaTv3Xvd6ZHDc76vTPfusdfdq/+7e397nBoD6MwUQAeESLkW4hEu4FOESLuFShEu4hEsRL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cFCrsQNfXMD0NXV2/DjvQ3R3Mz0NbW6HDNt3fQ1mZj9/fYW4O6uuhshLGxuDx0eff3mBiAqqqoKEBVlYiYZseHqC0NHc+F/jwvbhykgP75gampqCjw99bXIRMBk5O4PYWRkdhctLnZ2ZgYAAuLuD8HPr6ImHbXi4sQE9PfrDjykmOZ9uorYXTU59vaoLDQx9fXUFdnY+tm/f3fZzNRnp24Ns7O/nBjisnGZ398QHHx67lNjZ83iylpMSN4mIoKnKfgcwPXl58bNcRnf387Lqztzc/2HHlJMuzz86gpsb9302NjV87/buss8NHi729WM82jw0/FsJ527unJx9fXn7Nx5WTLNimkRFYW3PXS0vOkw2oUdjehuFhP9dOL4ODzrNt2NyYzravbGnJne/uhtlZtyHmy7ZUOB9XTvJgb21Ba6t//C8vO7MsL4f2dtjc9HNfX2F83J1G0mlYXY30bOtoA7q7m7sEs/zOTrdUczOsr/88jUSVo9d1va5Lgi3Ygi0JtmBLgi3Ygi0Egi3YkmALtiTYgi3YkmALtiTYgl3A+gTbCPZGMfcurwAAAABJRU5ErkJggg==
To convert a base64 string to a viewable picture, use
Base64[Png](string).toPicture[Algebra, Drawing]
at munit.FunSuite.assert(FunSuite.scala:11)
at doodle.golden.Golden.imageDiff(Golden.scala:127)
at doodle.golden.Golden.imageDiff$(Golden.scala:13)
at doodle.golden.Text.imageDiff(Text.scala:11)
at doodle.golden.GoldenPicture.assertGoldenPicture(GoldenPicture.scala:28)
at doodle.golden.GoldenPicture.assertGoldenPicture$(GoldenPicture.scala:11)
at doodle.golden.Text.assertGoldenPicture(Text.scala:11)
at doodle.golden.GoldenPicture.testPicture$$anonfun$1(GoldenPicture.scala:43)
[error] Failed: Total 13, Failed 1, Errors 0, Passed 12
[error] Failed tests:
[error] doodle.golden.Text
Thanks. It looks like a small difference in font rendering. I've attempted to make the test more robust to this difference. If this doesn't work I'll mark the test as Linux only.
still failing
Ok. I've made my final attempt. Let me know if it works...
[info] Passed: Total 13, Failed 0, Errors 0, Passed 13
🥇
:joy_cat:
++2.13.6
followed bygolden/test
givesthis came up in the Scala 2.13 community build