Skip to content
Permalink
Browse files

add unit test for setAuxiliaryLayer

  • Loading branch information
slarosa committed Mar 15, 2018
1 parent 8aa7b56 commit 24ef27d079c37364964a094c16bbbe3f301a987f
Showing with 20 additions and 0 deletions.
  1. +20 −0 tests/src/python/test_qgsauxiliarystorage.py
@@ -361,6 +361,26 @@ def testClear(self):
al.clear()
self.assertEqual(al.featureCount(), 0)

def testSetAuxiliaryLayer(self):
s = QgsAuxiliaryStorage()
self.assertTrue(s.isValid())

# Create a new auxiliary layer with 'pk' as key
vl = createLayer()
pkf = vl.fields().field(vl.fields().indexOf('pk'))
al = s.createAuxiliaryLayer(pkf, vl)
self.assertTrue(al.isValid())
vl.setAuxiliaryLayer(al)

self.assetFalse(vl.auxiliaryLayer(), None)

# Clear auxiliary layer
al.clear()
# Remove auxiliary layer
vl.setAuxiliaryLayer()

self.assetTrue(vl.auxiliaryLayer(), None)

def testCreateProperty(self):
s = QgsAuxiliaryStorage()
self.assertTrue(s.isValid())

0 comments on commit 24ef27d

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