From 1ebc828f30698c1661055e17483e8d50a139ed45 Mon Sep 17 00:00:00 2001 From: cirakg Date: Tue, 20 Oct 2026 12:16:59 +0200 Subject: test(codes): compare Aztec with aztec_code_generator, decode it and its screenshot Co-Authored-By: Claude Opus 5.5 --- tools/tests/test_barcode_tools.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tools/tests/test_barcode_tools.py') 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"] -- cgit v1.2.3