Skip to content

Commit 8b377e3

Browse files
shai-almogclaude
andcommitted
test(parparvm): update facade contract for ImageData.writeArgbBuffer delegation
Commit 364c239 ("fix(js-port): fade transition rgbBuffer write reaches live ImageData") replaced HTML5Implementation.createImageData's worker-side ``JavaScriptImageDataAdapter.writeArgbToRgba`` unpack-and-set loop with a single host-side ``ImageData.writeArgbBuffer(...)`` round trip, because the worker→host marshalling clones any returned ``Uint8ClampedArray`` for read-perf reasons (``hostResult`` in browser_bridge.js) — so ``data.set(arr)`` on the worker-side ImageData.data wrote into a phantom buffer and ``putImageData`` rendered transparent black. JavaScriptRuntimeFacadeTest still asserted the old delegation contract via ``contains("JavaScriptImageDataAdapter.writeArgbToRgba(")``, which no longer holds; the test was correctly catching the architectural change. Update the assertion to look for ``.writeArgbBuffer(`` (the new delegation point), with a comment pointing at the fade-fix commit so anyone removing this delegation is forced to look at why the path was moved host-side. The read direction (``JavaScriptImageDataAdapter.readRgbaToArgb``) is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4de06d1 commit 8b377e3

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

vm/tests/src/test/java/com/codename1/tools/translator/JavaScriptRuntimeFacadeTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,12 @@ void html5ImplementationAndBootstrapDelegateToRuntimeFacade() throws Exception {
216216
"ClipShape should delegate path traversal to the shared shape path adapter");
217217
assertTrue(html5Source.contains("JavaScriptImageDataAdapter.readRgbaToArgb("),
218218
"HTML5Implementation should delegate image-data readback packing to the image data adapter");
219-
assertTrue(html5Source.contains("JavaScriptImageDataAdapter.writeArgbToRgba("),
220-
"HTML5Implementation should delegate image-data writes to the image data adapter");
219+
assertTrue(html5Source.contains(".writeArgbBuffer("),
220+
"HTML5Implementation should delegate image-data writes through ImageData.writeArgbBuffer "
221+
+ "(host-side prototype extension in browser_bridge.js) — the worker-side "
222+
+ "JavaScriptImageDataAdapter.writeArgbToRgba round-trip lost every byte to the "
223+
+ "Uint8ClampedArray clone optimization in hostResult, see commit 6c6c48330 for the "
224+
+ "rationale and the diagnosis chain");
221225
assertTrue(html5Source.contains("JavaScriptNativeImageAdapter.resolveWidth("),
222226
"HTML5Implementation.NativeImage should delegate width resolution to the native image adapter");
223227
assertTrue(html5Source.contains("JavaScriptNativeImageAdapter.resolveHeight("),

0 commit comments

Comments
 (0)