File: 0004-Fix-image-comparator-in-test-suite.patch

package info (click to toggle)
plastex 3.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,132 kB
  • sloc: python: 23,341; xml: 18,076; javascript: 7,755; ansic: 46; makefile: 40; sh: 26
file content (31 lines) | stat: -rw-r--r-- 1,374 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From: Stuart Prescott <stuart@debian.org>
Date: Tue, 12 Nov 2024 13:37:07 +1100
Subject: Fix image comparator in test suite

    - specify sizes for intermediate images being compared
---
 unittests/helpers/utils.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/unittests/helpers/utils.py b/unittests/helpers/utils.py
index c063770..e37ddd8 100644
--- a/unittests/helpers/utils.py
+++ b/unittests/helpers/utils.py
@@ -10,7 +10,7 @@ CACHE_LOCATION = Path(__file__).absolute().parent / "compare_cache"
 
 def cmp_img(a: str, b: str) -> float:
     out = subprocess.run(["compare", "-quiet", "-metric", "MSE",
-        '-subimage-search', a, b, "NULL:"],
+        '-subimage-search', '-resize', '200x200', a, b, "NULL:"],
         stderr=subprocess.PIPE, stdin=subprocess.DEVNULL, check=False)
 
     # return code 1 is for dissimilar images, but we use our own threshold
@@ -20,7 +20,7 @@ def cmp_img(a: str, b: str) -> float:
             def __init__(self, message):
                 self.message = message
         out = subprocess.run(["compare", "-verbose", "-metric", "MSE",
-            '-subimage-search', a, b, "NULL:"],
+            '-subimage-search', '-resize', '200x200', a, b, "NULL:"],
             stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.DEVNULL,
             check=False)
         print(out.stdout.decode())