def test_transform(self): item = QgsAnnotationPointTextItem('my text', QgsPointXY(12, 13)) self.assertEqual(item.point().asWkt(), 'POINT(12 13)') self.assertEqual(item.applyEdit(QgsAnnotationItemEditOperationTranslateItem('', 100, 200)), Qgis.AnnotationItemEditOperationResult.Success) self.assertEqual(item.point().asWkt(), 'POINT(112 213)')
def test_apply_delete_node_edit(self): item = QgsAnnotationPointTextItem('my text', QgsPointXY(12, 13)) self.assertEqual(item.point().asWkt(), 'POINT(12 13)') self.assertEqual(item.applyEdit(QgsAnnotationItemEditOperationDeleteNode('', QgsVertexId(0, 0, 0), QgsPoint(12, 13))), Qgis.AnnotationItemEditOperationResult.ItemCleared)
def test_apply_add_node_edit(self): item = QgsAnnotationPointTextItem('my text', QgsPointXY(12, 13)) self.assertEqual(item.applyEdit(QgsAnnotationItemEditOperationAddNode('', QgsPoint(13, 14))), Qgis.AnnotationItemEditOperationResult.Invalid)
def test_apply_move_node_edit(self): item = QgsAnnotationPointTextItem('my text', QgsPointXY(12, 13)) self.assertEqual(item.point().asWkt(), 'POINT(12 13)') self.assertEqual(item.applyEdit(QgsAnnotationItemEditOperationMoveNode('', QgsVertexId(0, 0, 0), QgsPoint(14, 13), QgsPoint(17, 18))), Qgis.AnnotationItemEditOperationResult.Success) self.assertEqual(item.point().asWkt(), 'POINT(17 18)')