|
2 | 2 |
|
3 | 3 | """ |
4 | 4 | *************************************************************************** |
| 5 | +<<<<<<< b3e8d8219090068ba14a67004f9412633a6ec7b3 |
5 | 6 | test_qgssymbollayer_readsld.py |
| 7 | +======= |
| 8 | + test_qgssymbollayerv2_readsld.py |
| 9 | +>>>>>>> Tests and fix to read sld:Rotation when does not have ogc sub tags |
6 | 10 | --------------------- |
7 | 11 | Date : January 2017 |
8 | 12 | Copyright : (C) 2017, Jorge Gustavo Rocha |
@@ -87,5 +91,31 @@ def testLineOpacity(): |
87 | 91 | testLineWidth() |
88 | 92 | testLineOpacity() |
89 | 93 |
|
| 94 | + def testSimpleMarkerRotation(self): |
| 95 | + """ |
| 96 | + Test if pointMarker property sld:Rotation value can be read if rormat is: |
| 97 | + <sld:Rotation>50.0</sld:Rotation> |
| 98 | + or |
| 99 | + <se:Rotation><ogc:Literal>50</ogc:Literal></se:Rotation> |
| 100 | + """ |
| 101 | + # technically it's not necessary to use a real shape, but a empty memory |
| 102 | + # layer. In case these tests will upgrate to a rendering where to |
| 103 | + # compare also rendering no only properties |
| 104 | + #myShpFile = os.path.join(unitTestDataPath(), 'points.shp') |
| 105 | + #layer = QgsVectorLayer(myShpFile, 'points', 'ogr') |
| 106 | + layer = QgsVectorLayer("Point", "addfeat", "memory") |
| 107 | + assert(layer.isValid()) |
| 108 | + # test if able to read <sld:Rotation>50.0</sld:Rotation> |
| 109 | + mFilePath = os.path.join(unitTestDataPath(), 'symbol_layer/external_sld/testSimpleMarkerRotation-directValue.sld') |
| 110 | + layer.loadSldStyle(mFilePath) |
| 111 | + props = layer.renderer().symbol().symbolLayers()[0].properties() |
| 112 | + self.assertEqual(props['angle'], '50') |
| 113 | + # test if able to read <se:Rotation><ogc:Literal>50</ogc:Literal></se:Rotation> |
| 114 | + mFilePath = os.path.join(unitTestDataPath(), 'symbol_layer/external_sld/testSimpleMarkerRotation-ogcLiteral.sld') |
| 115 | + layer.loadSldStyle(mFilePath) |
| 116 | + props = layer.renderer().symbol().symbolLayers()[0].properties() |
| 117 | + self.assertEqual(props['angle'], '50') |
| 118 | + |
| 119 | + |
90 | 120 | if __name__ == '__main__': |
91 | 121 | unittest.main() |
0 commit comments