|
26 | 26 | TESTPATH = os.path.join(PATH, 'tests') |
27 | 27 | HTMLFILE = os.path.join(TESTPATH, 'index.html') |
28 | 28 |
|
29 | | -HTML = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
30 | | - "http://www.w3.org/TR/html4/strict.dtd"> |
| 29 | +HTML = """<!DOCTYPE html> |
31 | 30 | <html> |
32 | 31 | <head> |
| 32 | + <meta charset="utf-8"> |
33 | 33 | <title>pyBarcode {version} Test</title> |
34 | | - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
35 | 34 | </head> |
36 | 35 | <body> |
37 | 36 | <h1>pyBarcode {version} Tests</h1> |
|
40 | 39 | </html> |
41 | 40 | """ |
42 | 41 |
|
43 | | -OBJECTS = ('<p><h2>{name}</h2><br />\n' |
44 | | - '<object data="{filename}" type="image/svg+xml">\n' |
45 | | - '<param name="src" value="{filename}" /></object>') |
| 42 | +OBJECTS = ('<p><h2>{name}</h2><br>\n' |
| 43 | + '<img src="{filename}" alt="SVG {name}">\n') |
46 | 44 |
|
47 | | -IMAGES = ('<h3>As PNG-Image</h3><br />\n' |
48 | | - '<img src="{filename}" alt="{name}" /></p>\n') |
| 45 | +IMAGES = ('<h3>As PNG-Image</h3><br>\n' |
| 46 | + '<img src="{filename}" alt="PNG {name}"></p>\n') |
49 | 47 |
|
50 | 48 | NO_PIL = '<h3>PIL was not found. No PNG-Image created.</h3></p>\n' |
51 | 49 |
|
@@ -82,20 +80,22 @@ def test(): |
82 | 80 | options['center_text'] = False |
83 | 81 | else: |
84 | 82 | options['center_text'] = True |
85 | | - filename = bcode.save(os.path.join(TESTPATH, codename), options) |
| 83 | + filename = bcode.save(os.path.join(TESTPATH, codename), |
| 84 | + options=options) |
86 | 85 | print('Code: {0}, Input: {1}, Output: {2}'.format( |
87 | 86 | bcode.name, code, bcode.get_fullcode())) |
88 | | - append(filename, bcode.name) |
| 87 | + append(os.path.basename(filename), bcode.name) |
89 | 88 | if ImageWriter is not None: |
90 | 89 | bcodec = get_barcode_class(codename) |
91 | 90 | bcode = bcodec(code, writer=ImageWriter()) |
92 | 91 | opts = dict(font_size=14, text_distance=1) |
93 | 92 | if codename.startswith('i'): |
94 | 93 | opts['center_text'] = False |
95 | 94 | else: |
96 | | - options['center_text'] = True |
97 | | - filename = bcode.save(os.path.join(TESTPATH, codename), opts) |
98 | | - append_img(filename, bcode.name) |
| 95 | + opts['center_text'] = True |
| 96 | + filename = bcode.save(os.path.join(TESTPATH, codename), |
| 97 | + options=opts) |
| 98 | + append_img(os.path.basename(filename), bcode.name) |
99 | 99 | else: |
100 | 100 | objects.append(NO_PIL) |
101 | 101 | # Save htmlfile with all objects |
|
0 commit comments