mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Add unit test for changing appearance of style in a theme
This commit is contained in:
parent
40f3c8c3bd
commit
588a8fc9e9
@ -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() + '/'
|
||||
|
BIN
tests/testdata/control_images/mapcanvas/expected_theme4/expected_theme4.png
vendored
Normal file
BIN
tests/testdata/control_images/mapcanvas/expected_theme4/expected_theme4.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Loading…
x
Reference in New Issue
Block a user