When some lines are omitted from a test pattern (either because they are reruns or the specific report was explicitly deselected), add a button to toggle showing / hiding them.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- winetest/build-patterns | 2 +- winetest/patterns.js | 80 +++++++++++++++++++++++++++++++++++++---- winetest/report.css | 4 +++ 3 files changed, 78 insertions(+), 8 deletions(-)
diff --git a/winetest/build-patterns b/winetest/build-patterns index 474fa1ffc..a11c3de10 100755 --- a/winetest/build-patterns +++ b/winetest/build-patterns @@ -1243,7 +1243,7 @@ sub write_patterns_list($$$$) my $tooltip = $list->{title} ? " title='$list->{title}'" : ""; $title = "<a href='tests/$testname.html'$tooltip>$testname</a>"; } - print $html "<div class='updownbar'>$title"; + print $html "<div class='updownbar'>$title <a class='expandtest'></a>"; print $html "<div class='ralign'>"; if ($mainpage) { diff --git a/winetest/patterns.js b/winetest/patterns.js index 4876113fa..be583a5f0 100644 --- a/winetest/patterns.js +++ b/winetest/patterns.js @@ -21,6 +21,47 @@ var hide_reruns; var groups; var cbs; +var tests; + +function enableExpandButton(test) +{ + test.domexpand.innerHTML = '[+]'; + test.domexpand.title = "Remove filters"; + test.domexpand.style.display = "inline-block"; +} + +function expandTest(test) +{ + test.patlines.forEach(patline => { + patline.dom.style.display = patline.display; + }); + test.domexpand.innerHTML = '[-]'; + test.domexpand.title = "Apply filters"; + test.domexpand.style.display = "inline-block"; + test.expanded = true; +} + +function reduceTest(test) +{ + test.patlines.forEach(patline => { + if (!patline.cb.checked) + patline.dom.style.display = 'none'; + }); + enableExpandButton(test); +} + +function toggleTest(e) +{ + const domtest = e.target.closest("div.testfile"); + const test = tests[domtest.id]; + if (test) + { + if (e.target.innerHTML == '[+]') + expandTest(test); + else + reduceTest(test); + } +}
function refreshPage(changes, rerun_checked) { @@ -49,6 +90,12 @@ function refreshPage(changes, rerun_checked) hide_reruns = rerun_checked; }
+ for (let key in tests) + { + if (tests[key].expanded) + reduceTest(tests[key]); + } + for (let key in changes) { const cb = cbs[key]; @@ -60,8 +107,11 @@ function refreshPage(changes, rerun_checked) cb.patlines.forEach(patline => { patline.dom.style.display = patline.display; const test = patline.test; - if (++test.linecount == 1 && test.id != "summary") + test.linecount++; + if (test.linecount == 1 && test.id != "summary") test.dom.style.display = test.display; + if (test.linecount == test.patlines.length) + test.domexpand.style.display = "none"; }); } else @@ -69,8 +119,11 @@ function refreshPage(changes, rerun_checked) cb.patlines.forEach(patline => { patline.dom.style.display = "none"; const test = patline.test; - if (--test.linecount == 0 && test.id != "summary") + test.linecount--; + if (test.linecount == 0 && test.id != "summary") test.dom.style.display = "none"; + if (test.linecount == test.patlines.length - 1) + enableExpandButton(test); }); }
@@ -138,24 +191,37 @@ function init() domcb.addEventListener('click', toggledReportCB); });
+ tests = {}; document.querySelectorAll("div.testfile").forEach(domtest => { + const domexpand = domtest.querySelector("a.expandtest"); + domexpand.addEventListener('click', toggleTest); + const test = { id: domtest.id, dom: domtest, display: domtest.style.display, - linecount: 0 + domexpand: domexpand, + patlines: [], + linecount: 0, + expanded: false }; + tests[domtest.id] = test;
domtest.querySelectorAll("div.patline").forEach(domline => { const cb = cbs[domline.getAttribute("data-id")]; if (cb) { - cb.patlines.push({ dom: domline, - display: domline.style.display, - test: test - }); + const patline = { dom: domline, + display: domline.style.display, + cb: cb, + test: test + }; + cb.patlines.push(patline); + test.patlines.push(patline); if (cb.checked) test.linecount++; } }); + if (test.linecount < test.patlines.length) + enableExpandButton(test); });
/* When reloading a page the browser may preserve the checkbox state diff --git a/winetest/report.css b/winetest/report.css index d42e05d8d..be49a0523 100644 --- a/winetest/report.css +++ b/winetest/report.css @@ -78,6 +78,10 @@ table.output td { .disabled { color: grey; } +.expandtest { + display: none; + font-family: monospace; +}
.pattern { display: inline-block;