Add unit test for changing appearance of style in a theme

This commit is contained in:
Nyall Dawson 2017-03-09 14:20:51 +10:00
parent 40f3c8c3bd
commit 588a8fc9e9
2 changed files with 25 additions and 0 deletions

View File

@ -311,6 +311,31 @@ class TestQgsMapCanvas(unittest.TestCase):
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.

After

Width:  |  Height:  |  Size: 1.9 KiB