]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelAPI/Test/TestUndoRedo.py
Salome HOME
Some minor changes in tests. Now the initialization plugin performs correctly in...
[modules/shaper.git] / src / ModelAPI / Test / TestUndoRedo.py
1 from ModelAPI import *\r
2 aSession = ModelAPI_Session.get()\r
3 aDoc = aSession.moduleDocument()\r
4 assert(not aSession.canUndo())\r
5 assert(not aSession.canRedo())\r
6 \r
7 aSession.startOperation()\r
8 aFeature = aDoc.addFeature("Point")\r
9 # Since validators are introduced we have to initialize all\r
10 # the feature's attributes\r
11 aFeature.real("x").setValue(1.)\r
12 aFeature.real("y").setValue(-1.)\r
13 aFeature.real("z").setValue(0.)\r
14 aFeatureName = aFeature.name()\r
15 # "2" is because Origin is the first point\r
16 assert(aFeatureName == "Point_2")\r
17 \r
18 aFeature.execute()\r
19 aSession.finishOperation()\r
20 \r
21 assert(aDoc.size("Construction") == 8)\r
22 assert(aSession.canUndo())\r
23 assert(not aSession.canRedo())\r
24 \r
25 aSession.undo()\r
26 assert(aDoc.size("Construction") == 7)\r
27 assert(not aSession.canUndo())\r
28 assert(aSession.canRedo())\r
29 \r
30 aSession.redo()\r
31 assert(aDoc.size("Construction") == 8)\r
32 assert(aSession.canUndo())\r
33 assert(not aSession.canRedo())\r