Skip to content
Permalink
Browse files

[Tests] Add QgsSymbolLayerUtils::decodeSldUom test

  • Loading branch information
rldhont committed Jan 15, 2020
1 parent 680df96 commit 39ae955e4337482cda607d66d47f0957ba8c999d
Showing with 22 additions and 1 deletion.
  1. +22 −1 tests/src/python/test_qgssymbollayerutils.py
@@ -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
@@ -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 39ae955

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