Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed May 17, 2018
1 parent 2564cf3 commit ecbd207
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/src/python/test_qgsproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
QgsApplication,
QgsUnitTypes,
QgsCoordinateReferenceSystem,
QgsLabelingEngineSettings,
QgsVectorLayer,
QgsRasterLayer,
QgsMapLayer,
Expand Down Expand Up @@ -1033,6 +1034,28 @@ def testCustomLayerOrderFrom3xProject(self):
self.assertEqual(tree.customLayerOrder(), [layer_y, layer_x])
self.assertEqual(tree.layerOrder(), [layer_y, layer_x])

def testPalPropertiesReadWrite(self):
tmpDir = QTemporaryDir()
tmpFile = "{}/project.qgs".format(tmpDir.path())

s0 = QgsLabelingEngineSettings()
s0.setNumCandidatePositions(3, 33, 333)

p0 = QgsProject()
p0.setFileName(tmpFile)
p0.setLabelingEngineSettings(s0)
p0.write()

p1 = QgsProject()
p1.read(tmpFile)

s1 = p1.labelingEngineSettings()
candidates = s1.numCandidatePositions()

self.assertEqual(candidates[0], 3)
self.assertEqual(candidates[1], 33)
self.assertEqual(candidates[2], 333)


if __name__ == '__main__':
unittest.main()

0 comments on commit ecbd207

Please sign in to comment.