diff options
Diffstat (limited to 'tests/test_pretty_print.py')
-rwxr-xr-x | tests/test_pretty_print.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/test_pretty_print.py b/tests/test_pretty_print.py index 54b0f92..3f4f1c9 100755 --- a/tests/test_pretty_print.py +++ b/tests/test_pretty_print.py @@ -312,14 +312,21 @@ TESTLOG def png_encode64( fname, width=250 ): # en.wikipedia.org/wiki/Data_URI_scheme - f = open( fname, "rb" ) - data = f.read() + try: + f = open( fname, "rb" ) + data = f.read() + except: + data = '' data_uri = data.encode("base64").replace("\n","") tag = '<img' + tag += ' style="border:1px solid gray"' tag += ' src="data:image/png;base64,' tag += data_uri + '"' tag += ' width="'+str(width)+'"' - tag += ' alt="openscad_test_image"' + if data =='': + tag += ' alt="error: no image generated"' + else: + tag += ' alt="openscad_test_image"' tag += ' />\n' return tag |