Skip to content

Commit

Permalink
Add unit tests for virtual fields
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Mar 27, 2015
1 parent c44285b commit 264c0ec
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/src/python/test_qgsvectorlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,24 @@ def test_setFeatureBlendMode( self ):
assert self.blendModeTest == QPainter.CompositionMode_Screen
assert layer.featureBlendMode() == QPainter.CompositionMode_Screen

def test_ExpressionField( self ):
layer = createLayerWithOnePoint()

cnt = layer.pendingFields().count()

idx = layer.addExpressionField( '5', QgsField( 'test', QVariant.LongLong ) )

assert( layer.getFeatures().next()[idx] == 5 )
assert( layer.pendingFields().count() == cnt + 1 )

layer.updateExpressionField( idx, '9' )

assert( layer.getFeatures().next()[idx] == 9 )

layer.removeExpressionField( idx )

assert( layer.pendingFields().count() == cnt )

def onLayerTransparencyChanged( self, tr ):
self.transparencyTest = tr

Expand Down

0 comments on commit 264c0ec

Please sign in to comment.