new design for rendertest #8

Merged
provod merged 28 commits from NightFox/HLRTest:master into master 2024-02-15 23:35:42 +01:00
2 changed files with 62 additions and 10 deletions
Showing only changes of commit f1885f49ec - Show all commits

View File

@ -244,6 +244,7 @@ body.min { /* split feature */
#fail_images.padding .meta-block { #fail_images.padding .meta-block {
/*margin-block: 100vh;*/ /*margin-block: 100vh;*/
padding-top: calc(var(--height-image)); padding-top: calc(var(--height-image));
padding-bottom: 2px;
/*padding-bottom: calc(50% - var(--height-image) );*/ /*padding-bottom: calc(50% - var(--height-image) );*/
} }
#fail_images.padding .meta-block h2, .meta-block:first-child h2 { #fail_images.padding .meta-block h2, .meta-block:first-child h2 {
@ -327,3 +328,16 @@ details[open] summary:before {
content: "📂\FE0F "; content: "📂\FE0F ";
} }
.red {
color: #f53200;
color: oklch(62.8% 0.25768330773615683 32.82);
}
.yellow {
color: #d3a100;
color: oklch(76.67% 0.17685825418032033 90.53);
}
.green {
color: #6b9a00;
color: oklch(62.8% 0.25768330773615683 128.19);
}

View File

@ -19,6 +19,48 @@ function sectionLink(value, d) {
return [a]; return [a];
} }
function channelWithEmoji(value) {
const replacements = {
"full": "🖼",
"basecolor": "🎨",
"emissive": "☢",
"nshade": "🥬", //🏔
"ngeom": "🥒", //⛰
"lighting": "☀",//🗿
"direct": "🎇",
"direct_diffuse": "🎇🎆",
"direct_specular": "🎇💎",
"diffuse": "🎆",
"specular": "💎",
"material": "🖌",
"indirect": "🥏",//🏀🏓🥏
"indirect_specular": "🥏💎",
"indirect_diffuse": "🥏🎆"
}
const emoji = replacements[value];
if (emoji) {
return [Tag('span', {}, `${emoji}\uFE0F ${value}`)];
} else {
return [];
}
}
function colorPct(value) {
let css_class = "";
if (value < 1) {
css_class = "green";
} else
if (value < 5) {
css_class = "yellow";
} else {
css_class = "red";
}
return [Tag("span", {"class": css_class}, value.toFixed(3))];
}
function isPassed(value) {
return [Tag("span", {"class": "emoji"}, value ? "❌" : "✅")];
}
function makeTable(fields, data, attrs_func) { function makeTable(fields, data, attrs_func) {
const table = Tag('table', null, null, [ const table = Tag('table', null, null, [
Tag('tr', null, null, (() => { Tag('tr', null, null, (() => {
@ -30,6 +72,7 @@ function makeTable(fields, data, attrs_func) {
})()), })()),
]); ]);
for (const di in data) { for (const di in data) {
let d = data[di]; let d = data[di];
const attrs = attrs_func ? attrs_func(d) : null; const attrs = attrs_func ? attrs_func(d) : null;
@ -42,11 +85,6 @@ function makeTable(fields, data, attrs_func) {
continue; continue;
} }
// TODO: remove ugly hack
if (f.field == "fail") {
value = value ? "❌" : "✅";
}
const field_func = f.tags_func ? f.tags_func : fieldFuncDefault; const field_func = f.tags_func ? f.tags_func : fieldFuncDefault;
const tags = field_func(value, d); const tags = field_func(value, d);
@ -71,9 +109,9 @@ function makeTable(fields, data, attrs_func) {
function buildTestResultsTable(data) { function buildTestResultsTable(data) {
const fields = [ const fields = [
{label: 'Test', field: 'test', tags_func: sectionLink}, {label: 'Test', field: 'test', tags_func: sectionLink},
{label: 'Channel', field: 'channel', }, {label: 'Channel', field: 'channel', tags_func: channelWithEmoji},
{label: 'Δ, %', field: 'diff_pct', }, {label: 'Δ, %', field: 'diff_pct', tags_func: colorPct},
{label: 'Failed', field: 'fail', }, {label: 'Passed', field: 'fail', tags_func: isPassed},
]; ];
return [makeTable(fields, data, rowAttribs)]; return [makeTable(fields, data, rowAttribs)];
@ -126,7 +164,7 @@ function buildData(table, images, data, sort) {
diffElement.classList.toggle("show_diff"); diffElement.classList.toggle("show_diff");
}); });
}; };
for (let tr of document.querySelectorAll("table tr")) { for (let tr of document.querySelectorAll("table tr")) {
tr.addEventListener("click", function() { tr.addEventListener("click", function() {
this.querySelector("a").click(); this.querySelector("a").click();
@ -202,7 +240,7 @@ window.onload = () => {
const tableSort = !!loadFromLocalStorage("rendertest_tablesort"); const tableSort = !!loadFromLocalStorage("rendertest_tablesort");
const sidebarPos = loadFromLocalStorage("rendertest_sidebarpos"); const sidebarPos = loadFromLocalStorage("rendertest_sidebarpos");
function uglyChecked(value) { // fast hack function uglyChecked(value) { // fast hack
return value ? {"checked": "checked"} : {}; return value ? {"checked": "checked"} : {};
} }