Skip to content

Commit 13a8bd4

Browse files
committedJun 8, 2017
Fix some PNG loading issues on Windows
Fix GNS3#2085
1 parent 802b80b commit 13a8bd4

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed
 

‎gns3/qt/qimage_svg_renderer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def load(self, path_or_data):
5353
# We load the SVG with ElementTree before
5454
# because Qt when failing loading send noise to logs
5555
# and their is no way to prevent that
56-
if not path_or_data.startswith(":"):
56+
if not path_or_data.startswith(":") and os.path.exists(path_or_data):
5757
ET.parse(path_or_data)
5858
res = super().load(path_or_data)
5959
# If we can't render a SVG we load and base64 the image to create a SVG

‎tests/qt/test_qimage_svg_renderer.py

+10
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,13 @@ def test_render_svg():
2929
def test_render_png():
3030
renderer = QImageSvgRenderer('resources/images/gns3_icon_256x256.png')
3131
assert renderer.isValid()
32+
33+
34+
def test_render_text_svg():
35+
renderer = QImageSvgRenderer('<svg></svg>')
36+
assert renderer.isValid()
37+
38+
39+
def test_render_text_broken_svg():
40+
renderer = QImageSvgRenderer('<svg></svg')
41+
assert renderer.isValid() is False

0 commit comments

Comments
 (0)
Please sign in to comment.