Skip to content

Commit

Permalink
add unit test for setAuxiliaryLayer
Browse files Browse the repository at this point in the history
  • Loading branch information
slarosa committed Mar 15, 2018
1 parent 8aa7b56 commit 24ef27d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/src/python/test_qgsauxiliarystorage.py
Expand Up @@ -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())
Expand Down

0 comments on commit 24ef27d

Please sign in to comment.