Salome HOME
Improve ExchangePlugin code coverage
[modules/shaper.git] / src / FeaturesPlugin / Test / TestRemoveSubShapes6.py
index 61955a4bd4ff971afe83b27f9bbf5bd81816842f..806869411ee5458864121f99b56600491f6f3083 100644 (file)
@@ -1,4 +1,4 @@
-## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017  CEA/DEN, EDF R&D
 ##
 ## This library is free software; you can redistribute it and/or
 ## modify it under the terms of the GNU Lesser General Public
@@ -18,6 +18,8 @@
 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 ##
 
+# -*- coding: utf-8 -*-
+
 from salome.shaper import model
 
 from GeomAPI import *
@@ -47,7 +49,7 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_4.result())
 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 20)
 model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
 LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), 2, 2)
 Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "LinearCopy_1_1_1"), model.selection("FACE", "LinearCopy_1_1_2")]
 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
@@ -55,6 +57,14 @@ Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPO
 Remove_SubShapes_1.setSubShapesToKeep([model.selection("COMPSOLID", "Partition_1_1_1")])
 model.do()
 
+# check error when compsolid is selected
+assert(Remove_SubShapes_1.feature().error() != "")
+
+# fix the problematic feature
+Remove_SubShapes_1.setSubShapesToKeep([model.selection("SOLID", "Partition_1_1_1_1"), model.selection("SOLID", "Partition_1_1_1_2"), model.selection("SOLID", "Partition_1_1_1_3")])
+model.do()
+assert(Remove_SubShapes_1.feature().error() == "")
+
 # check number of sub-shapes
 model.testNbResults(Remove_SubShapes_1, 1)
 model.testNbSubResults(Remove_SubShapes_1, [3])