mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-10-05 05:28:07 +08:00
Testing - Migration QADraw tests to GTests (#1235)
- Removed multiple legacy DRAW test scripts and several QABugs DRAW command implementations. - Added new GTest suites covering the migrated regressions in ModelingData/ModelingAlgorithms/FoundationClasses/DataExchange/ApplicationFramework. - Updated multiple `FILES.cmake` lists to compile/link the new tests; introduced an additional `STEPControl_Writer::SetShapeFixParameters()` overload.
This commit is contained in:
@@ -13,12 +13,16 @@
|
||||
|
||||
#include <BRepCheck_Analyzer.hxx>
|
||||
#include <BRepFilletAPI_MakeFillet.hxx>
|
||||
#include <BRepGProp.hxx>
|
||||
#include <BRepPrimAPI_MakeBox.hxx>
|
||||
#include <GProp_GProps.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@@ -99,3 +103,54 @@ TEST(BRepFilletAPI_MakeFilletTest, FilletVariableRadius)
|
||||
BRepCheck_Analyzer anAnalyzer(aResult);
|
||||
EXPECT_TRUE(anAnalyzer.IsValid());
|
||||
}
|
||||
|
||||
// Test OCC570: BRepFilletAPI_MakeFillet with mixed constant and variable radius.
|
||||
// Migrated from QABugs_17.cxx OCC570
|
||||
TEST(BRepFilletAPI_MakeFilletTest, OCC570_MixedVariableConstantRadius)
|
||||
{
|
||||
BRepPrimAPI_MakeBox aBoxMaker(100., 100., 100.);
|
||||
const TopoDS_Shape& aBox = aBoxMaker.Shape();
|
||||
|
||||
// Take the first wire of the box and its 4 edges
|
||||
TopExp_Explorer aWireExp(aBox, TopAbs_WIRE);
|
||||
ASSERT_TRUE(aWireExp.More());
|
||||
|
||||
TopExp_Explorer anEdgeExp(aWireExp.Current(), TopAbs_EDGE);
|
||||
ASSERT_TRUE(anEdgeExp.More());
|
||||
TopoDS_Edge anE1 = TopoDS::Edge(anEdgeExp.Current());
|
||||
anEdgeExp.Next();
|
||||
ASSERT_TRUE(anEdgeExp.More());
|
||||
TopoDS_Edge anE2 = TopoDS::Edge(anEdgeExp.Current());
|
||||
anEdgeExp.Next();
|
||||
ASSERT_TRUE(anEdgeExp.More());
|
||||
TopoDS_Edge anE3 = TopoDS::Edge(anEdgeExp.Current());
|
||||
anEdgeExp.Next();
|
||||
ASSERT_TRUE(anEdgeExp.More());
|
||||
TopoDS_Edge anE4 = TopoDS::Edge(anEdgeExp.Current());
|
||||
|
||||
// Variable radius law: 4 (parameter, radius) control points
|
||||
NCollection_Array1<gp_Pnt2d> aVarRadius(1, 4);
|
||||
aVarRadius.SetValue(1, gp_Pnt2d(0.0, 5.0));
|
||||
aVarRadius.SetValue(2, gp_Pnt2d(0.3, 15.0));
|
||||
aVarRadius.SetValue(3, gp_Pnt2d(0.7, 15.0));
|
||||
aVarRadius.SetValue(4, gp_Pnt2d(1.0, 5.0));
|
||||
|
||||
BRepFilletAPI_MakeFillet aFillet(aBox);
|
||||
aFillet.SetContinuity(GeomAbs_C1, 0.001);
|
||||
aFillet.Add(aVarRadius, anE1);
|
||||
aFillet.Add(5.0, anE2);
|
||||
aFillet.Add(aVarRadius, anE3);
|
||||
aFillet.Add(5.0, anE4);
|
||||
|
||||
ASSERT_NO_THROW(aFillet.Build()) << "BRepFilletAPI_MakeFillet::Build should not throw";
|
||||
ASSERT_TRUE(aFillet.IsDone()) << "Fillet operation should succeed";
|
||||
|
||||
const TopoDS_Shape& aResult = aFillet.Shape();
|
||||
|
||||
BRepCheck_Analyzer anAnalyzer(aResult);
|
||||
EXPECT_TRUE(anAnalyzer.IsValid()) << "Result shape should be valid";
|
||||
|
||||
GProp_GProps aProps;
|
||||
BRepGProp::SurfaceProperties(aResult, aProps);
|
||||
EXPECT_NEAR(aProps.Mass(), 58500., 58500. * 0.01) << "Surface area should be approximately 58500";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user