X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelAPI%2FTest%2FTestUndoRedo.py;h=d4748a02d82c7fc82e8612dab5d89cb29f400edd;hb=117bb273f57f265f131624287d2d15d7e396d226;hp=3981f30d4f257df0c4604ce52f1cdb38ceefd727;hpb=d34842c50d5f335cca443c78910c16c54139c7d0;p=modules%2Fshaper.git diff --git a/src/ModelAPI/Test/TestUndoRedo.py b/src/ModelAPI/Test/TestUndoRedo.py index 3981f30d4..d4748a02d 100644 --- a/src/ModelAPI/Test/TestUndoRedo.py +++ b/src/ModelAPI/Test/TestUndoRedo.py @@ -1,37 +1,37 @@ -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()) - -import model -assert(model.checkPythonDump()) +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())