Skip to content
Permalink
Browse files

Add unit tests for virtual fields

  • Loading branch information
m-kuhn committed Mar 27, 2015
1 parent c44285b commit 264c0ec32a8a89b3ede6d5e6545b9537eb926445
Showing with 18 additions and 0 deletions.
  1. +18 −0 tests/src/python/test_qgsvectorlayer.py
@@ -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

0 comments on commit 264c0ec

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