mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-09-10 06:38:11 +08:00
e384f0bb93
- Introduced new tests for TopExp class to validate shape mapping and vertex retrieval. - Added tests for Geom_Circle, Geom_Line, and Geom_Plane classes to ensure correct geometric behavior and transformations. - Implemented tests for GCPnts_AbscissaPoint to verify length calculations and parameter retrieval for lines and circles. - Created conversion tests in GeomConvert to check the accuracy of converting geometric entities to B-spline representations. - Updated CMake files to include new test files for the added tests.
102 lines
3.1 KiB
C++
102 lines
3.1 KiB
C++
// Copyright (c) 2025 OPEN CASCADE SAS
|
|
//
|
|
// This file is part of Open CASCADE Technology software library.
|
|
//
|
|
// This library is free software; you can redistribute it and/or modify it under
|
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
// by the Free Software Foundation, with special exception defined in the file
|
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
// distribution for complete text of the license and disclaimer of any warranty.
|
|
//
|
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
// commercial license or contractual agreement.
|
|
|
|
#include <BRepCheck_Analyzer.hxx>
|
|
#include <BRepFilletAPI_MakeFillet.hxx>
|
|
#include <BRepPrimAPI_MakeBox.hxx>
|
|
#include <TopAbs_ShapeEnum.hxx>
|
|
#include <TopExp_Explorer.hxx>
|
|
#include <TopoDS.hxx>
|
|
#include <TopoDS_Edge.hxx>
|
|
#include <TopoDS_Shape.hxx>
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
TEST(BRepFilletAPI_MakeFilletTest, FilletOneEdge)
|
|
{
|
|
BRepPrimAPI_MakeBox aBoxMaker(20.0, 20.0, 20.0);
|
|
const TopoDS_Shape& aBox = aBoxMaker.Shape();
|
|
ASSERT_TRUE(aBoxMaker.IsDone());
|
|
|
|
TopExp_Explorer anExp(aBox, TopAbs_EDGE);
|
|
ASSERT_TRUE(anExp.More());
|
|
const TopoDS_Edge& anEdge = TopoDS::Edge(anExp.Current());
|
|
|
|
BRepFilletAPI_MakeFillet aFillet(aBox);
|
|
aFillet.Add(2.0, anEdge);
|
|
const TopoDS_Shape& aResult = aFillet.Shape();
|
|
ASSERT_TRUE(aFillet.IsDone());
|
|
|
|
BRepCheck_Analyzer anAnalyzer(aResult);
|
|
EXPECT_TRUE(anAnalyzer.IsValid());
|
|
}
|
|
|
|
TEST(BRepFilletAPI_MakeFilletTest, FilletAllEdges)
|
|
{
|
|
BRepPrimAPI_MakeBox aBoxMaker(20.0, 20.0, 20.0);
|
|
const TopoDS_Shape& aBox = aBoxMaker.Shape();
|
|
ASSERT_TRUE(aBoxMaker.IsDone());
|
|
|
|
BRepFilletAPI_MakeFillet aFillet(aBox);
|
|
for (TopExp_Explorer anExp(aBox, TopAbs_EDGE); anExp.More(); anExp.Next())
|
|
{
|
|
aFillet.Add(1.0, TopoDS::Edge(anExp.Current()));
|
|
}
|
|
const TopoDS_Shape& aResult = aFillet.Shape();
|
|
ASSERT_TRUE(aFillet.IsDone());
|
|
|
|
BRepCheck_Analyzer anAnalyzer(aResult);
|
|
EXPECT_TRUE(anAnalyzer.IsValid());
|
|
}
|
|
|
|
TEST(BRepFilletAPI_MakeFilletTest, FilletMoreFaces)
|
|
{
|
|
BRepPrimAPI_MakeBox aBoxMaker(20.0, 20.0, 20.0);
|
|
const TopoDS_Shape& aBox = aBoxMaker.Shape();
|
|
ASSERT_TRUE(aBoxMaker.IsDone());
|
|
|
|
BRepFilletAPI_MakeFillet aFillet(aBox);
|
|
for (TopExp_Explorer anExp(aBox, TopAbs_EDGE); anExp.More(); anExp.Next())
|
|
{
|
|
aFillet.Add(1.0, TopoDS::Edge(anExp.Current()));
|
|
}
|
|
const TopoDS_Shape& aResult = aFillet.Shape();
|
|
ASSERT_TRUE(aFillet.IsDone());
|
|
|
|
int aFaceCount = 0;
|
|
for (TopExp_Explorer aFaceExp(aResult, TopAbs_FACE); aFaceExp.More(); aFaceExp.Next())
|
|
{
|
|
aFaceCount++;
|
|
}
|
|
EXPECT_GT(aFaceCount, 6);
|
|
}
|
|
|
|
TEST(BRepFilletAPI_MakeFilletTest, FilletVariableRadius)
|
|
{
|
|
BRepPrimAPI_MakeBox aBoxMaker(20.0, 20.0, 20.0);
|
|
const TopoDS_Shape& aBox = aBoxMaker.Shape();
|
|
ASSERT_TRUE(aBoxMaker.IsDone());
|
|
|
|
TopExp_Explorer anExp(aBox, TopAbs_EDGE);
|
|
ASSERT_TRUE(anExp.More());
|
|
const TopoDS_Edge& anEdge = TopoDS::Edge(anExp.Current());
|
|
|
|
BRepFilletAPI_MakeFillet aFillet(aBox);
|
|
aFillet.Add(1.0, 3.0, anEdge);
|
|
const TopoDS_Shape& aResult = aFillet.Shape();
|
|
ASSERT_TRUE(aFillet.IsDone());
|
|
|
|
BRepCheck_Analyzer anAnalyzer(aResult);
|
|
EXPECT_TRUE(anAnalyzer.IsValid());
|
|
}
|