]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Extend unit tests for Vertex, Edge, Wire, Face and Shell features
authorazv <azv@opencascade.com>
Wed, 27 Dec 2017 11:39:11 +0000 (14:39 +0300)
committerazv <azv@opencascade.com>
Wed, 27 Dec 2017 11:39:11 +0000 (14:39 +0300)
src/BuildPlugin/Test/TestEdge.py
src/BuildPlugin/Test/TestFace.py
src/BuildPlugin/Test/TestShell.py
src/BuildPlugin/Test/TestVertex.py
src/BuildPlugin/Test/TestWire.py

index c64cae8e0fd86c69e61589cdf106b0c1af1ae39d..06c653dfb2d46865c9fbc0efbb09e659a9c8056c 100644 (file)
@@ -111,5 +111,34 @@ aSession.finishOperation()
 # Test results
 assert (len(anEdgeFeature2.results()) == 12)
 
+# Check Edge feature failed on incorrect input
+aSession.startOperation()
+anEdgeFeature3 = aPart.addFeature("Edge")
+aBaseObjectsList = anEdgeFeature3.selectionList("base_objects")
+aBaseObjectsList.append(aSketchResult, None)
+aSession.finishOperation()
+assert (len(anEdgeFeature3.results()) == 0)
+
+aSession.startOperation()
+aBaseObjectsList.clear()
+aShapeExplorer = GeomAPI_ShapeExplorer(aBoxShape, GeomAPI_Shape.VERTEX)
+aShape = aShapeExplorer.current()
+aBaseObjectsList.append(aBoxResult, aShape)
+aSession.finishOperation()
+assert (len(anEdgeFeature3.results()) == 0)
+
+aSession.startOperation()
+aBaseObjectsList.clear()
+aShapeExplorer = GeomAPI_ShapeExplorer(aBoxShape, GeomAPI_Shape.FACE)
+aShape = aShapeExplorer.current()
+aBaseObjectsList.append(aBoxResult, aShape)
+aSession.finishOperation()
+assert (len(anEdgeFeature3.results()) == 0)
+
+# remove failed feature
+aSession.startOperation()
+aPart.removeFeature(anEdgeFeature3)
+aSession.finishOperation()
+
 from salome.shaper import model
 assert(model.checkPythonDump())
index a88618c8f22e06a4a8ae1a7952741094be2c58e3..a64a2f913a125e963a829e1192f189e10333f5d4 100644 (file)
@@ -141,5 +141,37 @@ aSession.startOperation()
 aPart.removeFeature(aFaceFeature4)
 aSession.finishOperation()
 
+# =============================================================================
+# Test 5. Check Face feature failed on incorrect input
+# =============================================================================
+
+aSession.startOperation()
+aFaceFeature5 = aPart.addFeature("Face")
+aBaseObjectsList = aFaceFeature5.selectionList("base_objects")
+aBaseObjectsList.append(aCylinderResult, None)
+aSession.finishOperation()
+assert (len(aFaceFeature5.results()) == 0)
+
+aSession.startOperation()
+aBaseObjectsList.clear()
+aShapeExplorer = GeomAPI_ShapeExplorer(aCylinderShape, GeomAPI_Shape.VERTEX)
+aShape = aShapeExplorer.current()
+aBaseObjectsList.append(aCylinderResult, aShape)
+aSession.finishOperation()
+assert (len(aFaceFeature5.results()) == 0)
+
+aSession.startOperation()
+aBaseObjectsList.clear()
+aShapeExplorer = GeomAPI_ShapeExplorer(aFaceFeature.lastResult().shape(), GeomAPI_Shape.EDGE)
+aShape = aShapeExplorer.current()
+aBaseObjectsList.append(aFaceFeature.lastResult(), aShape)
+aSession.finishOperation()
+assert (len(aFaceFeature5.results()) == 0)
+
+# remove failed feature
+aSession.startOperation()
+aPart.removeFeature(aFaceFeature5)
+aSession.finishOperation()
+
 from salome.shaper import model
 assert(model.checkPythonDump())
index 4b371b9728cd60f77a7f6694e2e483c682db0538..6253c1e0f9124b80188785f53bd140f45d731665 100644 (file)
@@ -123,5 +123,22 @@ aSession.finishOperation()
 # Test results
 assert (len(aShellFeature2.results()) > 0)
 
+# Check Shell feature failed on incorrect input
+aShellResult = aShellFeature.firstResult()
+aSession.startOperation()
+aShellFeature3 = aPart.addFeature("Shell")
+aBaseObjectsList = aShellFeature3.selectionList("base_objects")
+aShapeExplorer = GeomAPI_ShapeExplorer(aShellResult.shape(), GeomAPI_Shape.EDGE)
+while aShapeExplorer.more():
+    aBaseObjectsList.append(aShellResult, aShapeExplorer.current())
+    aShapeExplorer.next()
+aSession.finishOperation()
+assert (len(aShellFeature3.results()) == 0)
+
+# remove failed feature
+aSession.startOperation()
+aPart.removeFeature(aShellFeature3)
+aSession.finishOperation()
+
 from salome.shaper import model
 assert(model.checkPythonDump())
index eefe6e1655f804302e1b21c8bd54c2fee0ff4e7f..ad17017281391cfa222b553b608c38900e2e1c27 100644 (file)
@@ -76,5 +76,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())
index 351a29017c2d4edc72362fd9819b06a34b7adc6c..25dd4ecb24e203e9f26f5107eb2b5684e8bf372d 100644 (file)
@@ -145,4 +145,36 @@ aSession.finishOperation()
 # Test results
 assert (len(aWireFeature2.results()) == 1)
 
+# =============================================================================
+# Test 4. Check Wire feature failed on incorrect input
+# =============================================================================
+
+aSession.startOperation()
+aWireFeature3 = aPart.addFeature("Wire")
+aBaseObjectsList = aWireFeature3.selectionList("base_objects")
+aBaseObjectsList.append(aSketchResult, None)
+aSession.finishOperation()
+assert (len(aWireFeature3.results()) == 0)
+
+aSession.startOperation()
+aBaseObjectsList.clear()
+aShapeExplorer = GeomAPI_ShapeExplorer(aBoxShape, GeomAPI_Shape.VERTEX)
+aShape = aShapeExplorer.current()
+aBaseObjectsList.append(aBoxResult, aShape)
+aSession.finishOperation()
+assert (len(aWireFeature3.results()) == 0)
+
+aSession.startOperation()
+aBaseObjectsList.clear()
+aShapeExplorer = GeomAPI_ShapeExplorer(aBoxShape, GeomAPI_Shape.FACE)
+aShape = aShapeExplorer.current()
+aBaseObjectsList.append(aBoxResult, aShape)
+aSession.finishOperation()
+assert (len(aWireFeature3.results()) == 0)
+
+# remove failed feature
+aSession.startOperation()
+aPart.removeFeature(aWireFeature3)
+aSession.finishOperation()
+
 assert(model.checkPythonDump())