|
7 | 7 | }
|
8 | 8 | body {
|
9 | 9 | padding: 4px;
|
| 10 | + font-family: sans-serif; |
10 | 11 | }
|
11 | 12 | figcaption {
|
12 | 13 | text-align: center;
|
13 | 14 | }
|
14 |
| - |
| 15 | + button { |
| 16 | + padding: 4px; |
| 17 | + margin: 2px 6px; |
| 18 | + } |
15 | 19 | .container {
|
16 | 20 | display: flex;
|
17 | 21 | flex-flow: column;
|
18 | 22 | }
|
| 23 | + .indent { |
| 24 | + margin-left: 32px; |
| 25 | + } |
19 | 26 | .line {
|
20 | 27 | border: 1px solid grey;
|
21 |
| - font-family: sans-serif; |
22 | 28 | font-size: 1em;
|
23 | 29 | padding: 6px 8px;
|
24 | 30 | display: flex;
|
25 | 31 | flex-flow: row;
|
26 | 32 | align-items: center;
|
27 | 33 | }
|
28 |
| - .browser { |
| 34 | + .browser > .line { |
29 | 35 | display: block;
|
30 | 36 | background: white;
|
31 | 37 | font-size: 1.25em;
|
32 | 38 | }
|
33 | 39 | .browser li {
|
34 | 40 | font-size: 0.8em;
|
35 | 41 | }
|
36 |
| - .test { |
37 |
| - margin-left: 32px; |
| 42 | + .test > .line { |
38 | 43 | font-size: 1.1em;
|
39 | 44 | }
|
40 |
| - .test.success { |
| 45 | + .test.pass > .line { |
41 | 46 | background: #98ff98;
|
42 | 47 | }
|
43 |
| - .test.fail { |
| 48 | + .test.fail > .line { |
44 | 49 | background: #ee0000;
|
45 | 50 | }
|
46 |
| - .spec { |
47 |
| - margin-left: 64px; |
48 |
| - } |
49 |
| - .spec.success { |
| 51 | + .spec.pass > .line { |
50 | 52 | background: #98ff9888;
|
51 | 53 | }
|
52 |
| - .spec.fail { |
| 54 | + .spec.fail > .line { |
53 | 55 | background: #ee000088;
|
54 | 56 | }
|
55 | 57 | .skip {
|
|
63 | 65 | padding: 4px;
|
64 | 66 | }
|
65 | 67 | .details {
|
66 |
| - margin-left: 96px; |
67 | 68 | padding: 8px;
|
68 | 69 | background: #eee;
|
69 | 70 | }
|
| 71 | + .skip > .details, .pass > .details { |
| 72 | + display: none; |
| 73 | + } |
| 74 | + .fail > .details { |
| 75 | + display: block; |
| 76 | + } |
70 | 77 | .imagediff {
|
71 | 78 | display: flex;
|
72 | 79 | flex-flow: row;
|
|
75 | 82 | margin-left: 8px;
|
76 | 83 | }
|
77 | 84 | .hidden {
|
78 |
| - display: none; |
| 85 | + display: none !important; |
| 86 | + } |
| 87 | + .show-block { |
| 88 | + display: block !important; |
79 | 89 | }
|
80 | 90 | #controls {
|
81 | 91 | padding: 8px;
|
82 | 92 | }
|
83 | 93 | </style>
|
84 | 94 | <script type="text/javascript">
|
85 |
| - let showPassing = false; |
86 |
| - |
87 |
| - function togglePassingVisible(forceFlag = undefined) { |
88 |
| - showPassing = forceFlag === undefined ? !showPassing : forceFlag; |
89 |
| - Array.from(document.querySelectorAll('.skip, .success')).forEach((el) => { |
90 |
| - if (showPassing) { |
91 |
| - el.classList.remove('hidden'); |
| 95 | + // addOrRemove: true to add, false to remove |
| 96 | + function toggleClasses(query, classes, addOrRemove) { |
| 97 | + Array.from(document.querySelectorAll(query)).forEach((el) => { |
| 98 | + if (addOrRemove) { |
| 99 | + classes.forEach((cls) => el.classList.add(cls)); |
92 | 100 | } else {
|
93 |
| - el.classList.add('hidden'); |
| 101 | + classes.forEach((cls) => el.classList.remove(cls)); |
94 | 102 | }
|
95 | 103 | });
|
96 |
| - document.getElementById('passingVisibleBtn').innerText = showPassing |
| 104 | + } |
| 105 | + |
| 106 | + let showSuccess = false; |
| 107 | + function toggleSuccess(forceFlag = undefined) { |
| 108 | + showSuccess = forceFlag === undefined ? !showSuccess : forceFlag; |
| 109 | + toggleClasses('.skip, .pass', ['hidden'], !showSuccess); |
| 110 | + document.getElementById('toggleSuccessBtn').innerText = showSuccess |
97 | 111 | ? 'hide passing tests'
|
98 | 112 | : 'show passing tests';
|
99 | 113 | }
|
100 | 114 |
|
| 115 | + let showImages = false; |
| 116 | + function toggleImages(forceFlag = undefined) { |
| 117 | + showImages = forceFlag === undefined ? !showImages : forceFlag; |
| 118 | + toggleClasses('.details.operator-imagediff', ['show-block'], showImages); |
| 119 | + document.getElementById('toggleImagesBtn').innerText = showImages |
| 120 | + ? 'hide passing image tests' |
| 121 | + : 'show all image tests'; |
| 122 | + } |
| 123 | + |
101 | 124 | window.onload = () => {
|
102 |
| - togglePassingVisible(true); |
| 125 | + toggleSuccess(true); |
| 126 | + toggleImages(false); |
103 | 127 | };
|
104 | 128 | </script>
|
105 | 129 | </head>
|
106 | 130 | <body>
|
107 | 131 | <h1>vtk.js Test Results</h1>
|
108 | 132 | <div id="controls">
|
109 |
| - <button id="passingVisibleBtn" onclick="togglePassingVisible()">loading</button> |
| 133 | + <button id="toggleSuccessBtn" onclick="toggleSuccess()">loading</button> |
| 134 | + <button id="toggleImagesBtn" onclick="toggleImages()">loading</button> |
110 | 135 | </div>
|
111 | 136 | {{#each browsers}}
|
112 |
| - <div class="line browser"> |
113 |
| - <div>{{name}}</div> |
114 |
| - <ul> |
115 |
| - <li>Failed: {{summary.failed}}</li> |
116 |
| - <li>Passed: {{summary.passed}}</li> |
117 |
| - <li>Skipped: {{summary.skipped}}</li> |
118 |
| - <li>Total: {{summary.total}}</li> |
119 |
| - </ul> |
120 |
| - </div> |
121 |
| - {{#each tests}} |
122 |
| - <div class="line test {{#if success}}success{{else}}fail{{/if}}"> |
| 137 | + <div class="browser"> |
| 138 | + <div class="line"> |
| 139 | + <div>{{name}}</div> |
| 140 | + <ul> |
| 141 | + <li>Failed: {{summary.failed}}</li> |
| 142 | + <li>Passed: {{summary.passed}}</li> |
| 143 | + <li>Skipped: {{summary.skipped}}</li> |
| 144 | + <li>Total: {{summary.total}}</li> |
| 145 | + </ul> |
| 146 | + </div> |
| 147 | + {{#each tests}} |
| 148 | + <div class="test indent {{#if success}}pass{{else}}fail{{/if}}"> |
| 149 | + <div class="line"> |
123 | 150 | {{name}}
|
124 | 151 | {{#if success}}
|
125 | 152 | <div class="ml-8 badge">passing</div>
|
126 | 153 | {{else}}
|
127 | 154 | <div class="ml-8 badge">failing</div>
|
128 | 155 | {{/if}}
|
129 | 156 | </div>
|
130 |
| - {{#each specs}} |
131 |
| - <div class="line spec {{#if skipped}}skip{{else if success}}success{{else}}fail{{/if}}"> |
132 |
| - <div>{{description}}</div> |
133 |
| - {{#if skipped}} |
134 |
| - <div class="ml-8 badge">skipped</div> |
135 |
| - {{else if success}} |
136 |
| - <div class="ml-8 badge">passing</div> |
137 |
| - {{else}} |
138 |
| - <div class="ml-8 badge">failing</div> |
139 |
| - {{/if}} |
140 |
| - </div> |
141 |
| - {{#unless success}} |
142 |
| - <div class="details"> |
143 |
| - {{#with details}} |
144 |
| - {{#if (equals operator "imagediff")}} |
145 |
| - {{! Image diff structure: see testUtils.compareImage }} |
146 |
| - <div>Mismatch count tolerance: {{expected}}%</div> |
147 |
| - <div class="imagediff"> |
148 |
| - <figure><img src="{{actual.outputImage}}"><figcaption>Output</figcaption></figure> |
149 |
| - <figure><img src="{{actual.expectedImage}}"><figcaption>Expected</figcaption></figure> |
150 |
| - <figure><img src="{{actual.diffImage}}"><figcaption>Difference</figcaption></figure> |
151 |
| - </div> |
| 157 | + {{#each specs}} |
| 158 | + <div class="spec indent {{#if skipped}}skip{{else if success}}pass{{else}}fail{{/if}}"> |
| 159 | + <div class="line"> |
| 160 | + <div>{{description}}</div> |
| 161 | + {{#if skipped}} |
| 162 | + <div class="ml-8 badge">skipped</div> |
| 163 | + {{else if success}} |
| 164 | + <div class="ml-8 badge">passing</div> |
152 | 165 | {{else}}
|
153 |
| - <div>Output: <code>{{details.actual}}</code></div> |
154 |
| - <div>Expected: <code>{{details.expected}}</code></div> |
| 166 | + <div class="ml-8 badge">failing</div> |
155 | 167 | {{/if}}
|
156 |
| - {{/with}} |
| 168 | + </div> |
| 169 | + {{#with details}} |
| 170 | + <div class="details operator-{{operator}}"> |
| 171 | + {{#if (equals operator "imagediff")}} |
| 172 | + {{! Image diff structure: see testUtils.compareImage }} |
| 173 | + <div>Mismatch count tolerance: {{expected}}%</div> |
| 174 | + <div class="imagediff"> |
| 175 | + <figure><img src="{{actual.outputImage}}"><figcaption>Output</figcaption></figure> |
| 176 | + <figure><img src="{{actual.expectedImage}}"><figcaption>Expected</figcaption></figure> |
| 177 | + <figure><img src="{{actual.diffImage}}"><figcaption>Difference</figcaption></figure> |
157 | 178 | </div>
|
158 |
| - {{/unless}} |
159 |
| - {{/each}} |
| 179 | + {{else}} |
| 180 | + <div>Output: <code>{{details.actual}}</code></div> |
| 181 | + <div>Expected: <code>{{details.expected}}</code></div> |
| 182 | + {{/if}} |
| 183 | + </div> |
| 184 | + {{/with}} |
| 185 | + </div> |
160 | 186 | {{/each}}
|
| 187 | + </div> |
| 188 | + {{/each}} |
| 189 | + </div> |
161 | 190 | {{/each}}
|
162 |
| - </body> |
| 191 | + </body> |
163 | 192 | </html>
|
0 commit comments