Skip to content

Commit 4c89a09

Browse files
committed
Improved RMS sorting
Signed-off-by: Conor MacBride <[email protected]>
1 parent d7e0190 commit 4c89a09

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

pytest_mpl/summary/html.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,13 @@ def card(name, item, warn_missing=None):
135135

136136
if status['image'] == 'match':
137137
rms = '&lt; tolerance'
138-
else:
138+
rms_sort = 999999
139+
elif status['image'] == 'diff':
139140
rms = item['rms']
141+
rms_sort = 99999 - item['rms']
142+
else:
143+
rms = 'None'
144+
rms_sort = 999998
140145

141146
offcanvas = RESULT_IMAGES.format(
142147

@@ -172,6 +177,7 @@ def card(name, item, warn_missing=None):
172177
test_name=test_name,
173178
module=module,
174179
status_sort=status_sort,
180+
rms_sort=rms_sort,
175181

176182
image=image,
177183
badge=badge,

pytest_mpl/summary/templates/extra.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
1313

1414
// Search, sort and filter
1515
var options = {
16-
valueNames: [ 'test-name', 'status-sort', 'rms', 'baseline-hash', 'result-hash' ]
16+
valueNames: [ 'test-name', 'status-sort', 'rms-sort', 'rms', 'baseline-hash', 'result-hash' ]
1717
};
1818
var userList = new List('results', options);
1919
userList.sort('status-sort');

pytest_mpl/summary/templates/filter.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ <h5>Sort tests by...</h5>
1010
<label class="btn btn-outline-secondary" for="sortstatus">status</label>
1111
<input type="radio" class="btn-check sort" data-sort="test-name" name="sort" id="sortname" autocomplete="off">
1212
<label class="btn btn-outline-secondary" for="sortname">name</label>
13-
<input type="radio" class="btn-check sort" data-sort="rms" name="sort" id="sortrms" autocomplete="off">
13+
<input type="radio" class="btn-check sort" data-sort="rms-sort" name="sort" id="sortrms" autocomplete="off">
1414
<label class="btn btn-outline-secondary" for="sortrms">RMS</label>
1515
</div>
1616
<h5>Show tests which have...</h5>

pytest_mpl/summary/templates/result.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<div class="py-2 col-sm-6 col-lg-4 col-xxl-3 result {classes}">
22
<span class="test-name" style="display:none">{module}.{test_name}</span>
33
<span class="status-sort" style="display:none">{status_sort}</span>
4+
<span class="rms-sort" style="display:none">{rms_sort}</span>
45
<div class="card">
56
<a class="btn" data-bs-toggle="offcanvas" href="#offcanvas{id}" role="button" aria-controls="offcanvas{id}">{image}</a>
67
{offcanvas}

0 commit comments

Comments
 (0)