Skip to content
Permalink
Browse files

Add unit test for changing appearance of style in a theme

  • Loading branch information
nyalldawson committed Mar 12, 2017
1 parent 40f3c8c commit 588a8fc9e914e06c494d08f2ca8b3834319d727a
@@ -311,6 +311,31 @@ def testMapTheme(self):
app.processEvents()
self.assertTrue(self.canvasImageCheck('theme3', 'theme3', canvas))

# change the appearance of an active style
layer2.styleManager().addStyleFromLayer('style4')
record3.currentStyle = 'style4'
record3.usingCurrentStyle = True
theme1.setLayerRecords([record3])
QgsProject.instance().mapThemeCollection().update('theme1', theme1)

canvas.refresh()
while not canvas.isDrawing():
app.processEvents()
while canvas.isDrawing():
app.processEvents()
self.assertTrue(self.canvasImageCheck('theme3', 'theme3', canvas))

layer2.styleManager().setCurrentStyle('style4')
sym3 = QgsFillSymbol.createSimple({'color': '#b200b2'})
layer2.renderer().setSymbol(sym3)
canvas.refresh()

while not canvas.isDrawing():
app.processEvents()
while canvas.isDrawing():
app.processEvents()
self.assertTrue(self.canvasImageCheck('theme4', 'theme4', canvas))

def canvasImageCheck(self, name, reference_image, canvas):
self.report += "<h2>Render {}</h2>\n".format(name)
temp_dir = QDir.tempPath() + '/'
Binary file not shown.

0 comments on commit 588a8fc

Please sign in to comment.
You can’t perform that action at this time.