Skip to content

Commit

Permalink
meta: Fix opening test results on Linux and adjust rendition size.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Nov 5, 2024
1 parent 6be1def commit 8a5c5ea
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions meta/plugins/reftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,19 @@ def getInfo(txt):
# generate temporary bmp
img_path = TEST_REPORT / f"{counter}.bmp"

xsize = props.get("size", "200")
ysize = xsize
if props.get("size") == "full":
xsize = "800"
ysize = "600"
paperMuncher.popen("render", "-sdlpo", img_path, input_path)
else:
size = props.get("size", "200")
paperMuncher.popen(
"render",
"--width",
size,
xsize,
"--height",
size,
ysize,
"-sdlpo",
img_path,
input_path,
Expand Down Expand Up @@ -225,22 +228,22 @@ def getInfo(txt):
<p>{help}</p>
<div class="outputs">
<div>
<img class="expected" src="{expected_image_url}" />
<figcaption>{'Expected' if (tag == 'rendering') else 'Unexpected'}</figcaption>
<img class="actual" src="{TEST_REPORT / f'{counter}.bmp'}" />
<figcaption>Actual</figcaption>
</div>
<div>
<img class="actual" src="{TEST_REPORT / f'{counter}.bmp'}" />
<figcaption>Actual</figcaption>
<img class="expected" src="{expected_image_url}" />
<figcaption>{'Reference' if (tag == 'rendering') else 'Unexpected'}</figcaption>
</div>
<div>
<iframe src="{input_path}" style="background-color: white; width: 200px; height: 200px;"></iframe>
<iframe src="{input_path}" style="background-color: white; width: {xsize}px; height: {ysize}px;"></iframe>
<figcaption>Rendition</figcaption>
</div>
</div>
<a href="{TEST_REPORT / f'{counter}.pdf'}">PDF</a>
<a href="{expected_image_url}">Expected</a>
<a href="{expected_image_url}">Reference</a>
<a href="{input_path}">Source</a>
</div>
<hr />
Expand Down Expand Up @@ -302,4 +305,8 @@ def getInfo(txt):
print(f"{vt100.GREEN}// {fetchMessage(args, 'nice')}{vt100.RESET}")
print(f"{vt100.GREEN}All tests passed{vt100.RESET}")
print(f"Report: {TEST_REPORT / 'report.html'}")
shell.exec("open", str(TEST_REPORT / "report.html"))

if shell.which("xdg-open"):
shell.exec("xdg-open", str(TEST_REPORT / "report.html"))
elif shell.which("open"):
shell.exec("open", str(TEST_REPORT / "report.html"))

0 comments on commit 8a5c5ea

Please sign in to comment.