Salome HOME
Adjust unit tests to new behavior of SketchBuilder
[modules/shaper.git] / src / ModelAPI / Test / TestUndoRedo.py
index 1df119f97c26d77e4162708edad5e582ba9892e3..d4748a02d82c7fc82e8612dab5d89cb29f400edd 100644 (file)
@@ -1,33 +1,37 @@
-from ModelAPI import *\r
-aSession = ModelAPI_Session.get()\r
-aDoc = aSession.moduleDocument()\r
-assert(not aSession.canUndo())\r
-assert(not aSession.canRedo())\r
-\r
-aSession.startOperation()\r
-aFeature = aDoc.addFeature("Point")\r
-# Since validators are introduced we have to initialize all\r
-# the feature's attributes\r
-aFeature.real("x").setValue(1.)\r
-aFeature.real("y").setValue(-1.)\r
-aFeature.real("z").setValue(0.)\r
-aFeatureName = aFeature.name()\r
-# "2" is because Origin is the first point\r
-assert(aFeatureName == "Point_2")\r
-\r
-aFeature.execute()\r
-aSession.finishOperation()\r
-\r
-assert(aDoc.size("Construction") == 8)\r
-assert(aSession.canUndo())\r
-assert(not aSession.canRedo())\r
-\r
-aSession.undo()\r
-assert(aDoc.size("Construction") == 7)\r
-assert(not aSession.canUndo())\r
-assert(aSession.canRedo())\r
-\r
-aSession.redo()\r
-assert(aDoc.size("Construction") == 8)\r
-assert(aSession.canUndo())\r
-assert(not aSession.canRedo())\r
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDoc = aSession.moduleDocument()
+assert(not aSession.canUndo())
+assert(not aSession.canRedo())
+
+aSession.startOperation()
+aFeature = aDoc.addFeature("Point")
+# Since validators are introduced we have to initialize all
+# the feature's attributes
+# aFeature.string("creation_method").setValue("by_xyz")
+aFeature.real("x").setValue(1.)
+aFeature.real("y").setValue(-1.)
+aFeature.real("z").setValue(0.)
+aFeatureName = aFeature.name()
+# "2" is because Origin is the first point
+assert(aFeatureName == "Point_2")
+
+aFeature.execute()
+aSession.finishOperation()
+
+assert(aDoc.size("Construction") == 8)
+assert(aSession.canUndo())
+assert(not aSession.canRedo())
+
+aSession.undo()
+assert(aDoc.size("Construction") == 7)
+assert(not aSession.canUndo())
+assert(aSession.canRedo())
+
+aSession.redo()
+assert(aDoc.size("Construction") == 8)
+assert(aSession.canUndo())
+assert(not aSession.canRedo())
+
+from salome.shaper import model
+assert(model.checkPythonDump())