From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../tests/encoding/resources/decode-common.js | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 testing/web-platform/tests/encoding/resources/decode-common.js (limited to 'testing/web-platform/tests/encoding/resources/decode-common.js') diff --git a/testing/web-platform/tests/encoding/resources/decode-common.js b/testing/web-platform/tests/encoding/resources/decode-common.js new file mode 100644 index 0000000000..19dd6939ac --- /dev/null +++ b/testing/web-platform/tests/encoding/resources/decode-common.js @@ -0,0 +1,40 @@ +var tests = []; + +function iframeRef(frameRef) { + return frameRef.contentWindow + ? frameRef.contentWindow.document + : frameRef.contentDocument; +} + +function showNodes(decoder) { + var iframe = iframeRef(document.getElementById("scrwin")); + nodes = iframe.querySelectorAll("span"); + + for (var i = 0; i < nodes.length; i++) { + var test = subsetTest(async_test, + "U+" + + nodes[i].dataset.cp + + " " + + String.fromCodePoint(parseInt(nodes[i].dataset.cp, 16)) + + " " + + decoder(nodes[i].dataset.bytes) + + " " + + nodes[i].dataset.bytes + ); + if (test) { + tests[i] = test; + } + } + + for (var i = 0; i < nodes.length; i++) { + if (tests[i]) { + tests[i].step(function() { + assert_equals( + nodes[i].textContent, + decoder(nodes[i].dataset.bytes) + ); + }); + tests[i].done(); + } + } +} -- cgit v1.2.3