@@ -2203,6 +2203,79 @@ def testDrawTextDataDefinedBufferColorPoint(self):
2203
2203
format .buffer ().setSize (5 )
2204
2204
assert self .checkRenderPoint (format , 'text_dd_buffer_color' , None , text = ['test' ], point = QPointF (50 , 200 ))
2205
2205
2206
+ def testHtmlFormatting (self ):
2207
+ format = QgsTextFormat ()
2208
+ format .setFont (getTestFont ('bold' ))
2209
+ format .setSize (60 )
2210
+ format .setSizeUnit (QgsUnitTypes .RenderPoints )
2211
+ format .setColor (QColor (0 , 255 , 0 ))
2212
+ format .setAllowHtmlFormatting (True )
2213
+ assert self .checkRenderPoint (format , 'text_html_formatting' , None , text = ['<s>t</s><span style="text-decoration: overline">e</span><span style="color: red">s<span style="text-decoration: underline">t</span></span>' ], point = QPointF (50 , 200 ))
2214
+
2215
+ def testHtmlFormattingBuffer (self ):
2216
+ format = QgsTextFormat ()
2217
+ format .setFont (getTestFont ('bold' ))
2218
+ format .setSize (60 )
2219
+ format .setSizeUnit (QgsUnitTypes .RenderPoints )
2220
+ format .setColor (QColor (0 , 255 , 0 ))
2221
+ format .setAllowHtmlFormatting (True )
2222
+ format .buffer ().setEnabled (True )
2223
+ format .buffer ().setSize (5 )
2224
+ format .buffer ().setColor (QColor (50 , 150 , 200 ))
2225
+ assert self .checkRenderPoint (format , 'text_html_formatting_buffer' , None , text = ['<s>t</s><span style="text-decoration: overline">e</span><span style="color: red">s<span style="text-decoration: underline">t</span></span>' ], point = QPointF (50 , 200 ))
2226
+
2227
+ def testHtmlFormattingShadow (self ):
2228
+ format = QgsTextFormat ()
2229
+ format .setFont (getTestFont ('bold' ))
2230
+ format .setSize (60 )
2231
+ format .setSizeUnit (QgsUnitTypes .RenderPoints )
2232
+ format .setColor (QColor (0 , 255 , 0 ))
2233
+ format .setAllowHtmlFormatting (True )
2234
+ format .shadow ().setEnabled (True )
2235
+ format .shadow ().setOffsetDistance (5 )
2236
+ format .shadow ().setBlurRadius (0 )
2237
+ format .shadow ().setColor (QColor (50 , 150 , 200 ))
2238
+ assert self .checkRenderPoint (format , 'text_html_formatting_shadow' , None , text = ['<s>t</s><span style="text-decoration: overline">e</span><span style="color: red">s<span style="text-decoration: underline">t</span></span>' ], point = QPointF (50 , 200 ))
2239
+
2240
+ def testHtmlFormattingBufferShadow (self ):
2241
+ format = QgsTextFormat ()
2242
+ format .setFont (getTestFont ('bold' ))
2243
+ format .setSize (60 )
2244
+ format .setSizeUnit (QgsUnitTypes .RenderPoints )
2245
+ format .setColor (QColor (0 , 255 , 0 ))
2246
+ format .setAllowHtmlFormatting (True )
2247
+ format .buffer ().setEnabled (True )
2248
+ format .buffer ().setSize (5 )
2249
+ format .buffer ().setColor (QColor (200 , 50 , 150 ))
2250
+ format .shadow ().setEnabled (True )
2251
+ format .shadow ().setOffsetDistance (5 )
2252
+ format .shadow ().setBlurRadius (0 )
2253
+ format .shadow ().setColor (QColor (50 , 150 , 200 ))
2254
+ assert self .checkRenderPoint (format , 'text_html_formatting_buffer_shadow' , None , text = ['<s>t</s><span style="text-decoration: overline">e</span><span style="color: red">s<span style="text-decoration: underline">t</span></span>' ], point = QPointF (50 , 200 ))
2255
+
2256
+ def testHtmlFormattingVertical (self ):
2257
+ format = QgsTextFormat ()
2258
+ format .setFont (getTestFont ('bold' ))
2259
+ format .setSize (30 )
2260
+ format .setSizeUnit (QgsUnitTypes .RenderPoints )
2261
+ format .setColor (QColor (0 , 255 , 0 ))
2262
+ format .setAllowHtmlFormatting (True )
2263
+ format .setOrientation (QgsTextFormat .VerticalOrientation )
2264
+ assert self .checkRenderPoint (format , 'text_html_formatting_vertical' , None , text = ['<s>t</s><span style="text-decoration: overline">e</span><span style="color: red">s<span style="text-decoration: underline">t</span></span>' ], point = QPointF (50 , 200 ))
2265
+
2266
+ def testHtmlFormattingBufferVertical (self ):
2267
+ format = QgsTextFormat ()
2268
+ format .setFont (getTestFont ('bold' ))
2269
+ format .setSize (30 )
2270
+ format .setSizeUnit (QgsUnitTypes .RenderPoints )
2271
+ format .setColor (QColor (0 , 255 , 0 ))
2272
+ format .setAllowHtmlFormatting (True )
2273
+ format .buffer ().setEnabled (True )
2274
+ format .buffer ().setSize (5 )
2275
+ format .buffer ().setColor (QColor (50 , 150 , 200 ))
2276
+ format .setOrientation (QgsTextFormat .VerticalOrientation )
2277
+ assert self .checkRenderPoint (format , 'text_html_formatting_buffer_vertical' , None , text = ['<s>t</s><span style="text-decoration: overline">e</span><span style="color: red">s<span style="text-decoration: underline">t</span></span>' ], point = QPointF (50 , 200 ))
2278
+
2206
2279
def testTextRenderFormat (self ):
2207
2280
format = QgsTextFormat ()
2208
2281
format .setFont (getTestFont ('bold' ))
0 commit comments