mirror of
https://github.com/GNS3/gns3-gui.git
synced 2026-05-17 00:46:01 +03:00
@@ -53,7 +53,7 @@ class QImageSvgRenderer(QtSvg.QSvgRenderer):
|
||||
# We load the SVG with ElementTree before
|
||||
# because Qt when failing loading send noise to logs
|
||||
# and their is no way to prevent that
|
||||
if not path_or_data.startswith(":"):
|
||||
if not path_or_data.startswith(":") and os.path.exists(path_or_data):
|
||||
ET.parse(path_or_data)
|
||||
res = super().load(path_or_data)
|
||||
# If we can't render a SVG we load and base64 the image to create a SVG
|
||||
|
||||
@@ -29,3 +29,13 @@ def test_render_svg():
|
||||
def test_render_png():
|
||||
renderer = QImageSvgRenderer('resources/images/gns3_icon_256x256.png')
|
||||
assert renderer.isValid()
|
||||
|
||||
|
||||
def test_render_text_svg():
|
||||
renderer = QImageSvgRenderer('<svg></svg>')
|
||||
assert renderer.isValid()
|
||||
|
||||
|
||||
def test_render_text_broken_svg():
|
||||
renderer = QImageSvgRenderer('<svg></svg')
|
||||
assert renderer.isValid() is False
|
||||
|
||||
Reference in New Issue
Block a user