diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:24:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:24:48 +0000 |
commit | cca66b9ec4e494c1d919bff0f71a820d8afab1fa (patch) | |
tree | 146f39ded1c938019e1ed42d30923c2ac9e86789 /share/extensions/tests/test_render_barcode_qrcode.py | |
parent | Initial commit. (diff) | |
download | inkscape-upstream.tar.xz inkscape-upstream.zip |
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'share/extensions/tests/test_render_barcode_qrcode.py')
-rw-r--r-- | share/extensions/tests/test_render_barcode_qrcode.py | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/share/extensions/tests/test_render_barcode_qrcode.py b/share/extensions/tests/test_render_barcode_qrcode.py new file mode 100644 index 0000000..2375891 --- /dev/null +++ b/share/extensions/tests/test_render_barcode_qrcode.py @@ -0,0 +1,101 @@ +# coding=utf-8 +from render_barcode_qrcode import QrCode, QRCode +from inkex.tester import ComparisonMixin, TestCase + + +class TestQRCodeInkscapeBasic(ComparisonMixin, TestCase): + """Test basic use of QR codes""" + + effect_class = QrCode + compare_file = "svg/empty.svg" + comparisons = [ + ( + "--text=0123456789", + "--typenumber=0", + "--modulesize=10", + "--drawtype=smooth", + "--smoothness=greedy", + ), + ( + "--text=BreadRolls", + "--typenumber=2", + "--encoding=utf8", + "--modulesize=10", + "--drawtype=smooth", + "--smoothness=greedy", + ), + ( + "--text=Blue Front Yard", + "--typenumber=3", + "--correctionlevel=1", + "--modulesize=10", + "--drawtype=smooth", + "--smoothness=greedy", + ), + ( + "--text=Waterfall", + "--typenumber=1", + "--drawtype=pathpreset", + "--pathtype=circle", + "--modulesize=10", + ), + ( + "--text=groupid", + "--groupid=testid", + "--modulesize=10", + "--drawtype=smooth", + "--smoothness=greedy", + ), + ] + + +class TestQRCodeInkscapeSelection(ComparisonMixin, TestCase): + """Test QR code with a selection as input""" + + effect_class = QrCode + compare_file = "svg/shapes.svg" + comparisons = [ + ("--text=test", "--drawtype=selection", "--id=r3", "--modulesize=10") + ] + + +class TestQRCodeInkscapeSymbol(ComparisonMixin, TestCase): + """Test symbols in qr codes""" + + effect_class = QrCode + compare_file = "svg/symbol.svg" + comparisons = [ + ( + "--text=ThingOne", + "--drawtype=symbol", + "--correctionlevel=2", + "--symbolid=AirTransportation_Inv", + "--modulesize=10", + ), + ] + + +class TestLargeQRCodes(ComparisonMixin, TestCase): + """Test large qr codes with up to 2953 bytes of payload. Also tests numeric mode""" + + effect_class = QrCode + compare_file = "svg/empty.svg" + comparisons = [ + # the largest numeric QR code has 7089 characters + ("--text=" + (("12345" * 2000)[0:7089]), "--qrmode=1", "--correctionlevel=1"), + ] + + +class TestQRCodeClasses(ComparisonMixin, TestCase): + """Test alphanumeric barcode""" + + effect_class = QrCode + compare_file = "svg/empty.svg" + comparisons = [ + ( + "--text=THIS IS A TEST OF AN ALPHANUMERIC QRCODE. IT CAN STORE A LARGER NUMBER OF " + "UPPERSPACE CHARACTERS THAN A BYTE-ENCODED QRCODE: 123", + "--qrmode=2", + "--correctionlevel=1", + ), + ] |