Skip to content

Commit d4a5df2

Browse files
committedMay 30, 2018
More unit checks for project dirtying
1 parent 69b590b commit d4a5df2

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
 

‎tests/src/python/test_qgsproject.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,27 @@ def testPalPropertiesReadWrite(self):
10561056
self.assertEqual(candidates[1], 33)
10571057
self.assertEqual(candidates[2], 333)
10581058

1059+
def testLayerChangeDirtiesProject(self):
1060+
"""
1061+
Test that making changes to certain layer properties results in dirty projects
1062+
"""
1063+
p = QgsProject()
1064+
l = QgsVectorLayer(os.path.join(TEST_DATA_DIR, "points.shp"), "points", "ogr")
1065+
self.assertTrue(l.isValid())
1066+
self.assertTrue(p.addMapLayers([l]))
1067+
p.setDirty(False)
1068+
1069+
l.setCrs(QgsCoordinateReferenceSystem('EPSG:3111'))
1070+
self.assertTrue(p.isDirty())
1071+
p.setDirty(False)
1072+
1073+
l.setName('test')
1074+
self.assertTrue(p.isDirty())
1075+
p.setDirty(False)
1076+
1077+
self.assertTrue(l.setSubsetString('class=\'a\''))
1078+
self.assertTrue(p.isDirty())
1079+
10591080

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

0 commit comments

Comments
 (0)
Please sign in to comment.