summaryrefslogtreecommitdiff
path: root/tools/tests/test_barcode_tools.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/tests/test_barcode_tools.py')
-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"]