5 <title>${testname} - Details</title>
6 <link rel="stylesheet" href="${css}">
8 <script>module = {}</script>
9 <script src="https://unpkg.com/pixelmatch"></script>
11 var diff_complete = false;
13 function readImageData(imageID) {
14 var image = document.getElementById(imageID);
15 var canvas = document.createElement("canvas");
16 canvas.width = image.naturalWidth;
17 canvas.height = image.naturalHeight;
18 canvas.getContext("2d").drawImage(image, 0, 0);
19 return canvas.getContext("2d").getImageData(0, 0, image.naturalWidth, image.naturalHeight);
22 function show_image(src) {
23 document.getElementById("diffOutput").innerHTML = '<img src="' + src + '">'
26 function compare_images() {
27 var diff = document.createElement("canvas");
28 var ref = document.getElementById("refimg");
29 var rend = document.getElementById("rendimg");
31 if(!ref.complete || !rend.complete || diff_complete) {
35 var width = ref.naturalWidth
36 var height = ref.naturalHeight
40 const ref_data = readImageData("refimg")
42 const rend_data = readImageData("rendimg")
44 diff_ctx = diff.getContext('2d');
45 const diff_data = diff_ctx.createImageData(width, height)
47 const diff_count_rel = pixelmatch(ref_data.data, rend_data.data, diff_data.data, width, height, {threshold: 0.1})
48 const diff_count_abs = pixelmatch(ref_data.data, rend_data.data, diff_data.data, width, height, {threshold: 0.0, includeAA: true})
49 document.getElementById("diffPixelCount").innerHTML = "Different pixels: " + diff_count_abs + " <small>(no tolerance)</small>, <strong>" + diff_count_rel + "</strong> <small>(1% tol.)</small>"
51 diff_ctx.putImageData(diff_data, 0, 0)
54 document.getElementById("diffimg").src = diff.toDataURL();
60 <h1>Results for ${testname}</h1>
63 <p><b>Result:</b> ${value.result}</p>
65 <p><a href="${index}">Back to summary</a></p>
74 <td>${value.returncode}</td>
78 <td>${value.time.delta}</td>
86 <td id="diffPixelCount">Calculating the difference...</td>
90 % for image in value.images:
92 <td><img width="380px" id="diffimg" onclick="show_image(this.src)"/></td>
93 <td><img src="file://${image['image_ref'] if 'image_ref' in image else None}" id="refimg" width="380px" onload="compare_images()" onclick="show_image(this.src)" crossorigin="Anonymous"/></td>
94 <td><img src="file://${image['image_render'] if 'image_render' in image else None}" id="rendimg" width="380px" onload="compare_images()" onclick="show_image(this.src)" crossorigin="Anonymous"/></td>
96 <tr><td colspan="3" id="diffOutput"></td></tr>
105 <pre>${value.out | h}</pre>
111 <pre>${value.err | h}</pre>
114 % if value.environment:
118 <pre>${value.environment | h}</pre>
125 <pre>${value.command}</pre>
128 % if value.exception:
132 <pre>${value.exception | h}</pre>
136 % if value.traceback:
140 <pre>${value.traceback | h}</pre>
147 <pre>${value.dmesg | h}</pre>
151 <p><a href="${index}">Back to summary</a></p>