From dca8d30ae0effd8a447f756dc05e1d9a8aa33688 Mon Sep 17 00:00:00 2001 From: azv Date: Sat, 3 Nov 2018 13:56:29 +0300 Subject: [PATCH] Update unit tests for CollectionPlugin module --- src/CollectionPlugin/Test/TestField.py | 12 ++++---- src/CollectionPlugin/Test/TestGroup.py | 34 ++++++++++----------- src/CollectionPlugin/Test/TestGroup1799.py | 12 ++++---- src/CollectionPlugin/Test/TestGroupMove.py | 4 +-- src/CollectionPlugin/Test/TestGroupMove2.py | 4 +-- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/CollectionPlugin/Test/TestField.py b/src/CollectionPlugin/Test/TestField.py index e6cdc133b..de927057b 100644 --- a/src/CollectionPlugin/Test/TestField.py +++ b/src/CollectionPlugin/Test/TestField.py @@ -92,9 +92,9 @@ aSession.startOperation() aField = aSession.activeDocument().addFeature("Field") aSelectionListAttr = aField.selectionList("selected") aSelectionListAttr.setSelectionType("vertex") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1_1") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]") aComponentNames = aField.stringArray("components_names") aComponentNames.setSize(2) # two components aComponentNames.setValue(0, "temperatue") @@ -121,7 +121,7 @@ aSession.startOperation() aField = aSession.activeDocument().addFeature("Field") aSelectionListAttr = aField.selectionList("selected") aSelectionListAttr.setSelectionType("face") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1") aComponentNames = aField.stringArray("components_names") aComponentNames.setSize(1) # one component aComponentNames.setValue(0, "description") @@ -147,7 +147,7 @@ aSession.startOperation() aField = aSession.activeDocument().addFeature("Field") aSelectionListAttr = aField.selectionList("selected") aSelectionListAttr.setSelectionType("face") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1") aComponentNames = aField.stringArray("components_names") aComponentNames.setSize(1) # one component aComponentNames.setValue(0, "description") @@ -171,7 +171,7 @@ aSession.startOperation() aField = aSession.activeDocument().addFeature("Field") aSelectionListAttr = aField.selectionList("selected") aSelectionListAttr.setSelectionType("face") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1") aComponentNames = aField.stringArray("components_names") aComponentNames.setSize(1) # one component aComponentNames.setValue(0, "description") diff --git a/src/CollectionPlugin/Test/TestGroup.py b/src/CollectionPlugin/Test/TestGroup.py index 2892bbabd..cab94e102 100644 --- a/src/CollectionPlugin/Test/TestGroup.py +++ b/src/CollectionPlugin/Test/TestGroup.py @@ -90,12 +90,12 @@ aSession.startOperation() aGroupFeature = aSession.activeDocument().addFeature("Group") aSelectionListAttr = aGroupFeature.selectionList("group_list") aSelectionListAttr.setSelectionType("vertex") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1_1") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1_1") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1_1") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1_1") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]") aSession.finishOperation() #========================================================================= # Check results @@ -110,15 +110,15 @@ aSession.startOperation() aGroupFeature = aSession.activeDocument().addFeature("Group") aSelectionListAttr = aGroupFeature.selectionList("group_list") aSelectionListAttr.setSelectionType("edge") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1_1") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1_1") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1_1") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1_1") -aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1_1") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2]") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]") +aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]") aSession.finishOperation() #========================================================================= # Check results @@ -167,7 +167,7 @@ aSession.startOperation() aGroupFeature = aSession.activeDocument().addFeature("Group") aSelectionListAttr = aGroupFeature.selectionList("group_list") aSelectionListAttr.setSelectionType("face") -aSelectionListAttr.append("Extrusion_1_1/To_Face_1_1") +aSelectionListAttr.append("Extrusion_1_1/To_Face") aSession.finishOperation() #========================================================================= # Check results @@ -199,7 +199,7 @@ aSession.finishOperation() #========================================================================= # Build shape from sketcher results aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult()) -assert(aCircleSketchResult.numFaces() > 0) +assert(aCircleSketchResult.facesNum() > 0) # Create extrusion aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") diff --git a/src/CollectionPlugin/Test/TestGroup1799.py b/src/CollectionPlugin/Test/TestGroup1799.py index cacc2aeac..2bf63ad69 100644 --- a/src/CollectionPlugin/Test/TestGroup1799.py +++ b/src/CollectionPlugin/Test/TestGroup1799.py @@ -114,13 +114,13 @@ SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_7.result(), 250) SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_11.result()) SketchConstraintEqual_5 = Sketch_1.setEqual(SketchLine_7.result(), SketchLine_2.result()) model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_5f-SketchLine_6f-SketchLine_9r-SketchLine_10r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchCircle_1_2r-SketchLine_7f-SketchLine_9f-SketchLine_12r"), model.selection("FACE", "Sketch_1/Face-SketchLine_4f-SketchCircle_1_2r-SketchLine_8f-SketchLine_11r-SketchLine_12f"), model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_3f-SketchCircle_1_2r-SketchLine_10f-SketchLine_11f")], model.selection(), 150, 0) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("FACE", "Extrusion_1_1/To_Face_4"), model.selection("FACE", "Extrusion_1_1/To_Face_3"), model.selection("FACE", "Extrusion_1_1/To_Face_2")]) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_15"), 150, True) -Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_7"), 150, True) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_6f-SketchLine_10r-SketchCircle_1_2r-SketchLine_9r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_9f-SketchCircle_1_2r-SketchLine_12r-SketchLine_7f"), model.selection("FACE", "Sketch_1/Face-SketchLine_4f-SketchLine_12f-SketchCircle_1_2r-SketchLine_11r-SketchLine_8f"), model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_3f-SketchLine_11f-SketchCircle_1_2r-SketchLine_10f")], model.selection(), 150, 0) +Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1_4/To_Face"), model.selection("FACE", "Extrusion_1_1_3/To_Face"), model.selection("FACE", "Extrusion_1_1_2/To_Face")]) +Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_6"), 150, True) +Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4"), 150, True) Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Plane_1"), model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("FACE", "Plane_2")]) -Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1_7/Modified_Face_2_4"), 110, True) -Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1_5/Modified_Face_3_4"), 380, True) +Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1_7/Modified_Face&Sketch_1/SketchLine_3"), 110, True) +Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1_5/Modified_Face&Sketch_1/SketchLine_8"), 380, True) Partition_2 = model.addPartition(Part_1_doc, [model.selection("FACE", "Plane_3"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("FACE", "Plane_4")]) model.do() diff --git a/src/CollectionPlugin/Test/TestGroupMove.py b/src/CollectionPlugin/Test/TestGroupMove.py index dd1e0c17f..604989e39 100644 --- a/src/CollectionPlugin/Test/TestGroupMove.py +++ b/src/CollectionPlugin/Test/TestGroupMove.py @@ -30,8 +30,8 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 20, 10, 10) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), 10, True) -Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Box_1_1/Left&Box_1_1/Top")]) -Group_2 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Top")]) +Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]")]) +Group_2 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]")]) Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")]) model.do() # move groups diff --git a/src/CollectionPlugin/Test/TestGroupMove2.py b/src/CollectionPlugin/Test/TestGroupMove2.py index 0f06d1dfd..2fc004aec 100644 --- a/src/CollectionPlugin/Test/TestGroupMove2.py +++ b/src/CollectionPlugin/Test/TestGroupMove2.py @@ -28,8 +28,8 @@ partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 20) -Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Right&Box_1_1/Top"), model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Top"), model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom")) -Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Top")]) +Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]")) +Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]")]) Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")]) Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPSOLID", "Partition_1_1")) Remove_SubShapes_1.setSubShapesToKeep([model.selection("SOLID", "Partition_1_1_2")]) -- 2.39.2