RFR: 8328716: [TestBug] Screen capturing utility for failed tests [v6]
Andy Goryachev
angorya at openjdk.org
Fri Apr 4 20:51:55 UTC 2025
On Fri, 4 Apr 2025 20:28:43 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> Andy Goryachev has updated the pull request incrementally with one additional commit since the last revision:
>>
>> javadoc
>
> tests/system/src/test/java/test/util/ScreenshotCapture.java line 107:
>
>> 105: * @return the screenshot in Base-64 encoded PNG, or an error message
>> 106: */
>> 107: public static String takeScreenshotBase64(String prefix, String postfix) {
>
> Passing in the `data:image/png;base64,` as a prefix is odd. This method takes a screen shot and turns it into a base64-encoded PNG. Don't make the caller pass in something that has to match this internal behavior of this method. I would recommend removing the prefix and postfix entirely, and having this method return a simple base64-encoded PNG with a `data:image/png;base64,` data URL. The caller can add any other String before or after this.
I wanted to avoid creating multiple multi-megabyte strings.
The method to use is writeScreenshot(), which should be simple enough to use, it's the method mentioned at the class level javadoc.
Related: I was debating whether we should have two specific methods
writeScreenshotStdout();
writeSceeenshotStderr();
instead of passing `System:out` or `System::err`. What do you think?
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1746#discussion_r2029418685
More information about the openjfx-dev
mailing list