@@ -55,25 +55,29 @@ def tearDown(self):
55
55
def testRemoteSVG (self ):
56
56
"""Test fetching remote svg."""
57
57
url = 'http://localhost:{}/qgis_local_server/sample_svg.svg' .format (str (TestQgsSvgCache .port ))
58
- image , in_cache = QgsApplication .svgCache ().svgAsImage (url , 100 , fill = QColor (0 , 0 , 0 ), stroke = QColor (0 , 0 , 0 ), strokeWidth = 0.1 , widthScaleFactor = 1 )
58
+ image , in_cache = QgsApplication .svgCache ().svgAsImage (url , 100 , fill = QColor (0 , 0 , 0 ), stroke = QColor (0 , 0 , 0 ),
59
+ strokeWidth = 0.1 , widthScaleFactor = 1 )
59
60
self .assertTrue (self .imageCheck ('Remote SVG' , 'remote_svg' , image ))
60
61
61
62
def testRemoteSvgAsText (self ):
62
63
"""Test fetching remote svg with text mime format - e.g. github raw svgs"""
63
64
url = 'http://localhost:{}/qgis_local_server/svg_as_text.txt' .format (str (TestQgsSvgCache .port ))
64
- image , in_cache = QgsApplication .svgCache ().svgAsImage (url , 100 , fill = QColor (0 , 0 , 0 ), stroke = QColor (0 , 0 , 0 ), strokeWidth = 0.1 , widthScaleFactor = 1 )
65
+ image , in_cache = QgsApplication .svgCache ().svgAsImage (url , 100 , fill = QColor (0 , 0 , 0 ), stroke = QColor (0 , 0 , 0 ),
66
+ strokeWidth = 0.1 , widthScaleFactor = 1 )
65
67
self .assertTrue (self .imageCheck ('Remote SVG as Text' , 'remote_svg' , image ))
66
68
67
69
def testRemoteSvgBadMime (self ):
68
70
"""Test fetching remote svg with bad mime type"""
69
71
url = 'http://localhost:{}/qgis_local_server/logo.png' .format (str (TestQgsSvgCache .port ))
70
- image , in_cache = QgsApplication .svgCache ().svgAsImage (url , 100 , fill = QColor (0 , 0 , 0 ), stroke = QColor (0 , 0 , 0 ), strokeWidth = 0.1 , widthScaleFactor = 1 )
72
+ image , in_cache = QgsApplication .svgCache ().svgAsImage (url , 100 , fill = QColor (0 , 0 , 0 ), stroke = QColor (0 , 0 , 0 ),
73
+ strokeWidth = 0.1 , widthScaleFactor = 1 )
71
74
self .assertTrue (self .imageCheck ('Remote SVG bad MIME type' , 'bad_svg' , image ))
72
75
73
76
def testRemoteSvgMissing (self ):
74
77
"""Test fetching remote svg with bad url"""
75
78
url = 'http://localhost:{}/qgis_local_server/xxx.svg' .format (str (TestQgsSvgCache .port )) # oooo naughty
76
- image , in_cache = QgsApplication .svgCache ().svgAsImage (url , 100 , fill = QColor (0 , 0 , 0 ), stroke = QColor (0 , 0 , 0 ), strokeWidth = 0.1 , widthScaleFactor = 1 )
79
+ image , in_cache = QgsApplication .svgCache ().svgAsImage (url , 100 , fill = QColor (0 , 0 , 0 ), stroke = QColor (0 , 0 , 0 ),
80
+ strokeWidth = 0.1 , widthScaleFactor = 1 )
77
81
self .assertTrue (self .imageCheck ('Remote SVG missing' , 'bad_svg' , image ))
78
82
79
83
def imageCheck (self , name , reference_image , image ):
@@ -91,5 +95,6 @@ def imageCheck(self, name, reference_image, image):
91
95
print ((self .report ))
92
96
return result
93
97
98
+
94
99
if __name__ == '__main__' :
95
100
unittest .main ()
0 commit comments