aboutsummaryrefslogtreecommitdiff
path: root/tools/tests
diff options
context:
space:
mode:
authorcirakg <cirakg@cirakg.xyz>2026-10-20 12:16:59 +0200
committercirakg <cirakg@cirakg.xyz>2026-10-20 12:16:59 +0200
commit1ebc828f30698c1661055e17483e8d50a139ed45 (patch)
tree247763070cc90100b7cbb0cda12f0abbc38dce06 /tools/tests
parentdfb8e358c20cf1f5f5eae365feca78ce4aa4176d (diff)
test(codes): compare Aztec with aztec_code_generator, decode it and its screenshot
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tools/tests')
-rw-r--r--tools/tests/test_barcode_tools.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/tests/test_barcode_tools.py b/tools/tests/test_barcode_tools.py
index 5a2e999..f63b3fe 100644
--- a/tools/tests/test_barcode_tools.py
+++ b/tools/tests/test_barcode_tools.py
@@ -109,3 +109,11 @@ def test_pdf417_reference_rows() -> None:
reference = gen_code_vectors.pdf417_reference("Hello, World!", 3, 2)
assert reference is not None and reference[0] == 7 and reference[1] == 17 * (3 + 4) + 1
assert gen_code_vectors.pdf417_reference("ab", 30, 0) is None # one row: below the minimum of 3
+
+
+def test_aztec_reference_is_compact_for_short_text() -> None:
+ size, hexbits = gen_code_vectors.aztec_reference("HELLO WORLD", 1)
+ assert size == 15 # compact, one layer
+ assert len(bytes.fromhex(hexbits)) == (15 * 15 + 7) // 8
+ image = ref.render_matrix(bytes.fromhex(hexbits), (15, 15), 3, quiet=2)
+ assert ref.decode(image, ref.AZTEC) == ["HELLO WORLD"]