]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/BuildPlugin/Test/TestVertex.py
Salome HOME
Update copyrights
[modules/shaper.git] / src / BuildPlugin / Test / TestVertex.py
index 237283590974096517d90b1d3b4fbd96497b704e..c9fcd95441450738029112b7f5c66ffbb70084c3 100644 (file)
@@ -1,3 +1,22 @@
+# Copyright (C) 2014-2019  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
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
 # Initialization of the test
 from ModelAPI import *
 from GeomDataAPI import *
@@ -56,5 +75,30 @@ aSession.finishOperation()
 # Test results
 assert (len(aVertexFeature.results()) == aNumOfPoints)
 
+# Check Vertex feature failed on incorrect input
+aSession.startOperation()
+aVertexFeature2 = aPart.addFeature("Vertex")
+aBaseObjectsList = aVertexFeature2.selectionList("base_objects")
+aBaseObjectsList.append(aSketchResult, None)
+aSession.finishOperation()
+assert (len(aVertexFeature2.results()) == 0)
+
+aSession.startOperation()
+aLine = aSketchFeature.addFeature("SketchLine")
+geomDataAPI_Point2D(aLine.attribute("StartPoint")).setValue(0, 0)
+geomDataAPI_Point2D(aLine.attribute("EndPoint")).setValue(100, 100)
+aSession.finishOperation()
+aSession.startOperation()
+aBaseObjectsList.clear()
+aBaseObjectsList.append(aSketchResult, aLine.lastResult().shape())
+aSession.finishOperation()
+assert (len(aVertexFeature2.results()) == 0)
+
+# remove failed feature
+aSession.startOperation()
+aPart.removeFeature(aVertexFeature2)
+aPart.setCurrentFeature(aVertexFeature, True)
+aSession.finishOperation()
+
 from salome.shaper import model
 assert(model.checkPythonDump())