On Fri, 4 Apr 2025 21:11:19 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

> hmm, not sure if I share the concern (did I understand the concern?)
> 
> the idea is to have a low-level method `takeScreenshotBase64(prefix, 
> postfix)` that can be used in non-standard situations, but also provide the 
> convenience method that will be used in the tests, `writeScreenshotBase64()`.

That part sounds fine. However, even in non-standard situations, the caller of 
`takeScreenshotBase64` should not be expected to pass 
`"data:image/png;base64,"` to that method. It is the method itself that knows 
that the format is PNG, so that method should provide that part of the string 
when converting it to a base64 screenshot. So, for example:


    takeScreenshotBase64(null, null);  <-- returns a data URL of a 
base64-encoded PNG
    takeScreenshotBase64("{ screenshot:", "}"); <-- return the same with the 
prefix and postfix


So what I'm trying to say is that `"data:image/png;base64,"` is an integral 
part of the base64-encoded image, not an optional prefix that a caller must 
pass in.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1746#discussion_r2029457035

Reply via email to