Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Mar 27, 2018
1 parent 58b3e20 commit 624e446
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/src/python/test_qgsrulebasedrenderer.py
Expand Up @@ -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)

Expand Down

0 comments on commit 624e446

Please sign in to comment.