Skip to content

Commit

Permalink
add failing test demonstrating #47463
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeBardian authored and nyalldawson committed Jan 3, 2023
1 parent df527c0 commit 6f975a7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/src/python/test_qgsannotationlayer.py
Expand Up @@ -44,7 +44,8 @@
QgsAnnotationItemEditOperationMoveNode,
QgsVertexId,
QgsPointXY,
Qgis
Qgis,
QgsLayerNotesUtils
)
from qgis.testing import start_app, unittest

Expand Down Expand Up @@ -198,6 +199,9 @@ def testReadWriteXml(self):
self.assertTrue(layer.isValid())

layer.setCrs(QgsCoordinateReferenceSystem('EPSG:4326'))
layer.setScaleBasedVisibility(True)
QgsLayerNotesUtils.setLayerNotes(layer, 'test layer notes')

polygon_item_id = layer.addItem(QgsAnnotationPolygonItem(
QgsPolygon(QgsLineString([QgsPoint(12, 13), QgsPoint(14, 13), QgsPoint(14, 15), QgsPoint(12, 13)]))))
linestring_item_id = layer.addItem(
Expand All @@ -210,6 +214,8 @@ def testReadWriteXml(self):
layer2 = QgsAnnotationLayer('test2', QgsAnnotationLayer.LayerOptions(QgsProject.instance().transformContext()))
self.assertTrue(layer2.readLayerXml(elem, QgsReadWriteContext()))
self.assertEqual(layer2.crs().authid(), 'EPSG:4326')
self.assertTrue(layer2.hasScaleBasedVisibility())
self.assertEqual(QgsLayerNotesUtils.layerNotes(layer2), 'test layer notes')

self.assertEqual(len(layer2.items()), 3)
self.assertIsInstance(layer2.items()[polygon_item_id], QgsAnnotationPolygonItem)
Expand Down

0 comments on commit 6f975a7

Please sign in to comment.