summaryrefslogtreecommitdiff
path: root/tools/tests/test_ui_flow.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/tests/test_ui_flow.py')
-rw-r--r--tools/tests/test_ui_flow.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/tests/test_ui_flow.py b/tools/tests/test_ui_flow.py
index d98b4c2..5e359c2 100644
--- a/tools/tests/test_ui_flow.py
+++ b/tools/tests/test_ui_flow.py
@@ -81,3 +81,13 @@ def test_barcodes_on_reads_a_drawn_code(tmp_path: Path) -> None:
screen = Image.open(path).convert("RGB")
assert ui_flow.barcodes_on(screen) == ["OTPW stress"]
assert ui_flow.barcodes_on(Image.new("RGB", (100, 100), "white")) == []
+
+
+def test_vertical_shift_measures_a_scrolled_list() -> None:
+ rows = Image.new("L", (60, 400), 0)
+ for top in range(0, 400, 50): # bands of different shades, like menu items
+ rows.paste(40 + top // 2, (5, top + 5, 55, top + 40))
+ before = rows.crop((0, 0, 60, 200))
+ assert ui_flow.vertical_shift(before, rows.crop((0, 37, 60, 237))) == 37
+ assert ui_flow.vertical_shift(rows.crop((0, 37, 60, 237)), before) == -37
+ assert ui_flow.vertical_shift(before, before) == 0