1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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",
),
]
|