Skip to content

Commit 588a8fc

Browse files
committedMar 12, 2017
Add unit test for changing appearance of style in a theme
1 parent 40f3c8c commit 588a8fc

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
 

‎tests/src/python/test_qgsmapcanvas.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,31 @@ def testMapTheme(self):
311311
app.processEvents()
312312
self.assertTrue(self.canvasImageCheck('theme3', 'theme3', canvas))
313313

314+
# change the appearance of an active style
315+
layer2.styleManager().addStyleFromLayer('style4')
316+
record3.currentStyle = 'style4'
317+
record3.usingCurrentStyle = True
318+
theme1.setLayerRecords([record3])
319+
QgsProject.instance().mapThemeCollection().update('theme1', theme1)
320+
321+
canvas.refresh()
322+
while not canvas.isDrawing():
323+
app.processEvents()
324+
while canvas.isDrawing():
325+
app.processEvents()
326+
self.assertTrue(self.canvasImageCheck('theme3', 'theme3', canvas))
327+
328+
layer2.styleManager().setCurrentStyle('style4')
329+
sym3 = QgsFillSymbol.createSimple({'color': '#b200b2'})
330+
layer2.renderer().setSymbol(sym3)
331+
canvas.refresh()
332+
333+
while not canvas.isDrawing():
334+
app.processEvents()
335+
while canvas.isDrawing():
336+
app.processEvents()
337+
self.assertTrue(self.canvasImageCheck('theme4', 'theme4', canvas))
338+
314339
def canvasImageCheck(self, name, reference_image, canvas):
315340
self.report += "<h2>Render {}</h2>\n".format(name)
316341
temp_dir = QDir.tempPath() + '/'
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.