[tools 2/3] winetest/build-patterns: Show failure counts <= 9 when over a pattern.

Francois Gouget fgouget at codeweavers.com
Thu May 5 09:57:26 CDT 2022


The failure count can help distinguish the failure counts when there are
many different values. But this makes the patterns more noisy so only
show them when hovering over the pattern.
Also each build result only gets one character so this is only possible
if the failure count is 9 or less.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
This could be cranked up to 15 (11 is for wimps) but the pattern looks
cursed when hexed.

Also note that this depends on the previous patch. Otherwise 
'<b><i>2</i></b>' would get converted to '222222222222222'!
---
 winetest/build-patterns |  4 ++++
 winetest/patterns.js    | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/winetest/build-patterns b/winetest/build-patterns
index b6e5531e1..7acb153d3 100755
--- a/winetest/build-patterns
+++ b/winetest/build-patterns
@@ -975,6 +975,10 @@ sub get_status_html($$)
 
     return @{$status2html{$status}} if ($status2html{$status});
 
+    if ($status =~ /^[1-9]$/)
+    {
+        return ("F", "F", "$status failures", "t", " fcount='$status' style='background-color: $failcolors->{$status}'");
+    }
     if ($status =~ /^[0-9]+$/)
     {
         return ("F", "F", "$status failures", "t", " style='background-color: $failcolors->{$status}'");
diff --git a/winetest/patterns.js b/winetest/patterns.js
index 65e9cb82e..459190347 100644
--- a/winetest/patterns.js
+++ b/winetest/patterns.js
@@ -170,6 +170,24 @@ function toggledReportCB(e)
     refreshPage(changes);
 }
 
+function showRangeCounts(e)
+{
+    const domtest = e.target.closest("div.testfile");
+    domtest.querySelectorAll(":scope [fcount]").forEach(frange => {
+        const fcount = frange.getAttribute("fcount");
+        frange.innerHTML = fcount.repeat(frange.innerHTML.length);
+    });
+}
+
+function hideRangeCounts(e)
+{
+    const domtest = e.target.closest("div.testfile");
+    domtest.querySelectorAll(":scope [fcount]").forEach(frange => {
+        const fcount = frange.getAttribute("fcount");
+        frange.innerHTML = "F".repeat(frange.innerHTML.length);
+    });
+}
+
 function init()
 {
     hide_reruns = false; /* reruns are shown by default */
@@ -225,6 +243,9 @@ function init()
                 cb.patlines.push(patline);
                 test.patlines.push(patline);
                 if (cb.checked) test.linecount++;
+                const pattern = domline.querySelector("div.pattern");
+                pattern.addEventListener('mouseenter', showRangeCounts);
+                pattern.addEventListener('mouseleave', hideRangeCounts);
             }
         });
         if (test.linecount < test.patlines.length)
-- 
2.30.2




More information about the wine-devel mailing list