Skip to content
Permalink
Browse files

More unit checks for project dirtying

  • Loading branch information
nyalldawson committed May 30, 2018
1 parent 69b590b commit d4a5df2f2ce6de932a6c4bfbb6b8dd0f4560ea30
Showing with 21 additions and 0 deletions.
  1. +21 −0 tests/src/python/test_qgsproject.py
@@ -1056,6 +1056,27 @@ def testPalPropertiesReadWrite(self):
self.assertEqual(candidates[1], 33)
self.assertEqual(candidates[2], 333)

def testLayerChangeDirtiesProject(self):
"""
Test that making changes to certain layer properties results in dirty projects
"""
p = QgsProject()
l = QgsVectorLayer(os.path.join(TEST_DATA_DIR, "points.shp"), "points", "ogr")
self.assertTrue(l.isValid())
self.assertTrue(p.addMapLayers([l]))
p.setDirty(False)

l.setCrs(QgsCoordinateReferenceSystem('EPSG:3111'))
self.assertTrue(p.isDirty())
p.setDirty(False)

l.setName('test')
self.assertTrue(p.isDirty())
p.setDirty(False)

self.assertTrue(l.setSubsetString('class=\'a\''))
self.assertTrue(p.isDirty())


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

0 comments on commit d4a5df2

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