Salome HOME
Added the removeLast method into AttributeRefList
[modules/shaper.git] / src / ModelAPI / Test / TestDocument.py
index d3693974e5f2abb6e856b9eeff5cf3ad7b59a549..8080f3654ae3efc4ecf84c8842cdb5ccdae38728 100644 (file)
@@ -62,7 +62,7 @@ assert(aPart.size("Features") == 1)
 # Duplicate the document
 assert(aSession.moduleDocument().size("Parts") == 1)
 aSession.startOperation()
-aSession.moduleDocument().addFeature("Duplicate")
+aPart.addFeature("Duplicate")
 aSession.finishOperation()
 assert(aSession.moduleDocument().size("Parts") == 2)
 aCopyOfPart = aSession.activeDocument()
@@ -75,31 +75,16 @@ assert(aCopyOfPart != aPart)
 #=========================================================================
 assert(aSession.moduleDocument().size("Parts") == 2)
 aSession.startOperation()
-aSession.moduleDocument().addFeature("Remove")
+aPart.addFeature("Remove")
 aSession.finishOperation()
+# First part is deleted, but active is Part_2, so, it is still active
 assert(aSession.moduleDocument().size("Parts") == 1)
-assert(aSession.activeDocument().id() == aSession.moduleDocument().id())
+assert(aSession.activeDocument().id() == aCopyOfPart.id())
 # Remove another one document
 aSession.startOperation()
-aDoc1 = aSession.document("Part_1")
-aSession.setActiveDocument(aDoc1, False)
-aSession.moduleDocument().addFeature("Remove")
+aDoc2 = aSession.document("Part_2")
+aSession.setActiveDocument(aDoc2, False)
+aDoc2.addFeature("Remove")
 aSession.finishOperation()
 assert(aSession.moduleDocument().size("Parts") == 0)
 assert(aSession.activeDocument())
-#=========================================================================
-# Trying to duplicate/remove the root
-#=========================================================================
-aSession.startOperation()
-aSession.moduleDocument().addFeature("Duplicate")
-aSession.finishOperation()
-assert(aSession.activeDocument().id() == aSession.moduleDocument().id())
-assert(aSession.moduleDocument().size("Parts") == 0)
-aSession.startOperation()
-aSession.moduleDocument().addFeature("Remove")
-aSession.finishOperation()
-assert(aSession.activeDocument().id() == aSession.moduleDocument().id())
-assert(aSession.moduleDocument().size("Parts") == 0)
-#=========================================================================
-# End of test
-#=========================================================================