Skip to content
Permalink
Browse files
Add tests for QgsSymbol flags
  • Loading branch information
nyalldawson committed May 26, 2021
1 parent bff6d5f commit faa8be243eebf1b3ee63d39891db558c09d8b33d
Showing with 23 additions and 1 deletion.
  1. +23 −1 tests/src/python/test_qgssymbol.py
@@ -55,7 +55,8 @@
QgsSymbolLayerUtils,
QgsMarkerLineSymbolLayer,
QgsArrowSymbolLayer,
QgsSymbol
QgsSymbol,
Qgis
)

from qgis.testing import unittest, start_app
@@ -168,6 +169,27 @@ def testSymbolTypeForGeometryType(self):
self.assertEqual(QgsSymbol.symbolTypeForGeometryType(QgsWkbTypes.NullGeometry), QgsSymbol.Hybrid)
self.assertEqual(QgsSymbol.symbolTypeForGeometryType(QgsWkbTypes.UnknownGeometry), QgsSymbol.Hybrid)

def testFlags(self):
"""
Test symbol flags
"""
s = QgsLineSymbol.createSimple({})
self.assertEqual(s.flags(), Qgis.SymbolFlags())

s.setFlags(Qgis.SymbolFlag.RendererShouldUseSymbolLevels)
self.assertEqual(s.flags(), Qgis.SymbolFlag.RendererShouldUseSymbolLevels)

s2 = s.clone()
self.assertEqual(s2.flags(), Qgis.SymbolFlag.RendererShouldUseSymbolLevels)

# test that flags are saved/restored via XML
doc = QDomDocument()
context = QgsReadWriteContext()
element = QgsSymbolLayerUtils.saveSymbol('test', s, doc, context)

s2 = QgsSymbolLayerUtils.loadSymbol(element, context)
self.assertEqual(s2.flags(), Qgis.SymbolFlag.RendererShouldUseSymbolLevels)

def testCanCauseArtifactsBetweenAdjacentTiles(self):
"""
Test canCauseArtifactsBetweenAdjacentTiles()

0 comments on commit faa8be2

Please sign in to comment.