From c667d9fc9c0124e7e2f5909447e2744868491a59 Mon Sep 17 00:00:00 2001 From: dbv Date: Fri, 18 Sep 2015 17:45:19 +0300 Subject: [PATCH] Tests update --- .../Test/TestBooleanCompSolids.py | 17 +++++++++++ src/FeaturesPlugin/Test/TestPartition.py | 22 +++++++++++++++ src/FeaturesPlugin/Test/TestRevolution.py | 28 ++++++++++++++++++- 3 files changed, 66 insertions(+), 1 deletion(-) diff --git a/src/FeaturesPlugin/Test/TestBooleanCompSolids.py b/src/FeaturesPlugin/Test/TestBooleanCompSolids.py index 47e6beafe..ed2a60514 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCompSolids.py +++ b/src/FeaturesPlugin/Test/TestBooleanCompSolids.py @@ -100,6 +100,23 @@ aSession.startOperation() aBooleanFt = aPart.addFeature("Boolean") aBooleanFt.selectionList("main_objects").append(modelAPI_ResultCompSolid(extrudedObjects[0]).subResult(1), None) aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], None) +aBooleanType = 0 +aBooleanFt.integer("bool_type").setValue(aBooleanType) +aBooleanFt.execute() +aSession.finishOperation() + +assert (len(aBooleanFt.results()) > 0) +aBooleanResult = modelAPI_ResultBody(aBooleanFt.firstResult()) +assert (aBooleanResult is not None) +aSession.undo() + +#========================================================================= +# Fuse +#========================================================================= +aSession.startOperation() +aBooleanFt = aPart.addFeature("Boolean") +aBooleanFt.selectionList("main_objects").append(modelAPI_ResultCompSolid(extrudedObjects[0]).subResult(1), None) +aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], None) aBooleanType = 1 aBooleanFt.integer("bool_type").setValue(aBooleanType) aBooleanFt.execute() diff --git a/src/FeaturesPlugin/Test/TestPartition.py b/src/FeaturesPlugin/Test/TestPartition.py index 2bb4d00f1..e12641257 100644 --- a/src/FeaturesPlugin/Test/TestPartition.py +++ b/src/FeaturesPlugin/Test/TestPartition.py @@ -108,3 +108,25 @@ assert (aFactory.validate(aPartitionFt)) assert (len(aPartitionFt.results()) > 0) aPartitionResult = modelAPI_ResultBody(aPartitionFt.firstResult()) assert (aPartitionResult is not None) +aSession.undo() + +#========================================================================= +# Create a partition +#========================================================================= +aSession.startOperation() +aPartitionFt = aPart.addFeature("Partition") +assert (aPartitionFt.getKind() == "Partition") +aPartitionFt.selectionList("main_objects").append(anExtrusionResult, anExtrusionResult.shape()) +aPartitionFt.selectionList("tool_objects").append(aPlaneResult, None) +aPartitionFt.boolean("partition_combine").setValue(False) +aPartitionFt.execute() +aSession.finishOperation() + +#========================================================================= +# Test results +#========================================================================= +aFactory = ModelAPI_Session.get().validators() +assert (aFactory.validate(aPartitionFt)) +assert (len(aPartitionFt.results()) > 0) +aPartitionResult = modelAPI_ResultBody(aPartitionFt.firstResult()) +assert (aPartitionResult is not None) diff --git a/src/FeaturesPlugin/Test/TestRevolution.py b/src/FeaturesPlugin/Test/TestRevolution.py index 9bb13f88f..6e4b2f175 100644 --- a/src/FeaturesPlugin/Test/TestRevolution.py +++ b/src/FeaturesPlugin/Test/TestRevolution.py @@ -177,4 +177,30 @@ aSession.finishOperation() # Check revol results assert (len(aRevolFt.results()) > 0) aRevolResult = modelAPI_ResultBody(aRevolFt.firstResult()) -assert (aRevolResult is not None) \ No newline at end of file +assert (aRevolResult is not None) +aSession.undo() + +#========================================================================= +# Test revol between bounding plane +#========================================================================= +aSession.startOperation() +aRevolFt = aPart.addFeature("Revolution") +assert (aRevolFt.getKind() == "Revolution") +# selection type FACE=4 +aRevolFt.selectionList("base").append( + aCircleSketchResult, aCircleSketchFaces[0]) +aRevolFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge) +aRevolFt.string("CreationMethod").setValue("ByPlanesAndOffsets") +aRevolFt.real("from_angle").setValue(0) #TODO: remove +aRevolFt.real("to_angle").setValue(0) #TODO: remove +aRevolFt.selection("to_object").setValue(aToResult, None) +aRevolFt.real("to_offset").setValue(0) +aRevolFt.selection("from_object").setValue(None, None) +aRevolFt.real("from_offset").setValue(0) +aRevolFt.execute() +aSession.finishOperation() + +# Check revol results +assert (len(aRevolFt.results()) > 0) +aRevolResult = modelAPI_ResultBody(aRevolFt.firstResult()) +assert (aRevolResult is not None) -- 2.39.2