Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Tests] Add QgsSymbolLayerUtils::decodeSldUom test
  • Loading branch information
rldhont authored and Gustry committed Jan 16, 2020
1 parent 4a982a8 commit 8cfe52e
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/src/python/test_qgssymbollayerutils.py
Expand Up @@ -14,7 +14,8 @@

from qgis.core import (QgsSymbolLayerUtils,
QgsMarkerSymbol,
QgsArrowSymbolLayer)
QgsArrowSymbolLayer,
QgsUnitTypes)
from qgis.PyQt.QtGui import QColor
from qgis.PyQt.QtCore import QSizeF, QPointF
from qgis.testing import unittest, start_app
Expand Down Expand Up @@ -210,6 +211,26 @@ def testSymbolToFromMimeData(self):
self.assertTrue(symbol2 is not None)
self.assertEqual(symbol2.color().name(), symbol.color().name())

def testDecodeSldUom(self):
"""
Test Decodes a SLD unit of measure string to a render unit
"""

# meter
decode = None
decode = QgsSymbolLayerUtils.decodeSldUom("http://www.opengeospatial.org/se/units/metre")
self.assertEqual(decode, (QgsUnitTypes.RenderMapUnits, 1000.0))

# foot
decode = None
decode = QgsSymbolLayerUtils.decodeSldUom("http://www.opengeospatial.org/se/units/foot")
self.assertEqual(decode, (QgsUnitTypes.RenderMapUnits, 304.8))

# pixel
decode = None
decode = QgsSymbolLayerUtils.decodeSldUom("http://www.opengeospatial.org/se/units/pixel")
self.assertEqual(decode, (QgsUnitTypes.RenderPixels, 1.0))


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

0 comments on commit 8cfe52e

Please sign in to comment.