Skip to content
Permalink
Browse files

Add unit test

  • Loading branch information
pblottiere committed Mar 27, 2018
1 parent 58b3e20 commit 624e446b672a4e0bf4e3f0728f8dbc08872d0baa
Showing with 23 additions and 0 deletions.
  1. +23 −0 tests/src/python/test_qgsrulebasedrenderer.py
@@ -125,6 +125,29 @@ def testWillRenderFeature(self):
renderer.stopRender(ctx)
assert rendered == True

def testFeatureCount(self):
vl = self.mapsettings.layers()[0]
ft = vl.getFeature(2) # 'id' = 3 => ELSE
renderer = vl.renderer()

ctx = QgsRenderContext.fromMapSettings(self.mapsettings)
ctx.expressionContext().setFeature(ft)

counter = vl.countSymbolFeatures()
counter.waitForFinished()

renderer.startRender(ctx, vl.fields())

elseRule = None
for rule in renderer.rootRule().children():
if rule.filterExpression() == 'ELSE':
elseRule = rule

assert elseRule != None

cnt = counter.featureCount(elseRule.ruleKey())
assert cnt == 1

def testRefineWithCategories(self):
# Test refining rule with categories (refs #10815)

0 comments on commit 624e446

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