Skip to content

Commit

Permalink
fix waitforfinished layout legend test
Browse files Browse the repository at this point in the history
  • Loading branch information
troopa81 committed Oct 28, 2019
1 parent 3eca188 commit 7e192fc
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions tests/src/python/test_qgslayoutlegend.py
Expand Up @@ -396,10 +396,6 @@ def testSymbolExpressions(self):

counterTask = point_layer.countSymbolFeatures()
counterTask.waitForFinished()
TM = QgsApplication.taskManager()
actask = TM.activeTasks()
print(TM.tasks(), actask)
count = actask[0]
legend.model().refreshLayerLegend(legendlayer)
legendnodes = legend.model().layerLegendNodes(legendlayer)
legendnodes[0].setUserLabel('[% @symbol_id %]')
Expand All @@ -408,7 +404,6 @@ def testSymbolExpressions(self):
label1 = legendnodes[0].evaluateLabel()
label2 = legendnodes[1].evaluateLabel()
label3 = legendnodes[2].evaluateLabel()
count.waitForFinished()
self.assertEqual(label1, '0')
#self.assertEqual(label2, '5')
#self.assertEqual(label3, '12')
Expand Down Expand Up @@ -463,7 +458,7 @@ def testSymbolExpressionRender(self):
group = legend.model().rootGroup().addGroup("Group [% 1 + 5 %] [% @layout_name %]")
layer_tree_layer = group.addLayer(point_layer)
counterTask = point_layer.countSymbolFeatures()
counterTask.waitForFinished() # does this even work?
counterTask.waitForFinished()
layer_tree_layer.setCustomProperty("legend/title-label", 'bbbb [% 1+2 %] xx [% @layout_name %] [% @layer_name %]')
QgsMapLayerLegendUtils.setLegendNodeUserLabel(layer_tree_layer, 0, 'xxxx')
legend.model().refreshLayerLegend(layer_tree_layer)
Expand All @@ -475,11 +470,6 @@ def testSymbolExpressionRender(self):
legend.setLinkedMap(map)
legend.updateLegend()
print(layer_tree_layer.labelExpression())
TM = QgsApplication.taskManager()
actask = TM.activeTasks()
print(TM.tasks(), actask)
count = actask[0]
count.waitForFinished()
map.setExtent(QgsRectangle(-102.51, 41.16, -102.36, 41.30))
checker = QgsLayoutChecker(
'composer_legend_symbol_expression', layout)
Expand Down

0 comments on commit 7e192fc

Please sign in to comment.