Skip to content

Commit

Permalink
Add unit test for changing appearance of style in a theme
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 12, 2017
1 parent 40f3c8c commit 588a8fc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/src/python/test_qgsmapcanvas.py
Expand Up @@ -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() + '/'
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 588a8fc

Please sign in to comment.