X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelAPI%2FTest%2FTestDocument.py;h=14bf232bb49471b50036ce6d386266be157335fc;hb=b6a827b5f2b1c61957dc2b22bfa11eba72175413;hp=e0f7da4be1b910f394de5d1502248c4733531652;hpb=f60865d3a392bb23530a2f59532c4701d318e0d6;p=modules%2Fshaper.git diff --git a/src/ModelAPI/Test/TestDocument.py b/src/ModelAPI/Test/TestDocument.py index e0f7da4be..14bf232bb 100644 --- a/src/ModelAPI/Test/TestDocument.py +++ b/src/ModelAPI/Test/TestDocument.py @@ -18,7 +18,7 @@ __updated__ = "2014-12-26" aSession = ModelAPI_Session.get() # TODO: enable this assertion: assert(aSession.moduleDocument()) -assert(aSession.moduleDocument().id() == "root") +assert(aSession.moduleDocument().id() == 0) assert(aSession.moduleDocument().kind() == "PartSet") assert(aSession.hasModuleDocument()) # Create a new document @@ -27,22 +27,22 @@ aSession.moduleDocument().addFeature("Part") aSession.finishOperation() assert(aSession.activeDocument()) -assert(aSession.activeDocument().id() == "Part_1") +assert(aSession.activeDocument().id() == 1) assert(aSession.activeDocument().kind() == "Part") # Activate root doc -aRootDoc = aSession.document("root") +aRootDoc = aSession.document(0) assert(aRootDoc) aSession.startOperation() aSession.setActiveDocument(aRootDoc, False) aSession.finishOperation() assert(aSession.activeDocument()) -assert(aSession.activeDocument().id() == "root") +assert(aSession.activeDocument().id() == 0) # check all opened docs allDocsList = aSession.allOpenedDocuments() assert(len(allDocsList) != 0) # Activate Part_1 doc back for further testing aSession.startOperation() -aSession.setActiveDocument(aSession.document("Part_1"), False) +aSession.setActiveDocument(aSession.document(1), False) aSession.finishOperation() #========================================================================= # Duplication of a document @@ -66,7 +66,7 @@ aPart.addFeature("Duplicate") aSession.finishOperation() assert(aSession.moduleDocument().size("Parts") == 2) aCopyOfPart = aSession.activeDocument() -assert(aCopyOfPart.id() == "Part_2") +assert(aCopyOfPart.id() == 2) assert(aCopyOfPart.kind() == "Part") assert(aCopyOfPart.size("Features") == 1) assert(aCopyOfPart != aPart) @@ -77,13 +77,14 @@ assert(aSession.moduleDocument().size("Parts") == 2) aSession.startOperation() 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) -aDoc1.addFeature("Remove") +aDoc2 = aSession.document(2) +aSession.setActiveDocument(aDoc2, False) +aDoc2.addFeature("Remove") aSession.finishOperation() assert(aSession.moduleDocument().size("Parts") == 0) assert(aSession.activeDocument())