unit test: remove property while transaction is active and abort it later

This commit is contained in:
wmayer
2017-09-08 14:34:33 +02:00
parent 237a880705
commit 5a32fd5886

View File

@@ -965,6 +965,8 @@ class DocumentPlatformCases(unittest.TestCase):
def tearDown(self):
#closing doc
FreeCAD.closeDocument("PlatformTests")
class DocumentFileIncludeCases(unittest.TestCase):
def setUp(self):
self.Doc = FreeCAD.newDocument("FileIncludeTests")
@@ -1103,6 +1105,17 @@ class DocumentPropertyCases(unittest.TestCase):
FreeCAD.closeDocument("PropertyTests")
self.Doc = FreeCAD.open(tempFile)
def testRemoveProperty(self):
prop = 'Something'
self.Obj.addProperty('App::PropertyFloat', prop)
self.Obj.Something = 0.01
self.Doc.recompute()
self.Doc.openTransaction('modify and remove property')
self.Obj.Something = 0.00
self.Obj.removeProperty(prop)
self.Obj.recompute()
self.Doc.abortTransaction()
def tearDown(self):
#closing doc
FreeCAD.closeDocument("PropertyTests")