From 7551606a6acc65c7ee1bc474ae36f118526c4ca6 Mon Sep 17 00:00:00 2001 From: Artem Zhidkov Date: Mon, 12 Oct 2020 20:31:11 +0300 Subject: [PATCH] Adjust test cases reference data according to precise calculation of bounding boxes. --- src/FeaturesPlugin/Test/TestExtrusionCut_ThroughAll.py | 2 +- .../Test/TestFillet_MultiLevelCompound_v0_3.py | 2 +- .../Test/TestFillet_MultiLevelCompound_v0_4.py | 2 +- .../Test/TestFillet_MultiLevelCompound_v95_3.py | 4 ++-- .../Test/TestFillet_MultiLevelCompound_v95_4.py | 6 +++--- .../Test/TestScale_MultiLevelCompound_v95_2.py | 8 ++++---- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/FeaturesPlugin/Test/TestExtrusionCut_ThroughAll.py b/src/FeaturesPlugin/Test/TestExtrusionCut_ThroughAll.py index 54e0f6fd4..e19da51a6 100644 --- a/src/FeaturesPlugin/Test/TestExtrusionCut_ThroughAll.py +++ b/src/FeaturesPlugin/Test/TestExtrusionCut_ThroughAll.py @@ -64,7 +64,7 @@ SketchCircle_3 = Sketch_3.addCircle(7, 2, 1.5) ExtrusionCut_3.setNestedSketch(Sketch_3) model.do() Shape = ExtrusionCut_3.results()[0].resultSubShapePair()[0].shape() -checkMiddlePoint(Shape, 5.00008072, 5.079732786, 5.08050663) +checkMiddlePoint(Shape, 5.00008072, 5.079732577, 5.08050677) model.end() diff --git a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_3.py b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_3.py index b15634542..e035002b6 100644 --- a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_3.py +++ b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_3.py @@ -124,7 +124,7 @@ model.testNbSubShapes(Fillet_6, GeomAPI_Shape.FACE, [23]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.EDGE, [95]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.VERTEX, [190]) model.testResultsVolumes(Fillet_6, [1565.568094166]) -refPoint = GeomAPI_Pnt(2.7448, 2.7448, 5) +refPoint = GeomAPI_Pnt(2.50004995, 2.50004995, 5.00005) midPoint = Fillet_6.defaultResult().shape().middlePoint() assert(midPoint.distance(refPoint) < TOLERANCE) diff --git a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_4.py b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_4.py index b1b177b65..258f7ef01 100644 --- a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_4.py +++ b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_4.py @@ -127,7 +127,7 @@ model.testNbSubShapes(Fillet_6, GeomAPI_Shape.FACE, [23]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.EDGE, [95]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.VERTEX, [190]) model.testResultsVolumes(Fillet_6, [1565.568094166]) -refPoint = GeomAPI_Pnt(2.7448, 2.7448, 5) +refPoint = GeomAPI_Pnt(2.50004995, 2.50004995, 5.00005) midPoint = Fillet_6.defaultResult().shape().middlePoint() assert(midPoint.distance(refPoint) < TOLERANCE) diff --git a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_3.py b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_3.py index 4ad363735..d02ae8827 100644 --- a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_3.py +++ b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_3.py @@ -124,7 +124,7 @@ model.testNbSubShapes(Fillet_6, GeomAPI_Shape.FACE, [23]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.EDGE, [95]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.VERTEX, [190]) model.testResultsVolumes(Fillet_6, [1565.568094166]) -refPoint = GeomAPI_Pnt(2.7448, 2.7448, 5) +refPoint = GeomAPI_Pnt(2.50004995, 2.50004995, 5.00005) midPoint = Fillet_6.defaultResult().shape().middlePoint() assert(midPoint.distance(refPoint) < TOLERANCE) @@ -136,7 +136,7 @@ model.testNbSubShapes(Fillet_7, GeomAPI_Shape.FACE, [23]) model.testNbSubShapes(Fillet_7, GeomAPI_Shape.EDGE, [98]) model.testNbSubShapes(Fillet_7, GeomAPI_Shape.VERTEX, [196]) model.testResultsVolumes(Fillet_7, [2976.0685684791988]) -refPoint = GeomAPI_Pnt(-20.9807621135, 42.806, 5) +refPoint = GeomAPI_Pnt(-20.9807621135, 42.5, 5) midPoint = Fillet_7.defaultResult().shape().middlePoint() assert(midPoint.distance(refPoint) < TOLERANCE) model.end() diff --git a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_4.py b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_4.py index ebd1bf9d3..f4545a1f5 100644 --- a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_4.py +++ b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_4.py @@ -142,7 +142,7 @@ VOLUME = 5565.117188528191 assertResult(Fillet_5) Fillet_6 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_7_2/Modified_Face&Box_2_1/Top][Compound_1_1_7_2/Modified_Face&Box_2_1/Front]"), model.selection("FACE", "Compound_1_1_7_2/Modified_Face&Box_2_1/Right")], RADIUS_1, RADIUS_2, keepSubResults = True) -REFERENCE[6] = GeomAPI_Pnt(2.7448, 2.7448, 5) +REFERENCE[6] = GeomAPI_Pnt(2.50004995, 2.50004995, 5.00005) NB_FACES += 6 NB_EDGES += 29 NB_VERTICES += 58 @@ -150,7 +150,7 @@ VOLUME = 5541.63666 assertResult(Fillet_6) Fillet_7 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_8_1/Modified_Face&Box_3_1/Back][Compound_1_1_8_1/Modified_Face&Box_3_1/Top]"), model.selection("FACE", "Compound_1_1_8_2/Modified_Face&Box_3_1/Left")], RADIUS_1, RADIUS_2, keepSubResults = True) -REFERENCE[7] = GeomAPI_Pnt(-20.9807621135, 42.806, 5) +REFERENCE[7] = GeomAPI_Pnt(-20.9807621135, 42.5, 5) NB_FACES += 5 NB_EDGES += 26 NB_VERTICES += 52 @@ -163,7 +163,7 @@ NB_EDGES += 12 NB_VERTICES += 24 VOLUME = 5507.602043482 REFERENCE[5] = GeomAPI_Pnt(55.041662114, 5.021870383, 5.009557179275) -REFERENCE[7] = GeomAPI_Pnt(-20.9807621135, 42.5409962, 5) +REFERENCE[7] = GeomAPI_Pnt(-20.9807621135, 42.5, 5) assertResult(Fillet_8) model.end() diff --git a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_2.py b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_2.py index 7975a6792..077241b69 100644 --- a/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_2.py +++ b/src/FeaturesPlugin/Test/TestScale_MultiLevelCompound_v95_2.py @@ -107,14 +107,14 @@ assert(Scale_1.feature().error() != "") model.begin() Scale_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")]) REFERENCE[0] = GeomAPI_Pnt(REFERENCE[0].x() * SCALE_X, REFERENCE[0].y() * SCALE_Y, REFERENCE[0].z() * SCALE_Z) -REFERENCE[0].setX(0) # <= B-spline poles are used to calculate the bounding box and thus the middle point +##REFERENCE[0].setX(0) # <= B-spline poles are used to calculate the bounding box and thus the middle point assertResult(Scale_1, 74139.07479) Scale_2 = model.addScale(Part_1_doc, [model.selection("SOLID", "Scale_1_1_2_1")], model.selection("VERTEX", "PartSet/Origin"), SCALE_X, SCALE_Y, SCALE_Z, keepSubResults = True) subs = subsRefPoints(Compound_2.result().subResult(1)) subs[0] = GeomAPI_Pnt(subs[0].xyz().added(GeomAPI_XYZ(5, -5, 5))) subs[0] = GeomAPI_Pnt(subs[0].x() * SCALE_X, subs[0].y() * SCALE_Y, subs[0].z() * SCALE_Z) -subs[0].setY(-117.3204876) # <= B-spline poles are used to calculate the bounding box and thus the middle point +##subs[0].setY(-117.3204876) # <= B-spline poles are used to calculate the bounding box and thus the middle point subs[1] = GeomAPI_Pnt(subs[1].xyz().added(GeomAPI_XYZ(-5, 5, -5))) REFERENCE[1] = average(subs) assertResult(Scale_2, 78066.07487341) @@ -133,8 +133,8 @@ Scale_4.setMainObjects([model.selection("COMPSOLID", "Scale_3_1_1"), model.selec REFERENCE[0] = GeomAPI_Pnt(REFERENCE[0].x() / SCALE_X, REFERENCE[0].y() / SCALE_Y, REFERENCE[0].z() / SCALE_Z) subs[1] = GeomAPI_Pnt(subs[1].x() / SCALE_X, subs[1].y() / SCALE_Y, subs[1].z() / SCALE_Z) # B-spline poles are used to calculate the bounding box and thus the middle point -subs[1].setX(-30.59017) -subs[1].setY(-2.83826244) +##subs[1].setX(-30.59017) +##subs[1].setY(-2.83826244) REFERENCE[1] = average(subs) REFERENCE[2] = GeomAPI_Pnt(REFERENCE[2].x() / SCALE_X, REFERENCE[2].y() / SCALE_Y, REFERENCE[2].z() / SCALE_Z) assertResult(Scale_4, 17592.5112883) -- 2.39.2