Skip to content

Commit

Permalink
meta: Can add help message in test to add debugging information
Browse files Browse the repository at this point in the history
  • Loading branch information
Gorash committed Sep 23, 2024
1 parent e0c3e3f commit b6c7e26
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
8 changes: 8 additions & 0 deletions meta/plugins/reftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,18 @@ def update_temp_file(container, rendering):
# generate temporary file for debugging
output_pdf = paperMuncher.popen("print", "-sdlpo", test_tmp_folder / f"{temp_file_name}-{num}.pdf", temp_file)

help = None
if " help=" in info:
help = re.search(r""" help=['"]([^'"]*)['"]""", content).group(1)

if tag == "error":
print(f"{vt100.RED}Failed {name!r} (The result should be different){vt100.RESET}")
print(f"{vt100.WHITE}{expected_xhtml[1:].rstrip()}{vt100.RESET}")
print(f"{vt100.BLUE}{rendering[1:].rstrip()}{vt100.RESET}")
print(f"{vt100.BLUE}{test_tmp_folder / f'{temp_file_name}-{num}.pdf'}{vt100.RESET}")
print(f"{vt100.BLUE}{test_tmp_folder / f'{temp_file_name}-{num}.bmp'}{vt100.RESET}")
if help:
print(f"{vt100.BLUE}{help}{vt100.RESET}")
else:
print(f"{vt100.RED}Failed {name!r}{vt100.RESET}")
print(f"{vt100.WHITE}{expected_xhtml[1:].rstrip()}{vt100.RESET}")
Expand All @@ -104,6 +110,8 @@ def update_temp_file(container, rendering):
print(f"{vt100.BLUE}{rendering[1:].rstrip()}{vt100.RESET}")
print(f"{vt100.BLUE}{test_tmp_folder / f'{temp_file_name}-{num}.pdf'}{vt100.RESET}")
print(f"{vt100.BLUE}{test_tmp_folder / f'{temp_file_name}-{num}.bmp'}{vt100.RESET}")
if help:
print(f"{vt100.BLUE}{help}{vt100.RESET}")

# print rendering diff
output = output_pdf.split("---")[-3]
Expand Down
16 changes: 15 additions & 1 deletion tests/css/display-block.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@
<div class="w-100 green" style="position: absolute; top: 100px;"></div>
</div>
</rendering>

<rendering>
<div class="w-200" style="position: relative;">
<div class="w-100 green" style="position: absolute; top: 0; left: 100px;"></div>
<div class="w-100 red"></div>
</div>
</rendering>

<rendering>
<div class="w-200">
<div class="w-100 red" style="float: left;"></div>
<div class="w-100 green" style="float: left;"></div>
</div>
</rendering>
</test>

<test name="display: inline-block">
Expand Down Expand Up @@ -195,7 +209,7 @@
</div>
</rendering>

<error>
<error help="The green blox should be on the same line when the font-size is null">
<div class="w-200" style="line-height: 0; font-size: 0px;">
<div class="inline-block w-100 red"></div>
<div class="inline-block w-100 green"></div>
Expand Down
25 changes: 7 additions & 18 deletions tests/css/display-flex.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
<head>
<style>
div {
width: 100px;
width: 200px;
height: 100px;
}
div div {
width: 100px;
}
div.flex {
display: flex;
}
Expand All @@ -16,13 +19,6 @@
.green {
background-color: green;
}
div.block {
display: block;
}
div.block div {
width: 50%;
float: left;
}
</style>
</head>
<body>
Expand All @@ -32,19 +28,12 @@
</container>

<rendering>
<div class="block">
<div class="red"></div>
<div class="green"></div>
<div>
<div style="float: left;" class="red"></div>
<div style="float: left;" class="green"></div>
</div>
</rendering>

<error>
<div class="block">
<div style="float: none;" class="red"></div>
<div class="green"></div>
</div>
</error>

<rendering>
<div class="flex">
<div class="red"></div>
Expand Down

0 comments on commit b6c7e26

Please sign in to comment.