From 1d15a8d5dc2fb00d7c8f2b75c9318da46245f60f Mon Sep 17 00:00:00 2001 From: "Lou (loha)" Date: Wed, 20 Nov 2024 14:42:52 +0100 Subject: [PATCH] tests: Reftests - Add light mode, redesign it a bit. --- meta/plugins/reftest.py | 130 ++++++++++++++++++++++++++++++++++------ 1 file changed, 111 insertions(+), 19 deletions(-) diff --git a/meta/plugins/reftest.py b/meta/plugins/reftest.py index be543b2..69e4ad1 100644 --- a/meta/plugins/reftest.py +++ b/meta/plugins/reftest.py @@ -29,11 +29,11 @@ def fetchMessage(args: model.TargetArgs, type: str) -> str: def compareImages( - lhs: bytes, - rhs: bytes, - lowEpsilon: float = 0.05, - highEpsilon: float = 0.1, - strict=False, + lhs: bytes, + rhs: bytes, + lowEpsilon: float = 0.05, + highEpsilon: float = 0.1, + strict=False, ) -> bool: if strict: return lhs == rhs @@ -160,7 +160,7 @@ def getInfo(txt): expected_image_url = ref_image for tag, info, rendering in re.findall( - r"""<(rendering|error)([^>]*)>([\w\W]+?)""", test + r"""<(rendering|error)([^>]*)>([\w\W]+?)""", test ): renderingProps = getInfo(info) if "skip" in renderingProps: @@ -200,7 +200,7 @@ def getInfo(txt): if not expected_image: expected_image = output_image with (TEST_REPORT / f"{counter}.expected.bmp").open( - "wb" + "wb" ) as imageWriter: imageWriter.write(expected_image) continue @@ -232,6 +232,7 @@ def getInfo(txt): test_report += f"""
+

{counter} - {tag}

{help}

@@ -260,7 +261,7 @@ def getInfo(txt): if args.fast: break report += f""" -
+

{props.get('name')}

{props.get('help') or ""}

@@ -279,16 +280,46 @@ def getInfo(txt): report += """ +