mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-09-09 22:28:13 +08:00
Testing - Migrate QA DRAW tests to GTest (#818)
- Removed 37 DRAW test scripts from `tests/bugs/` directories - Added 31 new GTest C++ test files in appropriate `GTests/` directories - Removed corresponding QAcommands implementations from QABugs source files - Updated CMake FILES.cmake files to include new test files
This commit is contained in:
@@ -2,4 +2,8 @@
|
||||
set(OCCT_TKLCAF_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
set(OCCT_TKLCAF_GTests_FILES
|
||||
TDataStd_Attribute_Test.cxx
|
||||
TDataStd_TreeNode_Test.cxx
|
||||
TNaming_Builder_Test.cxx
|
||||
TNaming_Name_Test.cxx
|
||||
)
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
// 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 <TDataStd_AsciiString.hxx>
|
||||
#include <TDataStd_BooleanArray.hxx>
|
||||
#include <TDataStd_BooleanList.hxx>
|
||||
#include <TDataStd_ByteArray.hxx>
|
||||
#include <TDataStd_ExtStringArray.hxx>
|
||||
#include <TDataStd_ExtStringList.hxx>
|
||||
#include <TDataStd_Integer.hxx>
|
||||
#include <TDataStd_IntegerArray.hxx>
|
||||
#include <TDataStd_IntegerList.hxx>
|
||||
#include <TDataStd_Name.hxx>
|
||||
#include <TDataStd_Real.hxx>
|
||||
#include <TDataStd_RealArray.hxx>
|
||||
#include <TDataStd_RealList.hxx>
|
||||
#include <TDataStd_ReferenceArray.hxx>
|
||||
#include <TDataStd_ReferenceList.hxx>
|
||||
#include <TDocStd_Application.hxx>
|
||||
#include <TDocStd_Document.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <Standard_GUID.hxx>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(TDataStd_Attribute_Test, OCC29371_AttributeGUIDsNotNull)
|
||||
{
|
||||
// Create document and label
|
||||
Handle(TDocStd_Application) anApp = new TDocStd_Application();
|
||||
Handle(TDocStd_Document) aDoc;
|
||||
anApp->NewDocument("BinOcaf", aDoc);
|
||||
TDF_Label aLab = aDoc->Main();
|
||||
|
||||
// Null GUID for comparison
|
||||
Standard_GUID aNullGuid("00000000-0000-0000-0000-000000000000");
|
||||
|
||||
// Test each TDataStd attribute type has non-null GUID
|
||||
Handle(TDataStd_AsciiString) aStrAtt = new TDataStd_AsciiString();
|
||||
aLab.AddAttribute(aStrAtt);
|
||||
EXPECT_NE(aNullGuid, aStrAtt->ID());
|
||||
|
||||
Handle(TDataStd_BooleanArray) aBArAtt = new TDataStd_BooleanArray();
|
||||
aLab.AddAttribute(aBArAtt);
|
||||
EXPECT_NE(aNullGuid, aBArAtt->ID());
|
||||
|
||||
Handle(TDataStd_BooleanList) aBListAtt = new TDataStd_BooleanList();
|
||||
aLab.AddAttribute(aBListAtt);
|
||||
EXPECT_NE(aNullGuid, aBListAtt->ID());
|
||||
|
||||
Handle(TDataStd_ByteArray) aByteArAtt = new TDataStd_ByteArray();
|
||||
aLab.AddAttribute(aByteArAtt);
|
||||
EXPECT_NE(aNullGuid, aByteArAtt->ID());
|
||||
|
||||
Handle(TDataStd_ExtStringArray) anExtStrArAtt = new TDataStd_ExtStringArray();
|
||||
aLab.AddAttribute(anExtStrArAtt);
|
||||
EXPECT_NE(aNullGuid, anExtStrArAtt->ID());
|
||||
|
||||
Handle(TDataStd_ExtStringList) anExtStrListAtt = new TDataStd_ExtStringList();
|
||||
aLab.AddAttribute(anExtStrListAtt);
|
||||
EXPECT_NE(aNullGuid, anExtStrListAtt->ID());
|
||||
|
||||
Handle(TDataStd_Integer) anIntAtt = new TDataStd_Integer();
|
||||
aLab.AddAttribute(anIntAtt);
|
||||
EXPECT_NE(aNullGuid, anIntAtt->ID());
|
||||
|
||||
Handle(TDataStd_IntegerArray) anIntArrAtt = new TDataStd_IntegerArray();
|
||||
aLab.AddAttribute(anIntArrAtt);
|
||||
EXPECT_NE(aNullGuid, anIntArrAtt->ID());
|
||||
|
||||
Handle(TDataStd_IntegerList) anIntListAtt = new TDataStd_IntegerList();
|
||||
aLab.AddAttribute(anIntListAtt);
|
||||
EXPECT_NE(aNullGuid, anIntListAtt->ID());
|
||||
|
||||
Handle(TDataStd_Name) aNameAtt = new TDataStd_Name();
|
||||
aLab.AddAttribute(aNameAtt);
|
||||
EXPECT_NE(aNullGuid, aNameAtt->ID());
|
||||
|
||||
Handle(TDataStd_Real) aRealAtt = new TDataStd_Real();
|
||||
aLab.AddAttribute(aRealAtt);
|
||||
EXPECT_NE(aNullGuid, aRealAtt->ID());
|
||||
|
||||
Handle(TDataStd_RealArray) aRealArrAtt = new TDataStd_RealArray();
|
||||
aLab.AddAttribute(aRealArrAtt);
|
||||
EXPECT_NE(aNullGuid, aRealArrAtt->ID());
|
||||
|
||||
Handle(TDataStd_RealList) aRealListAtt = new TDataStd_RealList();
|
||||
aLab.AddAttribute(aRealListAtt);
|
||||
EXPECT_NE(aNullGuid, aRealListAtt->ID());
|
||||
|
||||
Handle(TDataStd_ReferenceArray) aRefArrAtt = new TDataStd_ReferenceArray();
|
||||
aLab.AddAttribute(aRefArrAtt);
|
||||
EXPECT_NE(aNullGuid, aRefArrAtt->ID());
|
||||
|
||||
Handle(TDataStd_ReferenceList) aRefListAtt = new TDataStd_ReferenceList();
|
||||
aLab.AddAttribute(aRefListAtt);
|
||||
EXPECT_NE(aNullGuid, aRefListAtt->ID());
|
||||
|
||||
anApp->Close(aDoc);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// 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 <gtest/gtest.h>
|
||||
|
||||
#include <TDataStd_TreeNode.hxx>
|
||||
#include <TDF_Data.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
|
||||
// Test BUC60817: TDataStd_TreeNode descendant relationship
|
||||
TEST(TDataStd_TreeNode_Test, BUC60817_DescendantRelationship)
|
||||
{
|
||||
// Create TDF document
|
||||
Handle(TDF_Data) aDF = new TDF_Data();
|
||||
|
||||
// Create two labels
|
||||
TDF_Label aLabel1 = aDF->Root().FindChild(2, Standard_True);
|
||||
TDF_Label aLabel2 = aDF->Root().FindChild(3, Standard_True);
|
||||
|
||||
// Create TreeNodes on the labels
|
||||
Handle(TDataStd_TreeNode) aTN1 = TDataStd_TreeNode::Set(aLabel1);
|
||||
Handle(TDataStd_TreeNode) aTN2 = TDataStd_TreeNode::Set(aLabel2);
|
||||
|
||||
// Append TN2 as a child of TN1
|
||||
aTN1->Append(aTN2);
|
||||
|
||||
// Verify that TN2 is a descendant of TN1
|
||||
EXPECT_TRUE(aTN2->IsDescendant(aTN1)) << "TN2 should be a descendant of TN1 after Append";
|
||||
|
||||
// Verify that TN1 is NOT a descendant of TN2
|
||||
EXPECT_FALSE(aTN1->IsDescendant(aTN2)) << "TN1 should not be a descendant of TN2";
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
// 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 <gtest/gtest.h>
|
||||
|
||||
#include <BRepPrimAPI_MakeBox.hxx>
|
||||
#include <TDocStd_Document.hxx>
|
||||
#include <TNaming_Builder.hxx>
|
||||
#include <TNaming_NamedShape.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
// Test OCC361bug: TNaming_Builder preservation of shape orientation
|
||||
TEST(TNaming_Builder_Test, OCC361_ShapeOrientationPreservation)
|
||||
{
|
||||
// Create a document
|
||||
Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinOcaf");
|
||||
|
||||
// Create a box shape
|
||||
BRepPrimAPI_MakeBox aBoxMaker(gp_Pnt(0, 0, 0), 100, 100, 100);
|
||||
TopoDS_Shape aBox = aBoxMaker.Shape();
|
||||
aBox.Orientation(TopAbs_FORWARD);
|
||||
|
||||
// Get the main label
|
||||
TDF_Label aTestLabel = aDoc->Main();
|
||||
|
||||
// Create a TNaming_Builder and add the shape
|
||||
TNaming_Builder aBuilder(aTestLabel);
|
||||
aBuilder.Generated(aBox);
|
||||
|
||||
// Create a copy with REVERSED orientation
|
||||
TopoDS_Shape aBox1 = aBox;
|
||||
aBox1.Orientation(TopAbs_REVERSED);
|
||||
|
||||
// Clear all attributes from the label
|
||||
aTestLabel.ForgetAllAttributes();
|
||||
|
||||
// Create a new builder with the reversed shape
|
||||
TNaming_Builder aBuilder2(aTestLabel);
|
||||
aBuilder2.Generated(aBox1);
|
||||
|
||||
// Get the shape from the builder and verify orientation
|
||||
aBox = aBuilder2.NamedShape()->Get();
|
||||
|
||||
EXPECT_EQ(TopAbs_REVERSED, aBox.Orientation())
|
||||
<< "Shape orientation should be preserved as REVERSED after TNaming_Builder operations";
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// 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 <gtest/gtest.h>
|
||||
|
||||
#include <TDF_Data.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_LabelMap.hxx>
|
||||
#include <TNaming_Name.hxx>
|
||||
#include <TNaming_NamedShape.hxx>
|
||||
|
||||
// Test BUC60925: TNaming_Name solve with empty NamedShape
|
||||
TEST(TNaming_Name_Test, BUC60925_SolveWithEmptyNamedShape)
|
||||
{
|
||||
// Create TDF document
|
||||
Handle(TDF_Data) aDF = new TDF_Data();
|
||||
|
||||
// Create a label
|
||||
TDF_Label aLabel = aDF->Root().FindChild(2, Standard_True);
|
||||
|
||||
// Create label map
|
||||
TDF_LabelMap aLabelMap;
|
||||
aLabelMap.Add(aLabel);
|
||||
|
||||
// Create an empty NamedShape
|
||||
Handle(TNaming_NamedShape) aNS = new TNaming_NamedShape;
|
||||
|
||||
// Create TNaming_Name and configure it
|
||||
TNaming_Name aNN;
|
||||
aNN.Type(TNaming_IDENTITY);
|
||||
aNN.Append(aNS);
|
||||
|
||||
// Test that Solve returns false for empty NamedShape
|
||||
Standard_Boolean aResult = aNN.Solve(aLabel, aLabelMap);
|
||||
|
||||
EXPECT_FALSE(aResult) << "Solve should return false for empty NamedShape";
|
||||
}
|
||||
@@ -374,50 +374,6 @@ static Standard_Integer OCC74bug_get(Draw_Interpretor& di, Standard_Integer argc
|
||||
#include <TNaming_NamedShape.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
|
||||
static Standard_Integer OCC361bug(Draw_Interpretor& di, Standard_Integer nb, const char** a)
|
||||
{
|
||||
if (nb != 2)
|
||||
{
|
||||
di << "ERROR : Usage : " << a[0] << " Doc\n";
|
||||
di << "-1\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
Handle(TDocStd_Document) D;
|
||||
if (!DDocStd::GetDocument(a[1], D))
|
||||
{
|
||||
di << "-2\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
BRepPrimAPI_MakeBox aBox(gp_Pnt(0, 0, 0), 100, 100, 100);
|
||||
TopoDS_Shape aTBox = aBox.Shape();
|
||||
aTBox.Orientation(TopAbs_FORWARD);
|
||||
|
||||
TDF_Label aTestLabel = D->Main();
|
||||
|
||||
TNaming_Builder aBuilder(aTestLabel);
|
||||
aBuilder.Generated(aTBox);
|
||||
|
||||
TopoDS_Shape aTBox1 = aTBox;
|
||||
aTBox1.Orientation(TopAbs_REVERSED);
|
||||
aTestLabel.ForgetAllAttributes();
|
||||
|
||||
TNaming_Builder aBuilder2(aTestLabel);
|
||||
aBuilder2.Generated(aTBox1);
|
||||
|
||||
aTBox = aBuilder2.NamedShape()->Get();
|
||||
if (aTBox.Orientation() != TopAbs_REVERSED)
|
||||
{
|
||||
di << "1\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
di << "0\n";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||
#include <Image_AlienPixMap.hxx>
|
||||
#include <OSD_FileSystem.hxx>
|
||||
@@ -684,7 +640,6 @@ void QABugs::Commands_1(Draw_Interpretor& theCommands)
|
||||
OCC74bug_get,
|
||||
group);
|
||||
|
||||
theCommands.Add("OCC361", "OCC361 Doc ", __FILE__, OCC361bug, group);
|
||||
theCommands.Add("OCC30182",
|
||||
"OCC30182 name image [-offset Start] [-fileName] [-stream] [-memory]\n"
|
||||
"Decodes image either by passing file name, file stream or memory stream",
|
||||
|
||||
@@ -80,6 +80,8 @@
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <BRepFeat_SplitShape.hxx>
|
||||
#include <BRepAlgoAPI_Common.hxx>
|
||||
#include <BRepAlgoAPI_Fuse.hxx>
|
||||
#include <BRepAlgoAPI_Section.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Draw_Printer.hxx>
|
||||
@@ -841,66 +843,6 @@ Standard_Integer OCC299bug(Draw_Interpretor& theDi,
|
||||
}
|
||||
|
||||
#include <OSD_Process.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
|
||||
static Standard_Integer OCC309bug(Draw_Interpretor& di, Standard_Integer nb, const char** a)
|
||||
{
|
||||
if (nb != 1)
|
||||
{
|
||||
di << "Usage: " << a[0] << "\n";
|
||||
return 1;
|
||||
}
|
||||
OSD_Process p;
|
||||
OSD_Path d = p.CurrentDirectory();
|
||||
TCollection_AsciiString s;
|
||||
d.SystemName(s);
|
||||
di << "*" << s.ToCString() << "*\n";
|
||||
d.UpTrek();
|
||||
d.SystemName(s);
|
||||
di << "*" << s.ToCString() << "*\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer OCC310bug(Draw_Interpretor& di, Standard_Integer nb, const char** a)
|
||||
{
|
||||
if (nb != 1)
|
||||
{
|
||||
di << "Usage: " << a[0] << "\n";
|
||||
return 1;
|
||||
}
|
||||
OSD_Path p("/where/you/want/tmp/qwerty/tmp/");
|
||||
di << p.Trek().ToCString() << "\n";
|
||||
p.UpTrek();
|
||||
di << p.Trek().ToCString() << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <BRepAlgoAPI_Fuse.hxx>
|
||||
#include <BRepAlgoAPI_Common.hxx>
|
||||
|
||||
static Standard_Integer OCC277bug(Draw_Interpretor& di, Standard_Integer nb, const char** a)
|
||||
{
|
||||
if (nb != 1)
|
||||
{
|
||||
di << "Usage : " << a[0] << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
BRepPrimAPI_MakeBox box1(100, 100, 100);
|
||||
BRepPrimAPI_MakeBox box2(gp_Pnt(50, 50, 50), 200, 200, 200);
|
||||
|
||||
TopoDS_Shape shape1 = box1.Shape();
|
||||
TopoDS_Shape shape2 = box2.Shape();
|
||||
|
||||
TopoDS_Shape fuse, comm;
|
||||
di << "fuse = BRepAlgoAPI_Fuse( shape1, shape2 )\n";
|
||||
di << "comm = BRepAlgoAPI_Common( shape1, shape2 )\n";
|
||||
fuse = BRepAlgoAPI_Fuse(shape1, shape2).Shape();
|
||||
comm = BRepAlgoAPI_Common(shape1, shape2).Shape();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <DDocStd_DrawDocument.hxx>
|
||||
#include <TDataStd_Name.hxx>
|
||||
#include <XCAFDoc_ShapeTool.hxx>
|
||||
@@ -1370,25 +1312,6 @@ static Standard_Integer OCC524(Draw_Interpretor& di, Standard_Integer argc, cons
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
static Standard_Integer OCC525(Draw_Interpretor& di,
|
||||
Standard_Integer /*argc*/,
|
||||
const char** /*argv*/)
|
||||
{
|
||||
GeomPlate_BuildPlateSurface aBuilder;
|
||||
aBuilder.Perform();
|
||||
|
||||
if (aBuilder.IsDone())
|
||||
{
|
||||
di << "Error in OCC525. Null result is expected.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
di << "OCC525 OK \n";
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <gce_MakeRotation.hxx>
|
||||
#include <gce_MakeTranslation.hxx>
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
@@ -5236,11 +5159,6 @@ void QABugs::Commands_11(Draw_Interpretor& theCommands)
|
||||
theCommands.Add("OCC381_SaveAs", "OCC381_SaveAs Doc Path", __FILE__, OCC381_SaveAs, group);
|
||||
|
||||
theCommands.Add("OCC299", "OCC299 Solid Point [Tolerance=1.e-7]", __FILE__, OCC299bug, group);
|
||||
theCommands.Add("OCC309", "OCC309", __FILE__, OCC309bug, group);
|
||||
theCommands.Add("OCC310", "OCC310", __FILE__, OCC310bug, group);
|
||||
|
||||
// theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
|
||||
theCommands.Add("OCC277", "OCC277", __FILE__, OCC277bug, group);
|
||||
|
||||
theCommands.Add("OCC363", "OCC363 document filename ", __FILE__, OCC363, group);
|
||||
// Must use OCC299
|
||||
@@ -5263,7 +5181,6 @@ void QABugs::Commands_11(Draw_Interpretor& theCommands)
|
||||
__FILE__,
|
||||
OCC524,
|
||||
group);
|
||||
theCommands.Add("OCC525", "OCC525", __FILE__, OCC525, group);
|
||||
// theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group);
|
||||
theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group);
|
||||
theCommands.Add("OCC669", "OCC669 GUID", __FILE__, OCC669, group);
|
||||
|
||||
@@ -384,67 +384,6 @@ static Standard_Integer BUC60870(Draw_Interpretor& di, Standard_Integer argc, co
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer BUC60902(Draw_Interpretor& di,
|
||||
Standard_Integer /*argc*/,
|
||||
const char** /*argv*/)
|
||||
{
|
||||
Handle(TColgp_HArray1OfPnt) aPnts = new TColgp_HArray1OfPnt(1, 5);
|
||||
gp_Pnt aP(0., 0., 0.);
|
||||
for (Standard_Integer i = 1; i <= 5; i++)
|
||||
{
|
||||
aP.SetX((i - 1) * 1.57);
|
||||
aP.SetY(Sin((i - 1) * 1.57));
|
||||
aPnts->SetValue(i, aP);
|
||||
}
|
||||
GeomAPI_Interpolate anInterpolater(aPnts, Standard_False, Precision::Confusion());
|
||||
anInterpolater.Perform();
|
||||
if (!anInterpolater.IsDone())
|
||||
{
|
||||
di << "Faulty : error in interpolation\n";
|
||||
return 1;
|
||||
}
|
||||
Handle(Geom_BSplineCurve) aCur = anInterpolater.Curve();
|
||||
gp_Vec aFirstTang, aLastTang;
|
||||
aCur->D1(aCur->FirstParameter(), aP, aFirstTang);
|
||||
aCur->D1(aCur->LastParameter(), aP, aLastTang);
|
||||
di << " Used Tang1 = " << aFirstTang.X() << " " << aFirstTang.Y() << " " << aFirstTang.Z()
|
||||
<< "\n";
|
||||
di << " Used Tang2 = " << aLastTang.X() << " " << aLastTang.Y() << " " << aLastTang.Z() << "\n";
|
||||
GeomAPI_Interpolate anInterpolater1(aPnts, Standard_False, Precision::Confusion());
|
||||
anInterpolater1.Load(aFirstTang, aLastTang, Standard_False);
|
||||
anInterpolater1.Perform();
|
||||
if (!anInterpolater1.IsDone())
|
||||
{
|
||||
di << "Faulty : error in interpolation 1\n";
|
||||
return 1;
|
||||
}
|
||||
aCur = anInterpolater1.Curve();
|
||||
gp_Vec aFirstTang1, aLastTang1;
|
||||
aCur->D1(aCur->FirstParameter(), aP, aFirstTang1);
|
||||
aCur->D1(aCur->LastParameter(), aP, aLastTang1);
|
||||
di << " Tang1 after compute = " << aFirstTang1.X() << " " << aFirstTang1.Y() << " "
|
||||
<< aFirstTang1.Z() << "\n";
|
||||
di << " Tang2 after compute = " << aLastTang1.X() << " " << aLastTang1.Y() << " "
|
||||
<< aLastTang1.Z() << "\n";
|
||||
if (aFirstTang.IsEqual(aFirstTang1, Precision::Confusion(), Precision::Angular()))
|
||||
{
|
||||
di << "First tangent is OK\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
di << "Faulty : first tangent is wrong\n";
|
||||
}
|
||||
if (aLastTang.IsEqual(aLastTang1, Precision::Confusion(), Precision::Angular()))
|
||||
{
|
||||
di << "Last tangent is OK\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
di << "Faulty : last tangent is wrong\n";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer BUC60944(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
@@ -1109,103 +1048,6 @@ static Standard_Integer OCC2932_SetRelation(Draw_Interpretor& di,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer OCC3277(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
{
|
||||
di << "Usage : " << argv[0] << " string\n";
|
||||
return 1;
|
||||
}
|
||||
TCollection_ExtendedString ExtendedString;
|
||||
TCollection_ExtendedString InputString(argv[1]);
|
||||
ExtendedString.Cat(InputString);
|
||||
// ExtendedString.Print(std::cout);
|
||||
Standard_SStream aSStream;
|
||||
ExtendedString.Print(aSStream);
|
||||
di << aSStream;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer OCC6794(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc > 2)
|
||||
{
|
||||
di << "Usage: " << argv[0] << " [nb]\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
char* max = ::getenv("MMGT_THRESHOLD");
|
||||
|
||||
Standard_Integer aNb = 1;
|
||||
if (max)
|
||||
aNb += Draw::Atoi(max);
|
||||
else
|
||||
aNb += 40000;
|
||||
|
||||
if (argc > 1)
|
||||
aNb = Draw::Atoi(argv[1]);
|
||||
|
||||
di << "Use nb = " << aNb << "\n";
|
||||
|
||||
const char* c = "a";
|
||||
{
|
||||
TCollection_AsciiString anAscii;
|
||||
for (int i = 1; i <= aNb; i++)
|
||||
{
|
||||
anAscii += TCollection_AsciiString(c);
|
||||
}
|
||||
Standard_Integer aLength = anAscii.Length();
|
||||
di << "aLength = " << aLength << "\n";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer OCC16485(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc > 1)
|
||||
{
|
||||
di << "Usage: " << argv[0] << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Create points with X coordinate from varying from 0. to 1000.
|
||||
// anc compute cumulative bounding box by adding boxes for all the
|
||||
// points, enlarged on tolerance
|
||||
|
||||
Standard_Real tol = 1e-3;
|
||||
int nbstep = 1000;
|
||||
Bnd_Box Box;
|
||||
for (int i = 0; i <= nbstep; i++)
|
||||
{
|
||||
gp_Pnt p(i, 0., 0.);
|
||||
Bnd_Box B;
|
||||
B.Add(p);
|
||||
B.Enlarge(tol);
|
||||
B.Add(Box);
|
||||
Box = B; // in this case XMin of Box will grow each time
|
||||
}
|
||||
|
||||
Standard_Real xmin, ymin, zmin, xmax, ymax, zmax;
|
||||
Box.Get(xmin, ymin, zmin, xmax, ymax, zmax);
|
||||
// std::cout.precision(16);
|
||||
// std::cout << "Resulting dimensions: Xmin = " << xmin << " , Xmax = " << xmax << " , Tolerance =
|
||||
// " << tol << std::endl;
|
||||
di << "Resulting dimensions: Xmin = " << xmin << " , Xmax = " << xmax << " , Tolerance = " << tol
|
||||
<< "\n";
|
||||
if (Abs(xmin + tol) > 1e-10)
|
||||
di << "TEST FAILED: Xmin must be equal to -1e3!\n";
|
||||
else
|
||||
di << "TEST OK\n";
|
||||
// std::cout << "TEST FAILED: Xmin must be equal to -1e3!" << std::endl;
|
||||
// std::cout << "TEST OK" << std::endl;
|
||||
// di << "TEST FAILED: Xmin must be equal to -1e3!\n";
|
||||
// di << "TEST OK\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Resulting dimensions: Xmin = -0.001 , Xmax = 1000.001 , Tolerance = 0.001
|
||||
// TEST OK
|
||||
|
||||
void QABugs::Commands_14(Draw_Interpretor& theCommands)
|
||||
{
|
||||
const char* group = "QABugs";
|
||||
@@ -1236,7 +1078,6 @@ void QABugs::Commands_14(Draw_Interpretor& theCommands)
|
||||
__FILE__,
|
||||
BUC60870,
|
||||
group);
|
||||
theCommands.Add("BUC60902", "BUC60902", __FILE__, BUC60902, group);
|
||||
theCommands.Add("BUC60944", "BUC60944 path", __FILE__, BUC60944, group);
|
||||
theCommands.Add("BUC60868", "BUC60868 Result Shell", __FILE__, BUC60868, group);
|
||||
theCommands.Add("BUC60924", "BUC60924 curve X Y Z", __FILE__, BUC60924, group);
|
||||
@@ -1282,11 +1123,5 @@ void QABugs::Commands_14(Draw_Interpretor& theCommands)
|
||||
OCC2932_SetRelation,
|
||||
group);
|
||||
|
||||
theCommands.Add("OCC3277", "OCC3277 string", __FILE__, OCC3277, group);
|
||||
|
||||
theCommands.Add("OCC6794", "OCC6794 [nb]", __FILE__, OCC6794, group);
|
||||
|
||||
theCommands.Add("OCC16485", "OCC16485", __FILE__, OCC16485, group);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -98,25 +98,6 @@ static Standard_Integer BUC60848(Draw_Interpretor& di, Standard_Integer argc, co
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer BUC60828(Draw_Interpretor& di,
|
||||
Standard_Integer /*argc*/,
|
||||
const char** /*argv*/)
|
||||
{
|
||||
TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(gp_Pnt(0., 0., 0.), gp_Pnt(0., 0., 1.));
|
||||
Standard_Boolean aValue;
|
||||
aValue = anEdge.Infinite();
|
||||
di << "Initial flag : " << (Standard_Integer)aValue << "\n";
|
||||
anEdge.Infinite(Standard_True);
|
||||
Standard_Boolean aValue1;
|
||||
aValue1 = anEdge.Infinite();
|
||||
di << "Current flag : " << (Standard_Integer)aValue1 << "\n";
|
||||
if (aValue1)
|
||||
di << "Flag was set properly.\n";
|
||||
else
|
||||
di << "Faulty : flag was not set properly.\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer BUC60814(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc != 1)
|
||||
@@ -418,65 +399,6 @@ static Standard_Integer OCC49(Draw_Interpretor& di, Standard_Integer argc, const
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer OCC132(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
/*
|
||||
OCC132:
|
||||
=======
|
||||
|
||||
... the validation of the name of files in Analyse_DOS and Analyse_UNIX is :
|
||||
|
||||
characters not allowed in DOS/WNT names are
|
||||
/
|
||||
:
|
||||
*
|
||||
?
|
||||
"
|
||||
<
|
||||
>
|
||||
|
|
||||
and more than one dot in filename.
|
||||
*/
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
di << "Usage : " << argv[0] << " DependentName\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
OSD_SysType SysType1 = OSD_OS2;
|
||||
OSD_SysType SysType2 = OSD_WindowsNT;
|
||||
|
||||
{
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
OSD_Path Path(argv[1], SysType1);
|
||||
}
|
||||
catch (Standard_ProgramError const&)
|
||||
{
|
||||
di << "1\n";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
OSD_Path Path(argv[1], SysType2);
|
||||
}
|
||||
catch (Standard_ProgramError const&)
|
||||
{
|
||||
di << "2\n";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
di << "0\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer OCC405(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc != 4)
|
||||
@@ -758,14 +680,12 @@ void QABugs::Commands_16(Draw_Interpretor& theCommands)
|
||||
const char* group = "QABugs";
|
||||
|
||||
theCommands.Add("BUC60848", "BUC60848 shape", __FILE__, BUC60848, group);
|
||||
theCommands.Add("BUC60828", "BUC60828", __FILE__, BUC60828, group);
|
||||
theCommands.Add("BUC60814", "BUC60814", __FILE__, BUC60814, group);
|
||||
theCommands.Add("BUC60774", "BUC60774", __FILE__, BUC60774, group);
|
||||
theCommands.Add("BUC60972", "BUC60972 edge edge plane val text ", __FILE__, BUC60972, group);
|
||||
theCommands.Add("OCC218", "OCC218 name plane Xlabel Ylabel", __FILE__, OCC218bug, group);
|
||||
theCommands.Add("OCC295", "OCC295 edge_result edge1 edge2", __FILE__, OCC295, group);
|
||||
theCommands.Add("OCC49", "OCC49 name", __FILE__, OCC49, group);
|
||||
theCommands.Add("OCC132", "OCC132 DependentName", __FILE__, OCC132, group);
|
||||
theCommands.Add("OCC405",
|
||||
"OCC405 edge_result edge1 edge2; merge two edges",
|
||||
__FILE__,
|
||||
|
||||
@@ -51,11 +51,23 @@
|
||||
#include <ViewerTest.hxx>
|
||||
#include <XmlDrivers_DocumentRetrievalDriver.hxx>
|
||||
#include <XmlDrivers_DocumentStorageDriver.hxx>
|
||||
#include <TDataStd_Name.hxx>
|
||||
#include <TDataStd_Real.hxx>
|
||||
#include <TDocStd_Application.hxx>
|
||||
#include <TDocStd_Document.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <DDocStd.hxx>
|
||||
#include <XCAFDoc_ShapeTool.hxx>
|
||||
#include <XCAFDoc_DocumentTool.hxx>
|
||||
#include <Draw.hxx>
|
||||
#include <GeomInt_IntSS.hxx>
|
||||
#include <IntTools_FaceFace.hxx>
|
||||
#include <IntTools_SequenceOfPntOn2Faces.hxx>
|
||||
#include <IntTools_SequenceOfCurves.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
#include <Geom_ConicalSurface.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <Extrema_FuncPSNorm.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
@@ -77,8 +89,26 @@ Standard_DISABLE_DEPRECATION_WARNINGS
|
||||
#define QCOMPARE(val1, val2) \
|
||||
di << "Checking " #val1 " == " #val2 << ((val1) == (val2) ? ": OK\n" : ": Error\n")
|
||||
|
||||
static Standard_Integer
|
||||
OCC230(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
#define QVERIFY(val) \
|
||||
if (!(val)) \
|
||||
{ \
|
||||
std::cout << "Error: " #val " is false\n"; \
|
||||
}
|
||||
|
||||
// Helper function to create conical surface
|
||||
static Handle(Geom_Surface)
|
||||
CreateCone(const gp_Pnt& theApex,
|
||||
const gp_Dir& theDir,
|
||||
const gp_Dir& theXDir,
|
||||
Standard_Real theR,
|
||||
Standard_Real theSemiAngle,
|
||||
Standard_Real /*theH*/)
|
||||
{
|
||||
gp_Ax3 anAxis(theApex, theDir, theXDir);
|
||||
return new Geom_ConicalSurface(anAxis, theSemiAngle, theR);
|
||||
}
|
||||
|
||||
static Standard_Integer OCC230(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc != 4)
|
||||
{
|
||||
@@ -104,91 +134,6 @@ Standard_DISABLE_DEPRECATION_WARNINGS
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer OCC23361(Draw_Interpretor& di,
|
||||
Standard_Integer /*argc*/,
|
||||
const char** /*argv*/)
|
||||
{
|
||||
gp_Pnt p(0, 0, 2);
|
||||
|
||||
gp_Trsf t1, t2;
|
||||
t1.SetRotation(gp_Ax1(p, gp_Dir(gp_Dir::D::Y)), -0.49328285294022267);
|
||||
t2.SetRotation(gp_Ax1(p, gp_Dir(gp_Dir::D::Z)), 0.87538474718473880);
|
||||
|
||||
gp_Trsf tComp = t2 * t1;
|
||||
|
||||
gp_Pnt p1(10, 3, 4);
|
||||
gp_Pnt p2 = p1.Transformed(tComp);
|
||||
gp_Pnt p3 = p1.Transformed(t1);
|
||||
p3.Transform(t2);
|
||||
|
||||
// points must be equal
|
||||
if (!p2.IsEqual(p3, Precision::Confusion()))
|
||||
di << "ERROR OCC23361: equivalent transformations does not produce equal points\n";
|
||||
else
|
||||
di << "OCC23361: OK\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
class IncrementerDecrementer
|
||||
{
|
||||
public:
|
||||
IncrementerDecrementer(std::atomic<int>* theVal, Standard_Boolean thePositive)
|
||||
: myVal(theVal),
|
||||
myPositive(thePositive)
|
||||
{
|
||||
}
|
||||
|
||||
void operator()(const size_t) const
|
||||
{
|
||||
if (myPositive)
|
||||
++(*myVal);
|
||||
else
|
||||
--(*myVal);
|
||||
}
|
||||
|
||||
private:
|
||||
std::atomic<int>* myVal;
|
||||
Standard_Boolean myPositive;
|
||||
};
|
||||
|
||||
static Standard_Integer OCC22980(Draw_Interpretor& di,
|
||||
Standard_Integer /*argc*/,
|
||||
const char** /*argv*/)
|
||||
{
|
||||
std::atomic<int> aSum(0);
|
||||
|
||||
// check returned value
|
||||
QCOMPARE(aSum.fetch_sub(1) - 1, -1);
|
||||
QCOMPARE(aSum.fetch_add(1) + 1, 0);
|
||||
QCOMPARE(aSum.fetch_add(1) + 1, 1);
|
||||
QCOMPARE(aSum.fetch_add(1) + 1, 2);
|
||||
// QCOMPARE (Standard_Atomic_DecrementTest (&aSum), 0);
|
||||
// QCOMPARE (Standard_Atomic_DecrementTest (&aSum), 1);
|
||||
|
||||
// check atomicity
|
||||
aSum = 0;
|
||||
const int N = 1 << 24; // big enough to ensure concurrency
|
||||
|
||||
// increment
|
||||
OSD_Parallel::For(0, N, IncrementerDecrementer(&aSum, true));
|
||||
QCOMPARE(aSum, N);
|
||||
|
||||
// decrement
|
||||
OSD_Parallel::For(0, N, IncrementerDecrementer(&aSum, false));
|
||||
QCOMPARE(aSum, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <TDocStd_Application.hxx>
|
||||
#include <TDocStd_Document.hxx>
|
||||
#include <XCAFDoc_ShapeTool.hxx>
|
||||
#include <XCAFDoc_DocumentTool.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDataStd_Name.hxx>
|
||||
#include <DDocStd.hxx>
|
||||
|
||||
static Standard_Integer OCC23595(Draw_Interpretor& di,
|
||||
Standard_Integer /*argc*/,
|
||||
const char** /*argv*/)
|
||||
@@ -247,16 +192,6 @@ Standard_Integer OCC22611(Draw_Interpretor& di, Standard_Integer argc, const cha
|
||||
return 0;
|
||||
}
|
||||
|
||||
Standard_Integer OCC22595(Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
|
||||
{
|
||||
gp_Mat M0;
|
||||
di << "M0 = "
|
||||
<< " {" << M0(1, 1) << "} {" << M0(1, 2) << "} {" << M0(1, 3) << "}"
|
||||
<< " {" << M0(2, 1) << "} {" << M0(2, 2) << "} {" << M0(2, 3) << "}"
|
||||
<< " {" << M0(1, 1) << "} {" << M0(1, 2) << "} {" << M0(1, 3) << "}";
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
@@ -726,482 +661,6 @@ static Standard_Integer OCC23945(Draw_Interpretor& /*di*/, Standard_Integer n, c
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
static Standard_Integer OCC11758(Draw_Interpretor& di, Standard_Integer n, const char**)
|
||||
{
|
||||
if (n != 1)
|
||||
return 1;
|
||||
|
||||
const char* theStr = "0123456789";
|
||||
Standard_Integer i, j;
|
||||
for (i = 0; i < 5; ++i)
|
||||
{
|
||||
// TCollection_AsciiString(const Standard_CString astring)
|
||||
TCollection_AsciiString a(theStr + i);
|
||||
// IsEqual (const Standard_CString other)const
|
||||
// assert( a == theStr+i );
|
||||
QCOMPARE(a, theStr + i);
|
||||
|
||||
// TCollection_AsciiString(const Standard_CString astring,const Standard_Integer aLen )
|
||||
TCollection_AsciiString b(theStr + i, 3);
|
||||
// assert( b.Length() == 3 );
|
||||
// assert( strncmp( b.ToCString(), theStr+i, 3 ) == 0 );
|
||||
// assert( strlen( b.ToCString() ) == 3 );
|
||||
QCOMPARE(b.Length(), 3);
|
||||
QCOMPARE(strncmp(b.ToCString(), theStr + i, 3), 0);
|
||||
QCOMPARE(b.Length(), 3);
|
||||
|
||||
// TCollection_AsciiString(const Standard_Integer aValue)
|
||||
TCollection_AsciiString c(i);
|
||||
// assert( c.IsIntegerValue() );
|
||||
// assert( c.IntegerValue() == i );
|
||||
QCOMPARE(c.IsIntegerValue(), Standard_True);
|
||||
QCOMPARE(c.IntegerValue(), i);
|
||||
|
||||
// TCollection_AsciiString(const Standard_Real aValue)
|
||||
TCollection_AsciiString d(0.1 * i);
|
||||
// assert( d.IsRealValue() );
|
||||
// assert( TCollection_AsciiString(3.3) == "3.3");
|
||||
QCOMPARE(d.IsRealValue(Standard_True), Standard_True);
|
||||
QCOMPARE(TCollection_AsciiString("3.3!").IsRealValue(Standard_True), Standard_False);
|
||||
QCOMPARE(TCollection_AsciiString("3.3!").IsRealValue(Standard_False), Standard_True);
|
||||
QCOMPARE(TCollection_AsciiString(3.3), "3.3");
|
||||
|
||||
// TCollection_AsciiString(const TCollection_AsciiString& astring)
|
||||
TCollection_AsciiString e(d);
|
||||
// assert( e == d );
|
||||
// assert( e.Length() == d.Length() );
|
||||
// assert( strcmp( e.ToCString(), d.ToCString() ) == 0 );
|
||||
QCOMPARE(e, d);
|
||||
QCOMPARE(e.Length(), d.Length());
|
||||
QCOMPARE(strcmp(e.ToCString(), d.ToCString()), 0);
|
||||
|
||||
// TCollection_AsciiString(const TCollection_AsciiString& astring ,
|
||||
// const Standard_Character other )
|
||||
TCollection_AsciiString f(e, '\a');
|
||||
// assert( f.Length() == e.Length() + 1 );
|
||||
// assert( strncmp( f.ToCString(), e.ToCString(), e.Length() ) == 0 );
|
||||
// assert( f.Value( f.Length() ) == '\a');
|
||||
QCOMPARE(f.Length(), e.Length() + 1);
|
||||
QCOMPARE(strncmp(f.ToCString(), e.ToCString(), e.Length()), 0);
|
||||
QCOMPARE(f.Value(f.Length()), '\a');
|
||||
|
||||
// TCollection_AsciiString(const TCollection_AsciiString& astring ,
|
||||
// const Standard_CString other )
|
||||
TCollection_AsciiString g(f, theStr);
|
||||
// assert( g.Length() == f.Length() + strlen( theStr ));
|
||||
// assert( strncmp( g.ToCString(), f.ToCString(), f.Length() ) == 0 );
|
||||
// assert( g.Search( theStr ) == f.Length() + 1 );
|
||||
QCOMPARE(g.Length(), f.Length() + (Standard_Integer)strlen(theStr));
|
||||
QCOMPARE(strncmp(g.ToCString(), f.ToCString(), f.Length()), 0);
|
||||
QCOMPARE(g.Search(theStr), f.Length() + 1);
|
||||
|
||||
// TCollection_AsciiString(const TCollection_AsciiString& astring ,
|
||||
// const TCollection_AsciiString& other )
|
||||
TCollection_AsciiString h(d, a);
|
||||
// assert( h.Length() == d.Length() + a.Length() );
|
||||
// assert( strncmp( h.ToCString(), d.ToCString(), d.Length() ) == 0 );
|
||||
// assert( strncmp( h.ToCString() + d.Length(), a.ToCString(), a.Length() ) == 0 );
|
||||
QCOMPARE(h.Length(), d.Length() + a.Length());
|
||||
QCOMPARE(strncmp(h.ToCString(), d.ToCString(), d.Length()), 0);
|
||||
QCOMPARE(strncmp(h.ToCString() + d.Length(), a.ToCString(), a.Length()), 0);
|
||||
|
||||
// AssignCat(const Standard_CString other)
|
||||
c.AssignCat(a.ToCString());
|
||||
// assert( c.Length() == 1 + a.Length() );
|
||||
// assert( c.Search( a ) == 2 );
|
||||
QCOMPARE(c.Length(), 1 + a.Length());
|
||||
QCOMPARE(c.Search(a), 2);
|
||||
|
||||
// AssignCat(const TCollection_AsciiString& other)
|
||||
Standard_Integer dl = d.Length();
|
||||
d.AssignCat(a);
|
||||
// assert( d.Length() == dl + a.Length() );
|
||||
// assert( d.Search( a ) == dl + 1 );
|
||||
QCOMPARE(d.Length(), dl + a.Length());
|
||||
QCOMPARE(d.Search(a), dl + 1);
|
||||
|
||||
// Capitalize()
|
||||
TCollection_AsciiString capitalize("aBC");
|
||||
capitalize.Capitalize();
|
||||
// assert( capitalize == "Abc" );
|
||||
QCOMPARE(capitalize, "Abc");
|
||||
|
||||
// Copy(const Standard_CString fromwhere)
|
||||
d = theStr + i;
|
||||
// assert( d == theStr+i );
|
||||
QCOMPARE(d, theStr + i);
|
||||
|
||||
// Copy(const TCollection_AsciiString& fromwhere)
|
||||
d = h;
|
||||
// IsEqual (const TCollection_AsciiString& other)const
|
||||
// assert( d == h );
|
||||
QCOMPARE(d, h);
|
||||
|
||||
// Insert(const Standard_Integer where, const Standard_CString what)
|
||||
dl = d.Length();
|
||||
d.Insert(2, theStr);
|
||||
// assert( d.Length() == dl + strlen( theStr ));
|
||||
// assert( strncmp( d.ToCString() + 1, theStr, strlen( theStr )) == 0 );
|
||||
QCOMPARE(d.Length(), dl + (Standard_Integer)strlen(theStr));
|
||||
QCOMPARE(strncmp(d.ToCString() + 1, theStr, strlen(theStr)), 0);
|
||||
|
||||
// Insert(const Standard_Integer where,const Standard_Character what)
|
||||
d = theStr;
|
||||
d.Insert(i + 1, 'i');
|
||||
// assert( d.Length() == strlen( theStr ) + 1 );
|
||||
// assert( d.Value( i+1 ) == 'i');
|
||||
// assert( strcmp( d.ToCString() + i + 1, theStr+i ) == 0 );
|
||||
QCOMPARE(d.Length(), (Standard_Integer)strlen(theStr) + 1);
|
||||
QCOMPARE(d.Value(i + 1), 'i');
|
||||
QCOMPARE(strcmp(d.ToCString() + i + 1, theStr + i), 0);
|
||||
|
||||
// Insert(const Standard_Integer where,const TCollection_AsciiString& what)
|
||||
d = theStr;
|
||||
d.Insert(i + 1, TCollection_AsciiString("i"));
|
||||
// assert( d.Length() == strlen( theStr ) + 1 );
|
||||
// assert( d.Value( i+1 ) == 'i');
|
||||
// assert( strcmp( d.ToCString() + i + 1, theStr+i ) == 0 );
|
||||
QCOMPARE(d.Length(), (Standard_Integer)strlen(theStr) + 1);
|
||||
QCOMPARE(d.Value(i + 1), 'i');
|
||||
QCOMPARE(strcmp(d.ToCString() + i + 1, theStr + i), 0);
|
||||
|
||||
// IsDifferent (const Standard_CString other)const
|
||||
// assert( d.IsDifferent( theStr ));
|
||||
// assert( d.IsDifferent( "theStr" ));
|
||||
// assert( d.IsDifferent( "" ));
|
||||
// assert( !d.IsDifferent( d.ToCString() ));
|
||||
QCOMPARE(d.IsDifferent(theStr), Standard_True);
|
||||
QCOMPARE(d.IsDifferent("theStr"), Standard_True);
|
||||
QCOMPARE(d.IsDifferent(""), Standard_True);
|
||||
QCOMPARE(!d.IsDifferent(d.ToCString()), Standard_True);
|
||||
|
||||
// IsDifferent (const TCollection_AsciiString& other)const
|
||||
// assert( d.IsDifferent( TCollection_AsciiString() ));
|
||||
// assert( d.IsDifferent( a ));
|
||||
// assert( d.IsDifferent( h ));
|
||||
// assert( !d.IsDifferent( d ));
|
||||
QCOMPARE(d.IsDifferent(TCollection_AsciiString::EmptyString()), Standard_True);
|
||||
QCOMPARE(d.IsDifferent(a), Standard_True);
|
||||
QCOMPARE(d.IsDifferent(h), Standard_True);
|
||||
QCOMPARE(!d.IsDifferent(d), Standard_True);
|
||||
|
||||
// IsLess (const Standard_CString other)const
|
||||
// assert( TCollection_AsciiString ("0"). IsLess("1"));
|
||||
// assert( TCollection_AsciiString ("0"). IsLess("00"));
|
||||
// assert( TCollection_AsciiString (""). IsLess("0"));
|
||||
// assert( !TCollection_AsciiString("1"). IsLess("0"));
|
||||
// assert( !TCollection_AsciiString("00").IsLess("0"));
|
||||
// assert( !TCollection_AsciiString("0"). IsLess(""));
|
||||
// assert( TCollection_AsciiString (theStr+i).IsLess(theStr+i+1));
|
||||
QCOMPARE(TCollection_AsciiString("0").IsLess("1"), Standard_True);
|
||||
QCOMPARE(TCollection_AsciiString("0").IsLess("00"), Standard_True);
|
||||
QCOMPARE(TCollection_AsciiString("").IsLess("0"), Standard_True);
|
||||
QCOMPARE(!TCollection_AsciiString("1").IsLess("0"), Standard_True);
|
||||
QCOMPARE(!TCollection_AsciiString("00").IsLess("0"), Standard_True);
|
||||
QCOMPARE(!TCollection_AsciiString("0").IsLess(""), Standard_True);
|
||||
QCOMPARE(TCollection_AsciiString(theStr + i).IsLess(theStr + i + 1), Standard_True);
|
||||
|
||||
// IsLess (const TCollection_AsciiString& other)const
|
||||
// assert( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("1" )));
|
||||
// assert( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("00")));
|
||||
// assert( TCollection_AsciiString (""). IsLess(TCollection_AsciiString("0" )));
|
||||
// assert( !TCollection_AsciiString("1"). IsLess(TCollection_AsciiString("0" )));
|
||||
// assert( !TCollection_AsciiString("00").IsLess(TCollection_AsciiString("0" )));
|
||||
// assert( !TCollection_AsciiString("0"). IsLess(TCollection_AsciiString("" )));
|
||||
// assert( TCollection_AsciiString (theStr+i).IsLess(TCollection_AsciiString(theStr+i+1)));
|
||||
QCOMPARE(TCollection_AsciiString("0").IsLess(TCollection_AsciiString("1")), Standard_True);
|
||||
QCOMPARE(TCollection_AsciiString("0").IsLess(TCollection_AsciiString("00")), Standard_True);
|
||||
QCOMPARE(TCollection_AsciiString("").IsLess(TCollection_AsciiString("0")), Standard_True);
|
||||
QCOMPARE(!TCollection_AsciiString("1").IsLess(TCollection_AsciiString("0")), Standard_True);
|
||||
QCOMPARE(!TCollection_AsciiString("00").IsLess(TCollection_AsciiString("0")), Standard_True);
|
||||
QCOMPARE(!TCollection_AsciiString("0").IsLess(TCollection_AsciiString("")), Standard_True);
|
||||
QCOMPARE(TCollection_AsciiString(theStr + i).IsLess(TCollection_AsciiString(theStr + i + 1)),
|
||||
Standard_True);
|
||||
|
||||
// IsGreater (const Standard_CString other)const
|
||||
// assert( !TCollection_AsciiString("0"). IsGreater("1"));
|
||||
// assert( !TCollection_AsciiString("0"). IsGreater("00"));
|
||||
// assert( !TCollection_AsciiString(""). IsGreater("0"));
|
||||
// assert( TCollection_AsciiString ("1"). IsGreater("0"));
|
||||
// assert( TCollection_AsciiString ("00").IsGreater("0"));
|
||||
// assert( TCollection_AsciiString ("0"). IsGreater(""));
|
||||
// assert( TCollection_AsciiString (theStr+i+1).IsGreater(theStr+i));
|
||||
QCOMPARE(!TCollection_AsciiString("0").IsGreater("1"), Standard_True);
|
||||
QCOMPARE(!TCollection_AsciiString("0").IsGreater("00"), Standard_True);
|
||||
QCOMPARE(!TCollection_AsciiString("").IsGreater("0"), Standard_True);
|
||||
QCOMPARE(TCollection_AsciiString("1").IsGreater("0"), Standard_True);
|
||||
QCOMPARE(TCollection_AsciiString("00").IsGreater("0"), Standard_True);
|
||||
QCOMPARE(TCollection_AsciiString("0").IsGreater(""), Standard_True);
|
||||
QCOMPARE(TCollection_AsciiString(theStr + i + 1).IsGreater(theStr + i), Standard_True);
|
||||
|
||||
// IsGreater (const TCollection_AsciiString& other)const
|
||||
// assert( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("1" )));
|
||||
// assert( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("00")));
|
||||
// assert( !TCollection_AsciiString(""). IsGreater(TCollection_AsciiString("0" )));
|
||||
// assert( TCollection_AsciiString ("1"). IsGreater(TCollection_AsciiString("0" )));
|
||||
// assert( TCollection_AsciiString ("00").IsGreater(TCollection_AsciiString("0" )));
|
||||
// assert( TCollection_AsciiString ("0"). IsGreater(TCollection_AsciiString("" )));
|
||||
// assert( TCollection_AsciiString (theStr+i+1).IsGreater(TCollection_AsciiString(theStr+i)));
|
||||
QCOMPARE(!TCollection_AsciiString("0").IsGreater(TCollection_AsciiString("1")), Standard_True);
|
||||
QCOMPARE(!TCollection_AsciiString("0").IsGreater(TCollection_AsciiString("00")), Standard_True);
|
||||
QCOMPARE(!TCollection_AsciiString("").IsGreater(TCollection_AsciiString("0")), Standard_True);
|
||||
QCOMPARE(TCollection_AsciiString("1").IsGreater(TCollection_AsciiString("0")), Standard_True);
|
||||
QCOMPARE(TCollection_AsciiString("00").IsGreater(TCollection_AsciiString("0")), Standard_True);
|
||||
QCOMPARE(TCollection_AsciiString("0").IsGreater(TCollection_AsciiString("")), Standard_True);
|
||||
QCOMPARE(TCollection_AsciiString(theStr + i + 1).IsGreater(TCollection_AsciiString(theStr + i)),
|
||||
Standard_True);
|
||||
|
||||
// void Read(Standard_IStream& astream)
|
||||
std::istringstream is(theStr);
|
||||
e.Read(is);
|
||||
// assert( e == theStr );
|
||||
QCOMPARE(e, theStr);
|
||||
|
||||
// Standard_Integer SearchFromEnd (const Standard_CString what)const
|
||||
// assert( e.SearchFromEnd( theStr + i ) == i + 1 );
|
||||
QCOMPARE(e.SearchFromEnd(theStr + i), i + 1);
|
||||
|
||||
// SetValue(const Standard_Integer where, const Standard_CString what)
|
||||
e.SetValue(i + 1, "what");
|
||||
// assert( e.Search( "what" ) == i+1 );
|
||||
// assert( e.Length() == strlen( theStr ));
|
||||
QCOMPARE(e.Search("what"), i + 1);
|
||||
QCOMPARE(e.Length(), (Standard_Integer)strlen(theStr));
|
||||
|
||||
// TCollection_AsciiString Split (const Standard_Integer where)
|
||||
e = theStr;
|
||||
d = e.Split(i + 1);
|
||||
// assert( d.Length() + e.Length() == strlen( theStr ));
|
||||
QCOMPARE(d.Length() + e.Length(), (Standard_Integer)strlen(theStr));
|
||||
|
||||
// TCollection_AsciiString SubString (const Standard_Integer FromIndex,
|
||||
// const Standard_Integer ToIndex) const
|
||||
e = theStr;
|
||||
d = e.SubString((unsigned int)i + 1, (unsigned int)i + 3);
|
||||
// assert( d.Length() == 3 );
|
||||
// assert( d.Value(1) == theStr[ i ]);
|
||||
QCOMPARE(d.Length(), 3);
|
||||
QCOMPARE(d.Value(1), theStr[i]);
|
||||
|
||||
// TCollection_AsciiString Token (const Standard_CString separators,
|
||||
// const Standard_Integer whichone) const
|
||||
e = " ";
|
||||
for (j = 0; j < i; ++j)
|
||||
{
|
||||
e += TCollection_AsciiString(theStr[j]) + " ";
|
||||
// assert( e.Token(" ", j+1 ) == TCollection_AsciiString( theStr+j, 1 ));
|
||||
QCOMPARE(e.Token(" ", j + 1), TCollection_AsciiString(theStr + j, 1));
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 5; ++i)
|
||||
{
|
||||
// TCollection_ExtendedString (const Standard_CString astring,
|
||||
// const Standard_Boolean isMultiByte)
|
||||
const TCollection_ExtendedString a(theStr + i);
|
||||
// assert( TCollection_AsciiString( a ) == theStr+i );
|
||||
QCOMPARE(TCollection_AsciiString(a), theStr + i);
|
||||
|
||||
// TCollection_ExtendedString (const Standard_ExtString astring)
|
||||
const TCollection_ExtendedString b(a.ToExtString());
|
||||
// assert( a == b );
|
||||
QCOMPARE(a, b);
|
||||
|
||||
// TCollection_ExtendedString (const Standard_Integer length,
|
||||
// const Standard_ExtCharacter filler )
|
||||
const TCollection_ExtendedString c(i, 1);
|
||||
// assert( c.Length() == i );
|
||||
QCOMPARE(c.Length(), i);
|
||||
if (c.Length() > 0)
|
||||
{
|
||||
// assert( c.Value( i ) == 1 );
|
||||
QCOMPARE(c.Value(i), 1);
|
||||
}
|
||||
|
||||
// TCollection_ExtendedString (const Standard_Integer aValue)
|
||||
TCollection_ExtendedString d(i);
|
||||
const TCollection_AsciiString da(d);
|
||||
// assert( da.IsIntegerValue() );
|
||||
// assert( da.IntegerValue() == i );
|
||||
QCOMPARE(da.IsIntegerValue(), Standard_True);
|
||||
QCOMPARE(da.IntegerValue(), i);
|
||||
|
||||
// TCollection_ExtendedString (const Standard_Real aValue)
|
||||
const TCollection_ExtendedString e(0.1 * i);
|
||||
const TCollection_AsciiString ea(e);
|
||||
// assert( ea.IsRealValue() );
|
||||
// assert( Abs( ea.RealValue() - 0.1 * i ) < 1e-10 );
|
||||
QCOMPARE(ea.IsRealValue(), Standard_True);
|
||||
QCOMPARE(Abs(ea.RealValue() - 0.1 * i) < 1e-10, Standard_True);
|
||||
|
||||
// TCollection_ExtendedString (const TCollection_ExtendedString& astring)
|
||||
const TCollection_ExtendedString& f(e);
|
||||
// assert( f.Length() == e.Length());
|
||||
// assert( f == e );
|
||||
QCOMPARE(f.Length(), e.Length());
|
||||
QCOMPARE(f, e);
|
||||
|
||||
// TCollection_ExtendedString (const TCollection_AsciiString& astring)
|
||||
const TCollection_ExtendedString g(ea);
|
||||
// assert( g.Length() == ea.Length() );
|
||||
// assert( TCollection_AsciiString( g ) == ea );
|
||||
QCOMPARE(g.Length(), ea.Length());
|
||||
QCOMPARE(TCollection_AsciiString(g), ea);
|
||||
|
||||
// AssignCat (const TCollection_ExtendedString& other)
|
||||
const TCollection_ExtendedString sep(",");
|
||||
d.AssignCat(sep);
|
||||
d.AssignCat(g);
|
||||
// assert( d.Length() == 2 + g.Length() );
|
||||
// assert( d.Token( sep.ToExtString(), 1 ) == TCollection_ExtendedString( i ));
|
||||
// assert( d.Token( sep.ToExtString(), 2 ) == g );
|
||||
QCOMPARE(d.Length(), 2 + g.Length());
|
||||
QCOMPARE(d.Token(sep.ToExtString(), 1), TCollection_ExtendedString(i));
|
||||
QCOMPARE(d.Token(sep.ToExtString(), 2), g);
|
||||
|
||||
// TCollection_ExtendedString Cat (const TCollection_ExtendedString& other) const
|
||||
const TCollection_ExtendedString cat = a.Cat(sep);
|
||||
// assert( cat.Length() == a.Length() + sep.Length() );
|
||||
// assert( cat.Search( a ) == 1 );
|
||||
// assert( cat.Search( sep ) == a.Length() + 1 );
|
||||
QCOMPARE(cat.Length(), a.Length() + sep.Length());
|
||||
QCOMPARE(cat.Search(a), 1);
|
||||
QCOMPARE(cat.Search(sep), a.Length() + 1);
|
||||
|
||||
// Copy (const TCollection_ExtendedString& fromwhere)
|
||||
d = cat;
|
||||
// assert( d.Length() == cat.Length() );
|
||||
// assert( d == cat );
|
||||
QCOMPARE(d.Length(), cat.Length());
|
||||
QCOMPARE(d, cat);
|
||||
|
||||
// IsEqual (const Standard_ExtString other) const
|
||||
// assert( d.IsEqual( d.ToExtString() ));
|
||||
QCOMPARE(d.IsEqual(d.ToExtString()), Standard_True);
|
||||
|
||||
// IsDifferent (const Standard_ExtString other ) const
|
||||
// assert( d.IsDifferent( a.ToExtString() ));
|
||||
QCOMPARE(d.IsDifferent(a.ToExtString()), Standard_True);
|
||||
|
||||
// IsDifferent (const TCollection_ExtendedString& other) const
|
||||
// assert( d.IsDifferent( a ));
|
||||
QCOMPARE(d.IsDifferent(a), Standard_True);
|
||||
|
||||
// IsLess (const Standard_ExtString other) const
|
||||
const TCollection_ExtendedString l0("0"), l1("1"), l00("00"), l, ls(theStr + i),
|
||||
ls1(theStr + i + 1);
|
||||
// assert( l0. IsLess( l1.ToExtString() ));
|
||||
// assert( l0. IsLess( l00.ToExtString() ));
|
||||
// assert( l. IsLess( l0.ToExtString() ));
|
||||
// assert( ! l1. IsLess( l0.ToExtString() ));
|
||||
// assert( ! l00.IsLess( l0.ToExtString() ));
|
||||
// assert( ! l0. IsLess( l.ToExtString() ));
|
||||
// assert( ls.IsLess( ls1.ToExtString() ));
|
||||
QCOMPARE(l0.IsLess(l1.ToExtString()), Standard_True);
|
||||
QCOMPARE(l0.IsLess(l00.ToExtString()), Standard_True);
|
||||
QCOMPARE(l.IsLess(l0.ToExtString()), Standard_True);
|
||||
QCOMPARE(!l1.IsLess(l0.ToExtString()), Standard_True);
|
||||
QCOMPARE(!l00.IsLess(l0.ToExtString()), Standard_True);
|
||||
QCOMPARE(!l0.IsLess(l.ToExtString()), Standard_True);
|
||||
QCOMPARE(ls.IsLess(ls1.ToExtString()), Standard_True);
|
||||
|
||||
// IsLess (const TCollection_ExtendedString& other) const
|
||||
// assert( l0. IsLess( l1 ));
|
||||
// assert( l0. IsLess( l00 ));
|
||||
// assert( l. IsLess( l0 ));
|
||||
// assert( ! l1. IsLess( l0 ));
|
||||
// assert( ! l00.IsLess( l0 ));
|
||||
// assert( ! l0. IsLess( l ));
|
||||
// assert( ls.IsLess( ls1 ));
|
||||
QCOMPARE(l0.IsLess(l1), Standard_True);
|
||||
QCOMPARE(l0.IsLess(l00), Standard_True);
|
||||
QCOMPARE(l.IsLess(l0), Standard_True);
|
||||
QCOMPARE(!l1.IsLess(l0), Standard_True);
|
||||
QCOMPARE(!l00.IsLess(l0), Standard_True);
|
||||
QCOMPARE(!l0.IsLess(l), Standard_True);
|
||||
QCOMPARE(ls.IsLess(ls1), Standard_True);
|
||||
|
||||
// IsGreater (const Standard_ExtString other) const
|
||||
// assert( ! l0.IsGreater( l1.ToExtString() ));
|
||||
// assert( ! l0.IsGreater( l00.ToExtString() ));
|
||||
// assert( ! l. IsGreater( l0.ToExtString() ));
|
||||
// assert( l1. IsGreater( l0.ToExtString() ));
|
||||
// assert( l00.IsGreater( l0.ToExtString() ));
|
||||
// assert( l0. IsGreater( l.ToExtString() ));
|
||||
// assert( ls1.IsGreater( ls.ToExtString() ));
|
||||
QCOMPARE(!l0.IsGreater(l1.ToExtString()), Standard_True);
|
||||
QCOMPARE(!l0.IsGreater(l00.ToExtString()), Standard_True);
|
||||
QCOMPARE(!l.IsGreater(l0.ToExtString()), Standard_True);
|
||||
QCOMPARE(l1.IsGreater(l0.ToExtString()), Standard_True);
|
||||
QCOMPARE(l00.IsGreater(l0.ToExtString()), Standard_True);
|
||||
QCOMPARE(l0.IsGreater(l.ToExtString()), Standard_True);
|
||||
QCOMPARE(ls1.IsGreater(ls.ToExtString()), Standard_True);
|
||||
|
||||
// IsGreater (const TCollection_ExtendedString& other) const
|
||||
// assert( ! l0.IsGreater( l1));
|
||||
// assert( ! l0.IsGreater( l00));
|
||||
// assert( ! l. IsGreater( l0));
|
||||
// assert( l1. IsGreater( l0));
|
||||
// assert( l00.IsGreater( l0));
|
||||
// assert( l0. IsGreater( l));
|
||||
// assert( ls1.IsGreater( ls));
|
||||
QCOMPARE(!l0.IsGreater(l1), Standard_True);
|
||||
QCOMPARE(!l0.IsGreater(l00), Standard_True);
|
||||
QCOMPARE(!l.IsGreater(l0), Standard_True);
|
||||
QCOMPARE(l1.IsGreater(l0), Standard_True);
|
||||
QCOMPARE(l00.IsGreater(l0), Standard_True);
|
||||
QCOMPARE(l0.IsGreater(l), Standard_True);
|
||||
QCOMPARE(ls1.IsGreater(ls), Standard_True);
|
||||
|
||||
// ==========================
|
||||
// TCollection_HAsciiString::
|
||||
// ==========================
|
||||
|
||||
// IsDifferent(const Handle(TCollection_HAsciiString)& S)
|
||||
Handle(TCollection_HAsciiString) ha1 = new TCollection_HAsciiString(theStr + i);
|
||||
Handle(TCollection_HAsciiString) ha2 = new TCollection_HAsciiString(theStr + i + 1);
|
||||
// assert( ha1->IsDifferent( ha2 ));
|
||||
// assert( !ha1->IsDifferent( ha1 ));
|
||||
QCOMPARE(ha1->IsDifferent(ha2), Standard_True);
|
||||
QCOMPARE(!ha1->IsDifferent(ha1), Standard_True);
|
||||
|
||||
// IsSameString (const Handle(TCollection_HAsciiString)& S)
|
||||
// assert( !ha1->IsSameString( ha2 ));
|
||||
// assert( ha1->IsSameString( ha1 ));
|
||||
QCOMPARE(!ha1->IsSameString(ha2), Standard_True);
|
||||
QCOMPARE(ha1->IsSameString(ha1), Standard_True);
|
||||
|
||||
// IsSameState (const Handle(TCollection_HAsciiString)& other) const
|
||||
// assert( !ha1->IsSameState( ha2 ));
|
||||
// assert( ha1->IsSameState( ha1 ));
|
||||
QCOMPARE(!ha1->IsSameState(ha2), Standard_True);
|
||||
QCOMPARE(ha1->IsSameState(ha1), Standard_True);
|
||||
|
||||
// IsSameString (const Handle(TCollection_HAsciiString)& S ,
|
||||
// const Standard_Boolean CaseSensitive) const
|
||||
// assert( !ha1->IsSameString( ha2, true ));
|
||||
// assert( ha1->IsSameString( ha1, true ));
|
||||
// assert( !ha1->IsSameString( ha2, false ));
|
||||
// assert( ha1->IsSameString( ha1, false ));
|
||||
QCOMPARE(!ha1->IsSameString(ha2, Standard_True), Standard_True);
|
||||
QCOMPARE(ha1->IsSameString(ha1, Standard_True), Standard_True);
|
||||
QCOMPARE(!ha1->IsSameString(ha2, Standard_False), Standard_True);
|
||||
QCOMPARE(ha1->IsSameString(ha1, Standard_False), Standard_True);
|
||||
|
||||
ha1->SetValue(1, "AbC0000000");
|
||||
ha2->SetValue(1, "aBc0000000");
|
||||
// assert( !ha1->IsSameString( ha2, true ));
|
||||
// assert( ha1->IsSameString( ha2, false ));
|
||||
QCOMPARE(!ha1->IsSameString(ha2, Standard_True), Standard_True);
|
||||
QCOMPARE(ha1->IsSameString(ha2, Standard_False), Standard_True);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
#include <IntTools_FaceFace.hxx>
|
||||
#include <IntTools_Curve.hxx>
|
||||
#include <IntTools_PntOn2Faces.hxx>
|
||||
|
||||
static Standard_Integer OCC24005(Draw_Interpretor& theDI,
|
||||
Standard_Integer theNArg,
|
||||
const char** theArgv)
|
||||
@@ -1404,123 +863,6 @@ static Standard_Integer OCC24137(Draw_Interpretor& theDI,
|
||||
}
|
||||
|
||||
//! Check boolean operations on NCollection_Map
|
||||
static Standard_Integer OCC24271(Draw_Interpretor& di,
|
||||
Standard_Integer /*theArgNb*/,
|
||||
const char** /*theArgVec*/)
|
||||
{
|
||||
// input data
|
||||
const Standard_Integer aLeftLower = 1;
|
||||
const Standard_Integer aLeftUpper = 10;
|
||||
const Standard_Integer aRightLower = 5;
|
||||
const Standard_Integer aRightUpper = 15;
|
||||
|
||||
// define arguments
|
||||
NCollection_Map<Standard_Integer> aMapLeft;
|
||||
for (Standard_Integer aKeyIter = aLeftLower; aKeyIter <= aLeftUpper; ++aKeyIter)
|
||||
{
|
||||
aMapLeft.Add(aKeyIter);
|
||||
}
|
||||
|
||||
NCollection_Map<Standard_Integer> aMapRight;
|
||||
for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aRightUpper; ++aKeyIter)
|
||||
{
|
||||
aMapRight.Add(aKeyIter);
|
||||
}
|
||||
|
||||
QCOMPARE(NCollection_MapAlgo::Contains(aMapLeft, aMapRight), Standard_False);
|
||||
QCOMPARE(NCollection_MapAlgo::Contains(aMapRight, aMapLeft), Standard_False);
|
||||
|
||||
// validate Union operation
|
||||
NCollection_Map<Standard_Integer> aMapUnion;
|
||||
NCollection_MapAlgo::Union(aMapUnion, aMapLeft, aMapRight);
|
||||
QCOMPARE(aMapUnion.Extent(), aRightUpper - aLeftLower + 1);
|
||||
for (Standard_Integer aKeyIter = aLeftLower; aKeyIter <= aRightUpper; ++aKeyIter)
|
||||
{
|
||||
QCOMPARE(aMapUnion.Contains(aKeyIter), Standard_True);
|
||||
}
|
||||
|
||||
// validate Intersection operation
|
||||
NCollection_Map<Standard_Integer> aMapSect;
|
||||
NCollection_MapAlgo::Intersection(aMapSect, aMapLeft, aMapRight);
|
||||
QCOMPARE(aMapSect.Extent(), aLeftUpper - aRightLower + 1);
|
||||
for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aLeftUpper; ++aKeyIter)
|
||||
{
|
||||
QCOMPARE(aMapSect.Contains(aKeyIter), Standard_True);
|
||||
}
|
||||
QCOMPARE(NCollection_MapAlgo::Contains(aMapLeft, aMapSect), Standard_True);
|
||||
QCOMPARE(NCollection_MapAlgo::Contains(aMapRight, aMapSect), Standard_True);
|
||||
|
||||
// validate Substruction operation
|
||||
NCollection_Map<Standard_Integer> aMapSubsLR;
|
||||
NCollection_MapAlgo::Subtraction(aMapSubsLR, aMapLeft, aMapRight);
|
||||
QCOMPARE(aMapSubsLR.Extent(), aRightLower - aLeftLower);
|
||||
for (Standard_Integer aKeyIter = aLeftLower; aKeyIter < aRightLower; ++aKeyIter)
|
||||
{
|
||||
QCOMPARE(aMapSubsLR.Contains(aKeyIter), Standard_True);
|
||||
}
|
||||
|
||||
NCollection_Map<Standard_Integer> aMapSubsRL;
|
||||
NCollection_MapAlgo::Subtraction(aMapSubsRL, aMapRight, aMapLeft);
|
||||
QCOMPARE(aMapSubsRL.Extent(), aRightUpper - aLeftUpper);
|
||||
for (Standard_Integer aKeyIter = aLeftUpper + 1; aKeyIter < aRightUpper; ++aKeyIter)
|
||||
{
|
||||
QCOMPARE(aMapSubsRL.Contains(aKeyIter), Standard_True);
|
||||
}
|
||||
|
||||
// validate Difference operation
|
||||
NCollection_Map<Standard_Integer> aMapDiff;
|
||||
NCollection_MapAlgo::Difference(aMapDiff, aMapLeft, aMapRight);
|
||||
QCOMPARE(aMapDiff.Extent(), aRightLower - aLeftLower + aRightUpper - aLeftUpper);
|
||||
for (Standard_Integer aKeyIter = aLeftLower; aKeyIter < aRightLower; ++aKeyIter)
|
||||
{
|
||||
QCOMPARE(aMapDiff.Contains(aKeyIter), Standard_True);
|
||||
}
|
||||
for (Standard_Integer aKeyIter = aLeftUpper + 1; aKeyIter < aRightUpper; ++aKeyIter)
|
||||
{
|
||||
QCOMPARE(aMapDiff.Contains(aKeyIter), Standard_True);
|
||||
}
|
||||
|
||||
// validate Exchange operation
|
||||
NCollection_Map<Standard_Integer> aMapSwap;
|
||||
aMapSwap.Exchange(aMapSect);
|
||||
for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aLeftUpper; ++aKeyIter)
|
||||
{
|
||||
QCOMPARE(aMapSwap.Contains(aKeyIter), Standard_True);
|
||||
}
|
||||
QCOMPARE(aMapSect.IsEmpty(), Standard_True);
|
||||
aMapSwap.Add(34);
|
||||
aMapSect.Add(43);
|
||||
|
||||
NCollection_Map<Standard_Integer> aMapCopy(aMapSwap);
|
||||
QCOMPARE(NCollection_MapAlgo::IsEqual(aMapCopy, aMapSwap), Standard_True);
|
||||
aMapCopy.Remove(34);
|
||||
aMapCopy.Add(43);
|
||||
QCOMPARE(NCollection_MapAlgo::IsEqual(aMapCopy, aMapSwap), Standard_False);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define QVERIFY(val1) \
|
||||
di << "Checking " #val1 " == Standard_True" << ((val1) == Standard_True ? ": OK\n" : ": Error\n")
|
||||
|
||||
#include <Geom_ConicalSurface.hxx>
|
||||
|
||||
namespace
|
||||
{
|
||||
static Handle(Geom_ConicalSurface) CreateCone(const gp_Pnt& theLoc,
|
||||
const gp_Dir& theDir,
|
||||
const gp_Dir& theXDir,
|
||||
const Standard_Real theRad,
|
||||
const Standard_Real theSin,
|
||||
const Standard_Real theCos)
|
||||
{
|
||||
const Standard_Real anA = atan(theSin / theCos);
|
||||
gp_Ax3 anAxis(theLoc, theDir, theXDir);
|
||||
Handle(Geom_ConicalSurface) aSurf = new Geom_ConicalSurface(anAxis, anA, theRad);
|
||||
return aSurf;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
static Standard_Integer OCC23972(Draw_Interpretor& /*theDI*/,
|
||||
Standard_Integer theNArg,
|
||||
const char** theArgs)
|
||||
@@ -1621,42 +963,6 @@ static Standard_Integer OCC24370(Draw_Interpretor& di, Standard_Integer argc, co
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename T, typename HT>
|
||||
static void DoIsNull(Draw_Interpretor& di)
|
||||
{
|
||||
HT aHandle;
|
||||
// QVERIFY (aHandle.IsNull());
|
||||
QCOMPARE(aHandle.IsNull(), Standard_True);
|
||||
const T* p = aHandle.get();
|
||||
#if OCC_VERSION_HEX > 0x060700
|
||||
// QVERIFY (!p);
|
||||
// QVERIFY (p == 0);
|
||||
QCOMPARE(!p, Standard_True);
|
||||
QCOMPARE(p == 0, Standard_True);
|
||||
#endif
|
||||
|
||||
aHandle = new T;
|
||||
// QVERIFY (!aHandle.IsNull());
|
||||
QCOMPARE(!aHandle.IsNull(), Standard_True);
|
||||
p = aHandle.get();
|
||||
// QVERIFY (p);
|
||||
// QVERIFY (p != 0);
|
||||
QCOMPARE(p != NULL, Standard_True);
|
||||
QCOMPARE(p != 0, Standard_True);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
static Standard_Integer OCC24533(Draw_Interpretor& di, Standard_Integer n, const char**)
|
||||
{
|
||||
if (n != 1)
|
||||
return 1;
|
||||
|
||||
DoIsNull<Standard_Transient, Handle(Standard_Transient)>(di);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Dummy class to test interface for compilation issues
|
||||
class QABugs_HandleClass : public Standard_Transient
|
||||
{
|
||||
@@ -3102,7 +2408,7 @@ struct OCC25545_Functor
|
||||
// purpose : Tests data race when concurrently accessing TopLoc_Location::Transformation()
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer OCC25545(Draw_Interpretor& di, Standard_Integer, const char**)
|
||||
static Standard_Integer OCC25545(Draw_Interpretor& /*di*/, Standard_Integer, const char**)
|
||||
{
|
||||
// Place vertices in a vector, giving the i-th vertex the
|
||||
// transformation that translates it on the vector (i,0,0) from the origin.
|
||||
@@ -5366,11 +4672,8 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands)
|
||||
group);
|
||||
|
||||
theCommands.Add("OCC230", "OCC230 TrimmedCurve Pnt2d Pnt2d", __FILE__, OCC230, group);
|
||||
theCommands.Add("OCC23361", "OCC23361", __FILE__, OCC23361, group);
|
||||
theCommands.Add("OCC22980", "OCC22980", __FILE__, OCC22980, group);
|
||||
theCommands.Add("OCC23595", "OCC23595", __FILE__, OCC23595, group);
|
||||
theCommands.Add("OCC22611", "OCC22611 string nb", __FILE__, OCC22611, group);
|
||||
theCommands.Add("OCC22595", "OCC22595", __FILE__, OCC22595, group);
|
||||
theCommands.Add("OCC23774", "OCC23774 shape1 shape2", __FILE__, OCC23774, group);
|
||||
theCommands.Add("OCC23683", "OCC23683 shape", __FILE__, OCC23683, group);
|
||||
theCommands.Add("OCC23952sweep", "OCC23952sweep nbupoles shape", __FILE__, OCC23952sweep, group);
|
||||
@@ -5387,13 +4690,10 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands)
|
||||
OCC23945,
|
||||
group);
|
||||
theCommands.Add("OCC24008", "OCC24008 curve surface", __FILE__, OCC24008, group);
|
||||
theCommands.Add("OCC11758", "OCC11758", __FILE__, OCC11758, group);
|
||||
theCommands.Add("OCC24005", "OCC24005 result", __FILE__, OCC24005, group);
|
||||
theCommands.Add("OCC24137", "OCC24137 face vertex U V [N]", __FILE__, OCC24137, group);
|
||||
theCommands.Add("OCC24271", "Boolean operations on NCollection_Map", __FILE__, OCC24271, group);
|
||||
theCommands.Add("OCC23972", "OCC23972", __FILE__, OCC23972, group);
|
||||
theCommands.Add("OCC24370", "OCC24370 edge pcurve surface prec", __FILE__, OCC24370, group);
|
||||
theCommands.Add("OCC24533", "OCC24533", __FILE__, OCC24533, group);
|
||||
theCommands.Add("OCC24086", "OCC24086 face wire", __FILE__, OCC24086, group);
|
||||
theCommands.Add("OCC24667",
|
||||
"OCC24667 result Wire_spine Profile [Mode [Approx]], no args to get help",
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <OSD_MemInfo.hxx>
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <TDataStd_AsciiString.hxx>
|
||||
#include <TDataStd_Name.hxx>
|
||||
#include <AppCont_Function.hxx>
|
||||
#include <math_ComputeKronrodPointsAndWeights.hxx>
|
||||
@@ -3075,259 +3076,6 @@ static Standard_Integer OCC28131(Draw_Interpretor&,
|
||||
#include <math_NewtonFunctionRoot.hxx>
|
||||
#include <math_TrigonometricEquationFunction.hxx>
|
||||
#include <gp_Elips2d.hxx>
|
||||
#include <Geom2d_Ellipse.hxx>
|
||||
#include <Geom2dAPI_InterCurveCurve.hxx>
|
||||
|
||||
static Standard_Integer OCC29289(Draw_Interpretor&, Standard_Integer, const char**)
|
||||
{
|
||||
gp_Elips2d e1(gp_Ax2d(gp_Pnt2d(0., 0.), gp_Dir2d(gp_Dir2d::D::X)), 2., 1.);
|
||||
Handle(Geom2d_Ellipse) Ge1 = new Geom2d_Ellipse(e1);
|
||||
gp_Elips2d e2(gp_Ax2d(gp_Pnt2d(0.5, 0.5), gp_Dir2d(1., 1.)), 2., 1.);
|
||||
Handle(Geom2d_Ellipse) Ge2 = new Geom2d_Ellipse(e2);
|
||||
|
||||
Standard_Integer err = 0;
|
||||
Geom2dAPI_InterCurveCurve Intersector;
|
||||
Intersector.Init(Ge1, Ge2, 1.e-7);
|
||||
if (Intersector.NbPoints() == 0)
|
||||
{
|
||||
std::cout << "Error: intersector is not done \n";
|
||||
err = 1;
|
||||
}
|
||||
|
||||
Standard_Real A, B, C, D, E;
|
||||
A = 1.875;
|
||||
B = -.75;
|
||||
C = -.5;
|
||||
D = -.25;
|
||||
E = -.25;
|
||||
math_TrigonometricEquationFunction MyF(A, B, C, D, E);
|
||||
Standard_Real X, Tol1, Eps, Teta, TetaNewton;
|
||||
Tol1 = 1.e-15;
|
||||
Eps = 1.5e-12;
|
||||
Standard_Integer Nit[] = {5, 6, 7, 6};
|
||||
|
||||
Standard_Real TetaPrev = 0.;
|
||||
Standard_Integer i;
|
||||
for (i = 1; i <= Intersector.NbPoints(); i++)
|
||||
{
|
||||
Teta = Intersector.Intersector().Point(i).ParamOnFirst();
|
||||
X = Teta - 0.1 * (Teta - TetaPrev);
|
||||
TetaPrev = Teta;
|
||||
math_NewtonFunctionRoot Resol(MyF, X, Tol1, Eps, Nit[i - 1]);
|
||||
if (Resol.IsDone())
|
||||
{
|
||||
TetaNewton = Resol.Root();
|
||||
if (Abs(Teta - TetaNewton) > 1.e-7)
|
||||
{
|
||||
std::cout << "Error: Newton root is wrong for " << Teta << " \n";
|
||||
err = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Error: Newton is not done for " << Teta << " \n";
|
||||
err = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
//===============================================================================================
|
||||
Standard_Boolean IsSameGuid(const Standard_GUID& aGuidNull, const Standard_GUID& aGuid2)
|
||||
{
|
||||
Standard_Boolean isSame(Standard_False);
|
||||
if (aGuidNull == aGuid2)
|
||||
{
|
||||
aGuid2.ShallowDump(std::cout);
|
||||
isSame = Standard_True;
|
||||
}
|
||||
else
|
||||
{
|
||||
aGuid2.ShallowDump(std::cout);
|
||||
std::cout << std::endl;
|
||||
}
|
||||
return isSame;
|
||||
}
|
||||
|
||||
#include <TDataStd_AsciiString.hxx>
|
||||
#include <TDataStd_BooleanArray.hxx>
|
||||
#include <TDataStd_BooleanList.hxx>
|
||||
#include <TDataStd_ByteArray.hxx>
|
||||
#include <TDataStd_ExtStringArray.hxx>
|
||||
#include <TDataStd_ExtStringList.hxx>
|
||||
#include <TDataStd_Integer.hxx>
|
||||
#include <TDataStd_IntegerArray.hxx>
|
||||
#include <TDataStd_IntegerList.hxx>
|
||||
#include <TDataStd_Real.hxx>
|
||||
#include <TDataStd_RealArray.hxx>
|
||||
#include <TDataStd_RealList.hxx>
|
||||
#include <TDataStd_ReferenceArray.hxx>
|
||||
#include <TDataStd_ReferenceList.hxx>
|
||||
|
||||
#define QCOMPARE(val1, val2) \
|
||||
di << "Checking " #val1 " == " #val2 << ((val1) == (val2) ? ": OK\n" : ": Error\n")
|
||||
|
||||
static Standard_Integer OCC29371(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n != 1)
|
||||
{
|
||||
std::cout << "Usage : " << a[0] << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
|
||||
Handle(TDocStd_Document) aDoc;
|
||||
anApp->NewDocument("BinOcaf", aDoc);
|
||||
TDF_Label aLab = aDoc->Main();
|
||||
Standard_GUID aNullGuid("00000000-0000-0000-0000-000000000000");
|
||||
Standard_Boolean IsNullGuid(Standard_False);
|
||||
|
||||
try
|
||||
{
|
||||
// 1. Set TDataStd_AsciiString
|
||||
Handle(TDataStd_AsciiString) aStrAtt = new TDataStd_AsciiString();
|
||||
aLab.AddAttribute(aStrAtt);
|
||||
if (!aStrAtt.IsNull())
|
||||
{
|
||||
Standard_GUID aGuid = aStrAtt->ID();
|
||||
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||
}
|
||||
|
||||
// 2. Set TDataStd_BooleanArray
|
||||
Handle(TDataStd_BooleanArray) aBArAtt = new TDataStd_BooleanArray();
|
||||
aLab.AddAttribute(aBArAtt);
|
||||
if (!aBArAtt.IsNull())
|
||||
{
|
||||
Standard_GUID aGuid = aBArAtt->ID();
|
||||
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||
}
|
||||
|
||||
// 3. Set TDataStd_BooleanList
|
||||
Handle(TDataStd_BooleanList) aBListAtt = new TDataStd_BooleanList();
|
||||
aLab.AddAttribute(aBListAtt);
|
||||
if (!aBListAtt.IsNull())
|
||||
{
|
||||
Standard_GUID aGuid = aBListAtt->ID();
|
||||
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||
}
|
||||
|
||||
// 4. Set TDataStd_ByteArray
|
||||
Handle(TDataStd_ByteArray) aByteArAtt = new TDataStd_ByteArray();
|
||||
aLab.AddAttribute(aByteArAtt);
|
||||
if (!aByteArAtt.IsNull())
|
||||
{
|
||||
Standard_GUID aGuid = aByteArAtt->ID();
|
||||
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||
}
|
||||
|
||||
// 5. Set TDataStd_ExtStringArray
|
||||
Handle(TDataStd_ExtStringArray) anExtStrArAtt = new TDataStd_ExtStringArray();
|
||||
aLab.AddAttribute(anExtStrArAtt);
|
||||
if (!anExtStrArAtt.IsNull())
|
||||
{
|
||||
Standard_GUID aGuid = anExtStrArAtt->ID();
|
||||
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||
}
|
||||
|
||||
// 6. Set TDataStd_ExtStringList
|
||||
Handle(TDataStd_ExtStringList) anExtStrListAtt = new TDataStd_ExtStringList();
|
||||
aLab.AddAttribute(anExtStrListAtt);
|
||||
if (!anExtStrListAtt.IsNull())
|
||||
{
|
||||
Standard_GUID aGuid = anExtStrListAtt->ID();
|
||||
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||
}
|
||||
|
||||
// 7. Set TDataStd_Integer
|
||||
Handle(TDataStd_Integer) anIntAtt = new TDataStd_Integer();
|
||||
aLab.AddAttribute(anIntAtt);
|
||||
if (!anIntAtt.IsNull())
|
||||
{
|
||||
Standard_GUID aGuid = anIntAtt->ID();
|
||||
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||
}
|
||||
|
||||
// 8. Set TDataStd_IntegerArray
|
||||
Handle(TDataStd_IntegerArray) anIntArrAtt = new TDataStd_IntegerArray();
|
||||
aLab.AddAttribute(anIntArrAtt);
|
||||
if (!anIntArrAtt.IsNull())
|
||||
{
|
||||
Standard_GUID aGuid = anIntArrAtt->ID();
|
||||
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||
}
|
||||
|
||||
// 9. Set TDataStd_IntegerList
|
||||
Handle(TDataStd_IntegerList) anIntListAtt = new TDataStd_IntegerList();
|
||||
aLab.AddAttribute(anIntListAtt);
|
||||
if (!anIntListAtt.IsNull())
|
||||
{
|
||||
Standard_GUID aGuid = anIntListAtt->ID();
|
||||
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||
}
|
||||
|
||||
// 10. Set TDataStd_Name
|
||||
Handle(TDataStd_Name) aNameAtt = new TDataStd_Name();
|
||||
aLab.AddAttribute(aNameAtt);
|
||||
if (!aNameAtt.IsNull())
|
||||
{
|
||||
Standard_GUID aGuid = aNameAtt->ID();
|
||||
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||
}
|
||||
|
||||
// 11. Set TDataStd_Real
|
||||
Handle(TDataStd_Real) aRealAtt = new TDataStd_Real();
|
||||
aLab.AddAttribute(aRealAtt);
|
||||
if (!aRealAtt.IsNull())
|
||||
{
|
||||
Standard_GUID aGuid = aRealAtt->ID();
|
||||
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||
}
|
||||
|
||||
// 12. Set TDataStd_RealArray
|
||||
Handle(TDataStd_RealArray) aRealArrAtt = new TDataStd_RealArray();
|
||||
aLab.AddAttribute(aRealArrAtt);
|
||||
if (!aRealArrAtt.IsNull())
|
||||
{
|
||||
Standard_GUID aGuid = aRealArrAtt->ID();
|
||||
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||
}
|
||||
|
||||
// 13. Set TDataStd_RealList
|
||||
Handle(TDataStd_RealList) aRealListAtt = new TDataStd_RealList();
|
||||
aLab.AddAttribute(aRealListAtt);
|
||||
if (!aRealListAtt.IsNull())
|
||||
{
|
||||
Standard_GUID aGuid = aRealListAtt->ID();
|
||||
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||
}
|
||||
|
||||
// 14. Set TDataStd_ReferenceArray
|
||||
Handle(TDataStd_ReferenceArray) aRefArrAtt = new TDataStd_ReferenceArray();
|
||||
aLab.AddAttribute(aRefArrAtt);
|
||||
if (!aRefArrAtt.IsNull())
|
||||
{
|
||||
Standard_GUID aGuid = aRefArrAtt->ID();
|
||||
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||
}
|
||||
|
||||
// 15. Set TDataStd_ReferenceList
|
||||
Handle(TDataStd_ReferenceList) aRefListAtt = new TDataStd_ReferenceList();
|
||||
aLab.AddAttribute(aRefListAtt);
|
||||
if (!aRefListAtt.IsNull())
|
||||
{
|
||||
Standard_GUID aGuid = aRefListAtt->ID();
|
||||
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
IsNullGuid = Standard_True;
|
||||
}
|
||||
QCOMPARE(IsNullGuid, Standard_False);
|
||||
anApp->Close(aDoc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <NCollection_DoubleMap.hxx>
|
||||
#include <NCollection_IndexedMap.hxx>
|
||||
@@ -3507,56 +3255,6 @@ static Standard_Integer OCC29807(Draw_Interpretor& theDI,
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OCC29925
|
||||
// purpose : check safety of functions like IsSpace(), LowerCase(), etc. for all chars
|
||||
//=======================================================================
|
||||
static Standard_Integer OCC29925(Draw_Interpretor& theDI, Standard_Integer, const char**)
|
||||
{
|
||||
// iterate by all valid ASCII chars (including extended)
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
Standard_Character c = (char)(unsigned char)i;
|
||||
// if (c != i) theDI << c << " != " << i << "\n";
|
||||
const char* anOp = "";
|
||||
try
|
||||
{
|
||||
anOp = "IsAlphabetic";
|
||||
IsAlphabetic(c);
|
||||
anOp = "IsDigit";
|
||||
IsDigit(c);
|
||||
anOp = "IsXDigit";
|
||||
IsXDigit(c);
|
||||
anOp = "IsAlphanumeric";
|
||||
IsAlphanumeric(c);
|
||||
anOp = "IsControl";
|
||||
IsControl(c);
|
||||
anOp = "IsGraphic";
|
||||
IsGraphic(c);
|
||||
anOp = "IsLowerCase";
|
||||
IsLowerCase(c);
|
||||
anOp = "IsPrintable";
|
||||
IsPrintable(c);
|
||||
anOp = "IsPunctuation";
|
||||
IsPunctuation(c);
|
||||
anOp = "IsSpace";
|
||||
IsSpace(c);
|
||||
anOp = "IsUpperCase";
|
||||
IsUpperCase(c);
|
||||
anOp = "LowerCase";
|
||||
LowerCase(c);
|
||||
anOp = "UpperCase";
|
||||
UpperCase(c);
|
||||
}
|
||||
catch (const Handle(Standard_Failure)& e)
|
||||
{
|
||||
theDI << anOp << "() fails for " << c << " (" << e->DynamicType()->Name() << ")\n";
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OCC29311
|
||||
// purpose : check performance of OBB calculations
|
||||
@@ -4056,53 +3754,6 @@ static Standard_Integer OCC30435(Draw_Interpretor& di, Standard_Integer, const c
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OCC30708_1
|
||||
// purpose : Tests initialization of the TopoDS_Iterator with null shape
|
||||
//=======================================================================
|
||||
static Standard_Integer OCC30708_1(Draw_Interpretor& di, Standard_Integer, const char**)
|
||||
{
|
||||
TopoDS_Iterator it;
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
TopoDS_Shape empty;
|
||||
it.Initialize(empty);
|
||||
}
|
||||
catch (const Standard_Failure&)
|
||||
{
|
||||
di << "Cannot initialize TopoDS_Iterator with null shape\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (it.More())
|
||||
di << "Incorrect Iterator initialization: method More() returns true on null shape\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OCC30708_2
|
||||
// purpose : Tests initialization of the BRepLib_MakeWire with null wire
|
||||
//=======================================================================
|
||||
static Standard_Integer OCC30708_2(Draw_Interpretor& di, Standard_Integer, const char**)
|
||||
{
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
TopoDS_Wire empty;
|
||||
BRepLib_MakeWire aWBuilder(empty);
|
||||
}
|
||||
catch (const Standard_Failure&)
|
||||
{
|
||||
di << "Cannot initialize BRepLib_MakeWire with null wire\n";
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
#include <GCE2d_MakeCircle.hxx>
|
||||
@@ -4640,128 +4291,6 @@ static Standard_Integer QANullifyShape(Draw_Interpretor& di, Standard_Integer n,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void CheckAx3Dir(gp_Ax3& theAxis, const gp_Dir& theDir)
|
||||
{
|
||||
Standard_Boolean bDirect = theAxis.Direct();
|
||||
theAxis.SetDirection(theDir);
|
||||
if (bDirect != theAxis.Direct())
|
||||
{
|
||||
std::cout << "Error: coordinate system is reversed\n";
|
||||
}
|
||||
if (!theDir.IsEqual(theAxis.Direction(), Precision::Angular()))
|
||||
{
|
||||
std::cout << "Error: main dir was not set properly\n";
|
||||
}
|
||||
}
|
||||
|
||||
static void CheckAx3DirX(gp_Ax3& theAxis, const gp_Dir& theDir)
|
||||
{
|
||||
Standard_Boolean bDirect = theAxis.Direct();
|
||||
theAxis.SetXDirection(theDir);
|
||||
if (bDirect != theAxis.Direct())
|
||||
{
|
||||
std::cout << "Error: coordinate system is reversed\n";
|
||||
}
|
||||
gp_Dir aGoodY = theAxis.Direction().Crossed(theDir);
|
||||
if (theAxis.Direct())
|
||||
{
|
||||
if (!aGoodY.IsEqual(theAxis.YDirection(), Precision::Angular()))
|
||||
{
|
||||
std::cout << "Error: X dir was not set properly\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!aGoodY.IsOpposite(theAxis.YDirection(), Precision::Angular()))
|
||||
{
|
||||
std::cout << "Error: X dir was not set properly\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void CheckAx3DirY(gp_Ax3& theAxis, const gp_Dir& theDir)
|
||||
{
|
||||
Standard_Boolean bDirect = theAxis.Direct();
|
||||
theAxis.SetYDirection(theDir);
|
||||
if (bDirect != theAxis.Direct())
|
||||
{
|
||||
std::cout << "Error: coordinate system is reversed\n";
|
||||
}
|
||||
gp_Dir aGoodX = theAxis.Direction().Crossed(theDir);
|
||||
if (theAxis.Direct())
|
||||
{
|
||||
if (!aGoodX.IsOpposite(theAxis.XDirection(), Precision::Angular()))
|
||||
{
|
||||
std::cout << "Error: Y dir was not set properly\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!aGoodX.IsEqual(theAxis.XDirection(), Precision::Angular()))
|
||||
{
|
||||
std::cout << "Error: Y dir was not set properly\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void CheckAx3Ax1(gp_Ax3& theAx, const gp_Ax1& theAx0)
|
||||
{
|
||||
Standard_Boolean bDirect = theAx.Direct();
|
||||
theAx.SetAxis(theAx0);
|
||||
if (bDirect != theAx.Direct())
|
||||
{
|
||||
std::cout << "Error: coordinate system is reversed\n";
|
||||
}
|
||||
if (!theAx0.Direction().IsEqual(theAx.Direction(), Precision::Angular()))
|
||||
{
|
||||
std::cout << "Error: main dir was not set properly\n";
|
||||
}
|
||||
}
|
||||
|
||||
static Standard_Integer OCC29406(Draw_Interpretor&, Standard_Integer, const char**)
|
||||
{
|
||||
// Main (Z) direction
|
||||
{
|
||||
// gp_Ax3::SetDirection() test
|
||||
gp_Ax3 anAx1, anAx2, anAx3, anAx4, anAx5, anAx6;
|
||||
anAx3.ZReverse();
|
||||
anAx4.ZReverse();
|
||||
CheckAx3Dir(anAx1, gp::DX());
|
||||
CheckAx3Dir(anAx2, -gp::DX());
|
||||
CheckAx3Dir(anAx3, gp::DX());
|
||||
CheckAx3Dir(anAx4, -gp::DX());
|
||||
// gp_Ax3::SetAxis() test
|
||||
gp_Ax1 anAx0_1(gp::Origin(), gp::DX());
|
||||
gp_Ax1 anAx0_2(gp::Origin(), -gp::DX());
|
||||
CheckAx3Ax1(anAx5, anAx0_1);
|
||||
CheckAx3Ax1(anAx6, anAx0_2);
|
||||
}
|
||||
// X direction
|
||||
{
|
||||
// gp_Ax3::SetXDirection() test
|
||||
gp_Ax3 anAx1, anAx2, anAx3, anAx4;
|
||||
anAx3.XReverse();
|
||||
anAx4.XReverse();
|
||||
CheckAx3DirX(anAx1, gp::DZ());
|
||||
CheckAx3DirX(anAx2, -gp::DZ());
|
||||
CheckAx3DirX(anAx3, gp::DZ());
|
||||
CheckAx3DirX(anAx4, -gp::DZ());
|
||||
}
|
||||
// Y direction
|
||||
{
|
||||
// gp_Ax3::SetYDirection() test
|
||||
gp_Ax3 anAx1, anAx2, anAx3, anAx4;
|
||||
anAx3.YReverse();
|
||||
anAx4.YReverse();
|
||||
CheckAx3DirY(anAx1, gp::DZ());
|
||||
CheckAx3DirY(anAx2, -gp::DZ());
|
||||
CheckAx3DirY(anAx3, gp::DZ());
|
||||
CheckAx3DirY(anAx4, -gp::DZ());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <BRepCheck_Analyzer.hxx>
|
||||
#include <GCPnts_UniformDeflection.hxx>
|
||||
|
||||
@@ -4800,46 +4329,6 @@ static Standard_Integer OCC32744(Draw_Interpretor& theDi,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer OCC33009(Draw_Interpretor&, Standard_Integer, const char**)
|
||||
{
|
||||
Bnd_OBB aBndBox;
|
||||
|
||||
TColgp_Array1OfPnt aPoints(1, 5);
|
||||
|
||||
aPoints.ChangeValue(1) = gp_Pnt(1, 2, 3);
|
||||
aPoints.ChangeValue(2) = gp_Pnt(3, 2, 1);
|
||||
aPoints.ChangeValue(3) = gp_Pnt(2, 3, 1);
|
||||
aPoints.ChangeValue(4) = gp_Pnt(1, 3, 2);
|
||||
aPoints.ChangeValue(5) = gp_Pnt(2, 1, 3);
|
||||
|
||||
aBndBox.ReBuild(aPoints, (const TColStd_Array1OfReal*)0, true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer OCC33048(Draw_Interpretor&, Standard_Integer, const char**)
|
||||
{
|
||||
Standard_Real isOK = true;
|
||||
try
|
||||
{
|
||||
// This method uses raw pointers for memory manipulations and not used in OCCT.
|
||||
math_ComputeKronrodPointsAndWeights aCalc(125);
|
||||
isOK = aCalc.IsDone();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
isOK = false;
|
||||
}
|
||||
|
||||
if (isOK)
|
||||
std::cout << "OK: Kronrod points and weights are calculated successfully." << std::endl;
|
||||
else
|
||||
std::cout << "Error: Problem occurred during calculation of Kronrod points and weights."
|
||||
<< std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
static Standard_Integer OCC33657_1(Draw_Interpretor&, Standard_Integer, const char**)
|
||||
@@ -5209,12 +4698,6 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands)
|
||||
__FILE__,
|
||||
OCC28131,
|
||||
group);
|
||||
theCommands.Add("OCC29289",
|
||||
"OCC29289 : searching trigonometric root by Newton iterations",
|
||||
__FILE__,
|
||||
OCC29289,
|
||||
group);
|
||||
theCommands.Add("OCC29371", "OCC29371", __FILE__, OCC29371, group);
|
||||
theCommands.Add("OCC29430",
|
||||
"OCC29430 <result wire> "
|
||||
"<result first point> <result last point>",
|
||||
@@ -5228,11 +4711,6 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands)
|
||||
__FILE__,
|
||||
OCC29064,
|
||||
group);
|
||||
theCommands.Add("OCC29925",
|
||||
"OCC29925: check safety of character classification functions",
|
||||
__FILE__,
|
||||
OCC29925,
|
||||
group);
|
||||
theCommands.Add("OCC29807", "OCC29807 surface1 surface2 u1 v1 u2 v2", __FILE__, OCC29807, group);
|
||||
theCommands.Add("OCC29311",
|
||||
"OCC29311 shape counter nbiter: check performance of OBB calculation",
|
||||
@@ -5263,18 +4741,6 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands)
|
||||
|
||||
theCommands.Add("QAEndsWith", "QAEndsWith string endstring", __FILE__, QAEndsWith, group);
|
||||
|
||||
theCommands.Add("OCC30708_1",
|
||||
"Tests initialization of the TopoDS_Iterator with null shape",
|
||||
__FILE__,
|
||||
OCC30708_1,
|
||||
group);
|
||||
|
||||
theCommands.Add("OCC30708_2",
|
||||
"Tests initialization of the BRepLib_MakeWire with null shape",
|
||||
__FILE__,
|
||||
OCC30708_2,
|
||||
group);
|
||||
|
||||
theCommands.Add("OCC30869",
|
||||
"Prints bounding points of the given wire and tangent vectors at these points.\n"
|
||||
"Usage: OCC30869 wire",
|
||||
@@ -5314,23 +4780,12 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands)
|
||||
QANullifyShape,
|
||||
group);
|
||||
|
||||
theCommands.Add(
|
||||
"OCC29406",
|
||||
"Tests the case when newly set axis for gp_Ax3 is parallel to one of current axis",
|
||||
__FILE__,
|
||||
OCC29406,
|
||||
group);
|
||||
|
||||
theCommands.Add("OCC32744",
|
||||
"Tests avoid Endless loop in GCPnts_UniformDeflection",
|
||||
__FILE__,
|
||||
OCC32744,
|
||||
group);
|
||||
|
||||
theCommands.Add("OCC33009", "Tests the case when", __FILE__, OCC33009, group);
|
||||
|
||||
theCommands.Add("OCC33048", "Kronrod points and weights calculation", __FILE__, OCC33048, group);
|
||||
|
||||
theCommands.Add("QACheckBends",
|
||||
"QACheckBends curve [CosMaxAngle [theNbPoints]]",
|
||||
__FILE__,
|
||||
|
||||
@@ -137,65 +137,6 @@ static Standard_Integer BUC60652(Draw_Interpretor& di, Standard_Integer argc, co
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
static Standard_Integer BUC60729(Draw_Interpretor& /*di*/,
|
||||
Standard_Integer /*argc*/,
|
||||
const char** /*argv*/)
|
||||
{
|
||||
Bnd_Box aMainBox;
|
||||
TopoDS_Shape aShape = BRepPrimAPI_MakeBox(1, 1, 1).Solid();
|
||||
|
||||
BRepBndLib::Add(aShape, aMainBox);
|
||||
|
||||
Standard_Integer siMaxNbrBox = 6;
|
||||
Bnd_BoundSortBox m_BoundSortBox;
|
||||
m_BoundSortBox.Initialize(aMainBox, siMaxNbrBox);
|
||||
TopExp_Explorer aExplorer(aShape, TopAbs_FACE);
|
||||
Standard_Integer i;
|
||||
|
||||
// Bnd_Box __emptyBox; // Box is void !
|
||||
// Handle(Bnd_HArray1OfBox) __aSetOfBox = new Bnd_HArray1OfBox( 1, siMaxNbrBox, __emptyBox );
|
||||
|
||||
for (i = 1, aExplorer.ReInit(); aExplorer.More(); aExplorer.Next(), i++)
|
||||
{
|
||||
const TopoDS_Shape& aFace = aExplorer.Current();
|
||||
Bnd_Box aBox;
|
||||
BRepBndLib::Add(aFace, aBox);
|
||||
m_BoundSortBox.Add(aBox, i);
|
||||
// __aSetOfBox->SetValue( i, aBox );
|
||||
}
|
||||
// m_BoundSortBox.Initialize( aMainBox, siMaxNbrBox );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer BUC60724(Draw_Interpretor& di,
|
||||
Standard_Integer /*argc*/,
|
||||
const char** /*argv*/)
|
||||
{
|
||||
TCollection_AsciiString as1("");
|
||||
TCollection_AsciiString as2('\0');
|
||||
if (as1.ToCString() == NULL || as1.Length() != 0 || as1.ToCString()[0] != '\0')
|
||||
di << "Error : the first string is not zero string : " << as1.ToCString() << "\n";
|
||||
|
||||
if (as2.ToCString() == NULL || as2.Length() != 0 || as2.ToCString()[0] != '\0')
|
||||
di << "Error : the second string is not zero string : " << as2.ToCString() << "\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <UnitsAPI.hxx>
|
||||
|
||||
static Standard_Integer BUC60727(Draw_Interpretor& di,
|
||||
Standard_Integer /*argc*/,
|
||||
const char** /*argv*/)
|
||||
{
|
||||
di << "Program Test\n";
|
||||
UnitsAPI::SetLocalSystem(UnitsAPI_MDTV); // length is mm
|
||||
di << "AnyToLS (3,mm) = " << UnitsAPI::AnyToLS(3., "mm") << "\n"; // result was WRONG.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <gp_Circ.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <GeomAPI.hxx>
|
||||
@@ -440,59 +381,6 @@ static int BUC60825(Draw_Interpretor& di, Standard_Integer argc, const char** ar
|
||||
#include <BRepBuilderAPI_MakePolygon.hxx>
|
||||
#include <BRepOffsetAPI_ThruSections.hxx>
|
||||
|
||||
static int OCC10006(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc != 1)
|
||||
{
|
||||
di << "Usage : " << argv[0] << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
double bottompoints1[12] = {10, -10, 0, 100, -10, 0, 100, -100, 0, 10, -100, 0};
|
||||
double toppoints1[12] = {0, 0, 10, 100, 0, 10, 100, -100, 10, 0, -100, 10};
|
||||
double bottompoints2[12] = {0, 0, 10.00, 100, 0, 10.00, 100, -100, 10.00, 0, -100, 10.00};
|
||||
double toppoints2[12] = {0, 0, 250, 100, 0, 250, 100, -100, 250, 0, -100, 250};
|
||||
BRepBuilderAPI_MakePolygon bottompolygon1, toppolygon1, bottompolygon2, toppolygon2;
|
||||
gp_Pnt tmppnt;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
tmppnt.SetCoord(bottompoints1[3 * i], bottompoints1[3 * i + 1], bottompoints1[3 * i + 2]);
|
||||
bottompolygon1.Add(tmppnt);
|
||||
tmppnt.SetCoord(toppoints1[3 * i], toppoints1[3 * i + 1], toppoints1[3 * i + 2]);
|
||||
toppolygon1.Add(tmppnt);
|
||||
tmppnt.SetCoord(bottompoints2[3 * i], bottompoints2[3 * i + 1], bottompoints2[3 * i + 2]);
|
||||
bottompolygon2.Add(tmppnt);
|
||||
tmppnt.SetCoord(toppoints2[3 * i], toppoints2[3 * i + 1], toppoints2[3 * i + 2]);
|
||||
toppolygon2.Add(tmppnt);
|
||||
}
|
||||
bottompolygon1.Close();
|
||||
DBRep::Set("B1", bottompolygon1.Shape());
|
||||
toppolygon1.Close();
|
||||
DBRep::Set("T1", toppolygon1.Shape());
|
||||
bottompolygon2.Close();
|
||||
DBRep::Set("B2", bottompolygon2.Shape());
|
||||
toppolygon2.Close();
|
||||
DBRep::Set("T2", toppolygon2.Shape());
|
||||
BRepOffsetAPI_ThruSections loft1(Standard_True, Standard_True);
|
||||
loft1.AddWire(bottompolygon1.Wire());
|
||||
loft1.AddWire(toppolygon1.Wire());
|
||||
loft1.Build();
|
||||
BRepOffsetAPI_ThruSections loft2(Standard_True, Standard_True);
|
||||
loft2.AddWire(bottompolygon2.Wire());
|
||||
loft2.AddWire(toppolygon2.Wire());
|
||||
loft2.Build();
|
||||
if (loft1.Shape().IsNull() || loft2.Shape().IsNull())
|
||||
return 1;
|
||||
DBRep::Set("TS1", loft1.Shape());
|
||||
DBRep::Set("TS2", loft2.Shape());
|
||||
|
||||
di << "BRepAlgoAPI_Fuse result(loft1.Shape(), loft2.Shape())\n";
|
||||
BRepAlgoAPI_Fuse result(loft1.Shape(), loft2.Shape());
|
||||
DBRep::Set("F", result.Shape());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <GC_MakeTrimmedCone.hxx>
|
||||
|
||||
static Standard_Integer BUC60856(Draw_Interpretor& di, Standard_Integer /*argc*/, const char** argv)
|
||||
@@ -581,14 +469,6 @@ static Standard_Integer coordload(Draw_Interpretor& theDi,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer TestMem(Draw_Interpretor& /*di*/,
|
||||
Standard_Integer /*nb*/,
|
||||
const char** /*arg*/)
|
||||
{
|
||||
TCollection_ExtendedString aString(1024 * 1024, 'A');
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer BUC60876_(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
|
||||
@@ -611,19 +491,6 @@ static Standard_Integer BUC60876_(Draw_Interpretor& di, Standard_Integer argc, c
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
static Standard_Integer BUC60773(Draw_Interpretor& /*di*/,
|
||||
Standard_Integer /*n*/,
|
||||
const char** /*a*/)
|
||||
{
|
||||
Handle(TCollection_HAsciiString) hAscii = new TCollection_HAsciiString();
|
||||
Standard_CString aStr = hAscii->ToCString();
|
||||
TCollection_AsciiString aAscii(aStr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <BRepPrimAPI_MakeCylinder.hxx>
|
||||
#include <BRepPrimAPI_MakeCone.hxx>
|
||||
|
||||
@@ -860,47 +727,6 @@ static Standard_Integer BUC60874(Draw_Interpretor& /*di*/,
|
||||
#include <TNaming_Naming.hxx>
|
||||
#include <TNaming_NamedShape.hxx>
|
||||
|
||||
static int BUC60817(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
{
|
||||
di << "Usage : " << argv[0] << " D\n";
|
||||
di << 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Handle(TDF_Data) DF;
|
||||
if (!DDF::GetDF(argv[1], DF))
|
||||
{
|
||||
di << 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
TDF_Label L1, L2;
|
||||
Handle(TDataStd_TreeNode) TN1, TN2;
|
||||
|
||||
DDF::AddLabel(DF, "0:2", L1);
|
||||
TN1 = TDataStd_TreeNode::Set(L1);
|
||||
|
||||
DDF::AddLabel(DF, "0:3", L2);
|
||||
TN2 = TDataStd_TreeNode::Set(L2);
|
||||
|
||||
TN1->Append(TN2);
|
||||
if (!(TN2->IsDescendant(TN1)))
|
||||
{
|
||||
di << 3;
|
||||
return 0;
|
||||
}
|
||||
if ((TN1->IsDescendant(TN2)))
|
||||
{
|
||||
di << 4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
di << 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int BUC60831_1(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
@@ -1194,44 +1020,6 @@ static int BUC60910(Draw_Interpretor& di, Standard_Integer argc, const char** ar
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int BUC60925(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
{
|
||||
di << "Usage : " << argv[0] << " D\n";
|
||||
di << 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Handle(TDF_Data) aDF;
|
||||
if (!DDF::GetDF(argv[1], aDF))
|
||||
{
|
||||
di << 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
TDF_Label L;
|
||||
DDF::AddLabel(aDF, "0:2", L);
|
||||
TDF_LabelMap LM;
|
||||
LM.Add(L);
|
||||
|
||||
Handle(TNaming_NamedShape) NS = new TNaming_NamedShape;
|
||||
// Handle(TNaming_Name) NN = new TNaming_Name;
|
||||
TNaming_Name NN;
|
||||
|
||||
NN.Type(TNaming_IDENTITY);
|
||||
NN.Append(NS);
|
||||
Standard_Boolean Res = NN.Solve(L, LM);
|
||||
|
||||
if (Res != Standard_False)
|
||||
{
|
||||
di << 3;
|
||||
return 0;
|
||||
}
|
||||
di << 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int BUC60932(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
@@ -1418,24 +1206,16 @@ void QABugs::Commands_3(Draw_Interpretor& theCommands)
|
||||
theCommands.Add("BUC60632", "BUC60632 mode length", __FILE__, BUC60632, group);
|
||||
theCommands.Add("BUC60652", "BUC60652 face", __FILE__, BUC60652, group);
|
||||
|
||||
theCommands.Add("BUC60729", "BUC60729", __FILE__, BUC60729, group);
|
||||
theCommands.Add("BUC60724", "BUC60724", __FILE__, BUC60724, group);
|
||||
theCommands.Add("BUC60727", "BUC60727", __FILE__, BUC60727, group);
|
||||
theCommands.Add("BUC60792", "BUC60792", __FILE__, BUC60792, group);
|
||||
theCommands.Add("BUC60811", "BUC60811", __FILE__, BUC60811, group);
|
||||
|
||||
theCommands.Add("BUC60825", "BUC60825", __FILE__, BUC60825, group);
|
||||
|
||||
theCommands.Add("OCC10006", "OCC10006", __FILE__, OCC10006, group);
|
||||
|
||||
theCommands.Add("BUC60856", "BUC60856", __FILE__, BUC60856, group);
|
||||
|
||||
theCommands.Add("coordload", "load coord from file", __FILE__, coordload, group);
|
||||
|
||||
theCommands.Add("TestMem", "TestMem", __FILE__, TestMem, group);
|
||||
theCommands.Add("BUC60945", "BUC60945", __FILE__, TestMem, group);
|
||||
theCommands.Add("BUC60876", "BUC60876 shape", __FILE__, BUC60876_, group);
|
||||
theCommands.Add("BUC60773", "BUC60773", __FILE__, BUC60773, group);
|
||||
|
||||
theCommands.Add("TestCMD", "TestCMD", __FILE__, TestCMD, group);
|
||||
|
||||
@@ -1444,8 +1224,6 @@ void QABugs::Commands_3(Draw_Interpretor& theCommands)
|
||||
theCommands.Add("BUC60841", "BUC60841", __FILE__, BUC60841, group);
|
||||
|
||||
theCommands.Add("BUC60874", "BUC60874", __FILE__, BUC60874, group);
|
||||
|
||||
theCommands.Add("BUC60817", "BUC60817 D", __FILE__, BUC60817, group);
|
||||
theCommands.Add("BUC60831_1", "BUC60831_1 D", __FILE__, BUC60831_1, group);
|
||||
theCommands.Add("BUC60831_2", "BUC60831_2 D Label", __FILE__, BUC60831_2, group);
|
||||
theCommands.Add("BUC60836", "BUC60836 D", __FILE__, BUC60836, group);
|
||||
@@ -1453,7 +1231,6 @@ void QABugs::Commands_3(Draw_Interpretor& theCommands)
|
||||
theCommands.Add("BUC60862", "BUC60862 D Shape", __FILE__, BUC60862, group);
|
||||
theCommands.Add("BUC60867", "BUC60867", __FILE__, BUC60867, group);
|
||||
theCommands.Add("BUC60910", "BUC60910 D", __FILE__, BUC60910, group);
|
||||
theCommands.Add("BUC60925", "BUC60925 D", __FILE__, BUC60925, group);
|
||||
theCommands.Add("BUC60932", "BUC60932 D", __FILE__, BUC60932, group);
|
||||
theCommands.Add("AISWidth", "AISWidth (DOC,entry,[width])", __FILE__, AISWidth, group);
|
||||
theCommands.Add("BUC60921", "BUC60921 Doc label brep_file", __FILE__, BUC60921, group);
|
||||
|
||||
@@ -80,37 +80,6 @@ static Standard_Integer OCC6001(Draw_Interpretor& di, Standard_Integer argc, con
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer OCC5696(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc != 1)
|
||||
{
|
||||
di << "Usage : " << argv[0] << "\n";
|
||||
return 1;
|
||||
}
|
||||
TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(gp_Pnt(0, 0, 0), gp_Pnt(2, 0, 0));
|
||||
TopoDS_Wire wire = BRepBuilderAPI_MakeWire(edge);
|
||||
BRepAdaptor_CompCurve curve(wire);
|
||||
Standard_Real first = curve.FirstParameter();
|
||||
Standard_Real last = curve.LastParameter();
|
||||
Standard_Real par = (first + last) / 2;
|
||||
Standard_Real par_edge;
|
||||
TopoDS_Edge edge_found;
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
curve.Edge(par, edge_found, par_edge); // exception is here
|
||||
di << "par_edge = " << par_edge << "\n";
|
||||
}
|
||||
|
||||
catch (Standard_Failure const&)
|
||||
{
|
||||
di << "OCC5696 Exception \n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QABugs::Commands_5(Draw_Interpretor& theCommands)
|
||||
{
|
||||
const char* group = "QABugs";
|
||||
@@ -121,7 +90,5 @@ void QABugs::Commands_5(Draw_Interpretor& theCommands)
|
||||
OCC6001,
|
||||
group);
|
||||
|
||||
theCommands.Add("OCC5696", "OCC5696", __FILE__, OCC5696, group);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -19,307 +19,11 @@
|
||||
#include <DrawTrSurf.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <GeomAPI_ExtremaCurveCurve.hxx>
|
||||
|
||||
const Standard_Integer Glob_NbPoles = 195;
|
||||
const Standard_Real Glob_Poles[Glob_NbPoles][3] = {
|
||||
{60000, 31.937047503393231, 799.36226142892554},
|
||||
{60000.000000027772, 16.712487623992825, 799.97053069028755},
|
||||
{59999.999999875639, 7.3723603687660546, 799.97042131653711},
|
||||
{60000.000000331296, 1.2070383839533065, 799.90534456032105},
|
||||
{59999.999999361171, -2.5807810139032785, 799.77442818789041},
|
||||
{60000.000000952597, -4.7405254527655112, 799.70146419719595},
|
||||
{59999.999998867599, -5.3922917628932563, 799.62943054158143},
|
||||
{60000.000001091154, -5.1399175234965044, 799.63364074172011},
|
||||
{59999.999999142601, -3.6992503431468067, 799.67179299415568},
|
||||
{60000.000000546061, -1.6910663098148713, 799.76799688166773},
|
||||
{59999.999999725333, 1.1886267067330731, 799.91818018455035},
|
||||
{60000.000000101914, 4.5979596894282677, 800.11782874041273},
|
||||
{59999.999999977204, 8.5921385739756673, 800.36980220999453},
|
||||
{60000.000000018619, 16.600658956791417, 800.90755378048414},
|
||||
{59999.999999985768, 26.040687605616604, 801.59827916977554},
|
||||
{60000.000000052918, 30.448324872994441, 801.9310695501531},
|
||||
{59999.999999883308, 35.089921752286457, 802.29194004854389},
|
||||
{60000.000000186978, 39.947755013962528, 802.68007678107051},
|
||||
{59999.99999976845, 45.005892525213071, 803.09465896567826},
|
||||
{60000.000000227068, 50.249778854659326, 803.53486876081706},
|
||||
{59999.999999821659, 55.665932960782108, 803.9998957687626},
|
||||
{60000.000000112479, 61.241734208767859, 804.48893829648762},
|
||||
{59999.999999943684, 66.965272918611916, 805.00120177704798},
|
||||
{60000.000000021486, 72.8252416954995, 805.53589657709654},
|
||||
{59999.99999999431, 78.810843745189473, 806.09223572876306},
|
||||
{60000.000000004045, 87.962119756404547, 806.95803383418911},
|
||||
{59999.99999999725, 97.349976765262795, 807.869010426567},
|
||||
{60000.000000017491, 100.50428991828356, 808.17759139897635},
|
||||
{59999.99999994829, 103.68239055379394, 808.49099684342912},
|
||||
{60000.000000105072, 106.88305649144334, 808.80912918631941},
|
||||
{59999.999999835563, 110.10508187457555, 809.13189073948308},
|
||||
{60000.000000207947, 113.34727572158297, 809.45918381767103},
|
||||
{59999.999999784653, 116.60846040037053, 809.79091039912782},
|
||||
{60000.000000180742, 119.88747020406682, 810.12697237079749},
|
||||
{59999.999999880296, 123.18314981484644, 810.46727114678265},
|
||||
{60000.000000059626, 126.49435287223255, 810.81170785335109},
|
||||
{59999.999999979838, 129.81994045902351, 811.16018308253979},
|
||||
{60000.000000015229, 134.8281992328765, 811.68880383859914},
|
||||
{59999.99999998945, 139.86373510893441, 812.2260602582727},
|
||||
{60000.000000059066, 141.54513692067022, 812.40609267860532},
|
||||
{59999.999999845008, 143.22928798266199, 812.58705944070834},
|
||||
{60000.000000278043, 144.91604799540772, 812.7689478797023},
|
||||
{59999.999999621934, 146.60527693312631, 812.95174532592102},
|
||||
{60000.000000407505, 148.29683501034282, 813.13543899059755},
|
||||
{59999.999999644526, 149.99058265886663, 813.32001613307352},
|
||||
{60000.000000252723, 151.68638048575326, 813.5054638442823},
|
||||
{59999.999999853622, 153.38408925794459, 813.69176926621947},
|
||||
{60000.000000068765, 155.08356985703421, 813.87891939578799},
|
||||
{59999.999999973967, 156.7846832610312, 814.06690122038856},
|
||||
{60000.00000002468, 159.33859412935516, 814.35010184114628},
|
||||
{59999.999999977736, 161.89555354531564, 814.63511466528189},
|
||||
{60000.000000145039, 162.74819471256941, 814.73031865086841},
|
||||
{59999.999999608634, 163.60113987644607, 814.82572069112655},
|
||||
{60000.000000709108, 164.45437167903589, 814.92131914784375},
|
||||
{59999.999999031643, 165.3078727497936, 815.0171123286641},
|
||||
{60000.000001042623, 166.16162573916125, 815.11309861889924},
|
||||
{59999.999999097396, 167.01561326831904, 815.20927628960794},
|
||||
{60000.000000630716, 167.86981798631649, 815.30564372626975},
|
||||
{59999.999999648215, 168.72422251240596, 815.40219920078994},
|
||||
{60000.000000151289, 169.57880948189478, 815.4989410625825},
|
||||
{59999.999999954052, 170.43356151298337, 815.5958676029403},
|
||||
{60000.000000034408, 171.71591108030151, 815.74153190228753},
|
||||
{59999.999999976135, 172.9985538007256, 815.88760410128577},
|
||||
{60000.000000129759, 173.42613177350728, 815.93633994702668},
|
||||
{59999.999999664251, 173.85373796967124, 815.98512067846866},
|
||||
{60000.00000060827, 174.28137021936112, 816.03394612011459},
|
||||
{59999.99999914426, 174.70902633885802, 816.08281598496671},
|
||||
{60000.000000969369, 175.13670416564241, 816.13173017155248},
|
||||
{59999.999999107844, 175.56440150794049, 816.18068832455049},
|
||||
{60000.00000066567, 175.9921162052986, 816.22969037578832},
|
||||
{59999.999999602165, 176.41984606692156, 816.27873598355484},
|
||||
{60000.00000018561, 176.84758892491178, 816.3278250228899},
|
||||
{59999.999999935775, 177.27534259516338, 816.37695722529566},
|
||||
{60000.000000054533, 177.91698605475608, 816.45071998561696},
|
||||
{59999.999999955864, 178.55864403901305, 816.52457892469988},
|
||||
{60000.000000281914, 178.7725313764083, 816.54920923644852},
|
||||
{59999.999999214248, 178.98641977813006, 816.57385016025694},
|
||||
{60000.000001492997, 179.20030898752373, 816.59850173903158},
|
||||
{59999.999997853804, 179.41419870083473, 816.62316380941468},
|
||||
{60000.000002424618, 179.62808869307457, 816.647836551757},
|
||||
{59999.999997816361, 179.84197863289955, 816.6725196831527},
|
||||
{60000.000001566797, 180.05586830671322, 816.69721343479125},
|
||||
{59999.999999121159, 180.26975739282756, 816.72191756454924},
|
||||
{60000.00000036486, 180.48364565146377, 816.74663219124841},
|
||||
{59999.999999904954, 180.69753279192835, 816.7713572079532},
|
||||
{60000.000000054562, 181.0183614269956, 816.8084603269557},
|
||||
{59999.999999978463, 181.33918632988278, 816.84558675379014},
|
||||
{60000.000000049782, 181.44612751539663, 816.85796481705847},
|
||||
{59999.999999914071, 181.55306821881811, 816.87034546240886},
|
||||
{60000.000000125139, 181.66000840292782, 816.88272868833144},
|
||||
{59999.999999843392, 181.76694804030186, 816.89511449082431},
|
||||
{60000.000000167289, 181.87388708628473, 816.90750286566583},
|
||||
{59999.999999847467, 181.98082551962966, 816.9198938103757},
|
||||
{60000.000000119864, 182.08776329350809, 816.93228732197861},
|
||||
{59999.999999917491, 182.19470038386558, 816.94468339453306},
|
||||
{60000.000000050633, 182.30163675019068, 816.9570820285785},
|
||||
{59999.999999972366, 182.40857236133851, 816.96948321649302},
|
||||
{60000.000000032509, 182.56897459276843, 816.98808882907122},
|
||||
{59999.999999965934, 182.7293749693155, 817.00670017517837},
|
||||
{60000.000000238462, 182.78284155215263, 817.01290459816312},
|
||||
{59999.999999345615, 182.83630791626743, 817.01910964099045},
|
||||
{60000.00000119608, 182.88977407140584, 817.02531535916364},
|
||||
{59999.999998362182, 182.94323998619015, 817.03152164472851},
|
||||
{60000.000001757064, 182.99670569682132, 817.03772865736005},
|
||||
{59999.999998499035, 183.05017115047181, 817.04393620474377},
|
||||
{60000.00000101691, 183.10363639052409, 817.05014447471717},
|
||||
{59999.999999469313, 183.15710137432194, 817.05635331513508},
|
||||
{60000.000000196254, 183.21056612270786, 817.06256282498509},
|
||||
{59999.999999961823, 183.26403061846696, 817.06877295237007},
|
||||
{60000.000000031148, 183.37095910597188, 817.0811944807366},
|
||||
{59999.999999975873, 183.47788656385964, 817.09361853568328},
|
||||
{60000.000000078871, 183.53291535756762, 817.10001332133618},
|
||||
{59999.999999822408, 183.57465447580566, 817.10486251586156},
|
||||
{60000.000000306398, 183.67093862701302, 817.11605868308925},
|
||||
{59999.999999580868, 183.62493711493508, 817.11070057755603},
|
||||
{60000.000000457883, 183.83983154073323, 817.13569840343439},
|
||||
{59999.999999600586, 183.70298550843307, 817.11977179379392},
|
||||
{60000.000000274122, 183.92091406059222, 817.14512405357789},
|
||||
{59999.999999859414, 183.87191278066462, 817.13941945054194},
|
||||
{60000.000000045809, 183.96882854112027, 817.15069318206758},
|
||||
{59999.99999999682, 184.01172713386404, 817.15568252551441},
|
||||
{60000.000000002117, 199.05860625274244, 818.90605990894926},
|
||||
{60000.000000011685, 213.77441984052732, 820.66779572748067},
|
||||
{59999.999999945896, 228.63273752574398, 822.50191665906459},
|
||||
{60000.000000137385, 243.60930053773387, 824.4160390659564},
|
||||
{59999.999999745312, 257.44864608947171, 826.20557537898253},
|
||||
{60000.000000371336, 272.37732017567259, 828.28374145687258},
|
||||
{59999.999999564294, 283.4609507719199, 829.76911975631128},
|
||||
{60000.000000411754, 297.87730027160165, 831.94635758332913},
|
||||
{59999.999999691667, 308.39894455125989, 833.48120705572103},
|
||||
{60000.000000175751, 321.04689540263291, 835.47802201470222},
|
||||
{59999.999999930937, 332.7974681685576, 837.36295119087083},
|
||||
{60000.000000012922, 344.23852019267594, 839.26003269871717},
|
||||
{59999.999999978521, 380.87159046869039, 845.50264944092885},
|
||||
{60000.000000031927, 417.67053058140004, 852.32838657260925},
|
||||
{59999.999999895757, 443.71876268540638, 857.33613824789597},
|
||||
{60000.00000023668, 470.42282907220516, 863.40925211937144},
|
||||
{59999.999999591026, 506.36442771103123, 868.70489233101273},
|
||||
{60000.000000559063, 504.29569767668107, 873.82665736030435},
|
||||
{59999.999999387175, 618.22680165126303, 889.69085497467483},
|
||||
{60000.00000054048, 520.96760954336719, 878.60259543512541},
|
||||
{59999.999999620944, 695.15397128954748, 909.33199431749756},
|
||||
{60000.000000202854, 652.21259368585868, 902.32746593221361},
|
||||
{59999.999999925931, 713.31441817738153, 914.25671409207371},
|
||||
{60000.000000011525, 744.93626878652026, 920.45067498376648},
|
||||
{59999.999999986139, 851.85145355849977, 941.08553924856312},
|
||||
{60000.000000015752, 955.13474569084099, 960.32812261133847},
|
||||
{59999.99999996031, 1019.9477908992111, 972.25457694191095},
|
||||
{60000.000000078573, 1109.7424197388102, 989.27219905591903},
|
||||
{59999.999999866697, 1103.4472241364576, 986.24901738812696},
|
||||
{60000.000000196575, 1283.5502566789903, 1025.857653448167},
|
||||
{59999.999999756859, 1241.170752696316, 1010.5034788173898},
|
||||
{60000.000000241002, 1380.0598100152401, 1044.321387312001},
|
||||
{59999.999999814674, 1417.3346489504095, 1047.4285724180056},
|
||||
{60000.000000106025, 1498.5882349740116, 1064.7148393296281},
|
||||
{59999.999999959189, 1562.4075471540843, 1076.5692870450682},
|
||||
{60000.000000006847, 1632.0446827427525, 1089.9951747091934},
|
||||
{59999.999999992855, 1819.187180960379, 1125.8766969823027},
|
||||
{60000.000000006774, 2005.7867190244558, 1161.6893152514506},
|
||||
{59999.999999993102, 2127.1610378717864, 1184.8982806691761},
|
||||
{59999.999999983789, 2224.9504474907289, 1204.7794295042536},
|
||||
{60000.000000076092, 2423.4034586285211, 1239.2849934128672},
|
||||
{59999.999999843334, 2352.5108743508281, 1233.9178625300717},
|
||||
{60000.00000021555, 2789.1958451831979, 1304.7841887599538},
|
||||
{59999.999999781059, 2516.5832651666447, 1267.6317850640198},
|
||||
{60000.000000168911, 2997.8479508975411, 1347.2273537129538},
|
||||
{59999.999999901927, 2872.9560675152225, 1329.8998228537541},
|
||||
{60000.000000040534, 3100.1634765888271, 1371.640798220885},
|
||||
{59999.999999990199, 3186.6552406648925, 1389.3336814233451},
|
||||
{60000.000000019143, 3570.5318534479206, 1462.8626017289478},
|
||||
{59999.999999969914, 3906.3811637172125, 1522.697974792497},
|
||||
{60000.000000105116, 4081.0496155485694, 1554.1195061318422},
|
||||
{59999.999999764274, 4440.4680391955444, 1682.9362787226369},
|
||||
{60000.000000389882, 4025.4579062184348, 1482.6543564450828},
|
||||
{59999.999999500047, 5340.2058728577267, 2096.5041911809035},
|
||||
{60000.000000509819, 4233.9915572764976, 1518.9299243967394},
|
||||
{59999.999999583706, 5430.8345183928068, 2200.8401562891845},
|
||||
{60000.000000267981, 5054.5402162751188, 1969.4793692255021},
|
||||
{59999.999999871681, 5428.966058504895, 2244.2141001944756},
|
||||
{60000.000000038024, 5546.4649349764723, 2352.3606428637349},
|
||||
{59999.999999998952, 5706.4753141683368, 2517.0835536242184},
|
||||
{59999.999999991771, 6129.2268892602051, 3030.8327236291348},
|
||||
{60000.000000020089, 6420.3065439166912, 3661.6495160497966},
|
||||
{59999.99999990526, 6235.8646808219391, 3444.1541944672813},
|
||||
{60000.000000247288, 8126.8536394010316, 8890.661747328244},
|
||||
{59999.99999954299, 2104.925285609057, -7996.1134321147983},
|
||||
{60000.00000064441, 14264.475617875083, 34652.739991203249},
|
||||
{59999.999999283253, -1684.3290491164355, -33238.811620330394},
|
||||
{60000.000000641696, 13782.902589951687, 46532.286752882486},
|
||||
{59999.999999532913, 2699.6074087223524, -19079.410940396814},
|
||||
{60000.000000275439, 9084.6892111341349, 21937.827319607131},
|
||||
{59999.999999871587, 6474.8937324409353, 5006.3713661893671},
|
||||
{60000.000000044485, 7350.4434791870981, 10709.698171043074},
|
||||
{59999.999999990541, 7306.414330937022, 10560.108503883888},
|
||||
{60000, 7397.0783263606427, 11218.963217145942}};
|
||||
|
||||
const Standard_Integer Glob_NbKnots = 17;
|
||||
const Standard_Real Glob_Knots[Glob_NbKnots] = {0,
|
||||
0.0087664292723375857,
|
||||
0.015654339342331427,
|
||||
0.019098294377328347,
|
||||
0.020820271894826808,
|
||||
0.021681260653576038,
|
||||
0.022111755032950653,
|
||||
0.022327002222637962,
|
||||
0.022434625817481617,
|
||||
0.022488437614903441,
|
||||
0.022542249412325268,
|
||||
0.037523693790797889,
|
||||
0.071526893170125505,
|
||||
0.1421299556831544,
|
||||
0.26514857375331263,
|
||||
0.51350664396810353,
|
||||
1};
|
||||
|
||||
const Standard_Integer Glob_Mults[Glob_NbKnots] =
|
||||
{15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15};
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
static Standard_Integer OCC862(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc != 3)
|
||||
{
|
||||
di << "ERROR : Usage : " << argv[0] << " curve1 curve2\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Integer i;
|
||||
// Fill array of poles
|
||||
TColgp_Array1OfPnt aPoles(1, Glob_NbPoles);
|
||||
for (i = 0; i < Glob_NbPoles; i++)
|
||||
aPoles.SetValue(i + 1, gp_Pnt(Glob_Poles[i][0], Glob_Poles[i][1], Glob_Poles[i][2]));
|
||||
// Fill array of knots
|
||||
TColStd_Array1OfReal aKnots(1, Glob_NbKnots);
|
||||
for (i = 0; i < Glob_NbKnots; i++)
|
||||
aKnots.SetValue(i + 1, Glob_Knots[i]);
|
||||
// Fill array of mults
|
||||
TColStd_Array1OfInteger aMults(1, Glob_NbKnots);
|
||||
for (i = 0; i < Glob_NbKnots; i++)
|
||||
aMults.SetValue(i + 1, Glob_Mults[i]);
|
||||
// Create B-Spline curve
|
||||
const Standard_Integer aDegree = 14;
|
||||
Handle(Geom_BSplineCurve) C1 = new Geom_BSplineCurve(aPoles, aKnots, aMults, aDegree);
|
||||
|
||||
// Create trimmed line
|
||||
gp_XYZ p1(60000, -7504.83, 6000);
|
||||
gp_XYZ p2(60000, 7504.83, 6000);
|
||||
Handle(Geom_Line) L = new Geom_Line(gp_Pnt(p1), gp_Dir(p2 - p1));
|
||||
Handle(Geom_TrimmedCurve) C2 = new Geom_TrimmedCurve(L, 0.0, (p2 - p1).Modulus());
|
||||
|
||||
DrawTrSurf::Set(argv[1], C1);
|
||||
DrawTrSurf::Set(argv[2], C2);
|
||||
|
||||
// Try to find extrema
|
||||
// IMPORTANT: it is not allowed to input infinite curves !
|
||||
GeomAPI_ExtremaCurveCurve Ex(C1, C2 /*,C1f,C1l,C2f,C2l*/);
|
||||
if (Ex.Extrema().IsParallel())
|
||||
{
|
||||
di << "Info: Infinite number of extrema, distance = " << Ex.LowerDistance() << "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check if extrema were found
|
||||
const Standard_Integer nbEx = Ex.NbExtrema();
|
||||
if (nbEx)
|
||||
{
|
||||
// Get minimal distance data
|
||||
gp_Pnt P1, P2;
|
||||
Ex.NearestPoints(P1, P2);
|
||||
Standard_Real U1, U2;
|
||||
Ex.LowerDistanceParameters(U1, U2);
|
||||
const Standard_Real D = Ex.LowerDistance();
|
||||
// IMPORTANT: minimal distance here means accuracy reached in intersection
|
||||
di << "Info: Minimal distance is " << D << "\n";
|
||||
di << "Info: Minimal points are (" << P1.X() << "," << P1.Y() << "," << P1.Z() << "), ("
|
||||
<< P2.X() << "," << P2.Y() << "," << P2.Z() << ")\n";
|
||||
di << "Info: Minimal parameters are (" << U1 << "), (" << U2 << ")\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
di << "Error: extrema not found\n";
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QABugs::Commands_7(Draw_Interpretor& theCommands)
|
||||
{
|
||||
const char* group = "QABugs";
|
||||
|
||||
theCommands.Add("OCC862", "OCC862 curve1 curve2", __FILE__, OCC862, group);
|
||||
return;
|
||||
(void)group;
|
||||
(void)theCommands;
|
||||
}
|
||||
|
||||
@@ -71,80 +71,11 @@ static Standard_Integer BUC60857(Draw_Interpretor& di, Standard_Integer /*argc*/
|
||||
#include <Geom2d_Ellipse.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
|
||||
static Standard_Integer OCC24303(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 2)
|
||||
return 1;
|
||||
|
||||
const Standard_Integer SolID = Draw::Atoi(a[1]);
|
||||
|
||||
// Ellipses
|
||||
Standard_Real majorRadius = 2.0;
|
||||
Standard_Real minorRadius = 1.0;
|
||||
gp_Pnt2d p0(gp::Origin2d());
|
||||
gp_Pnt2d p1(4.0, 0.0);
|
||||
|
||||
gp_Elips2d ellipse1 = gp_Elips2d(gp_Ax2d(p0, gp::DX2d()), majorRadius, minorRadius, true);
|
||||
gp_Elips2d ellipse2 = gp_Elips2d(gp_Ax2d(p1, gp::DX2d()), majorRadius, minorRadius, true);
|
||||
|
||||
Handle(Geom2d_Curve) curve1 = new Geom2d_Ellipse(ellipse1);
|
||||
Handle(Geom2d_Curve) curve2 = new Geom2d_Ellipse(ellipse2);
|
||||
DrawTrSurf::Set("c1", curve1);
|
||||
DrawTrSurf::Set("c2", curve2);
|
||||
// Expected tangent
|
||||
gp_Pnt2d centre(5.0, 0.0);
|
||||
Standard_Real radius = 3.0;
|
||||
gp_Circ2d theorical_tangent = gp_Circ2d(gp_Ax2d(centre, gp::DX2d()), radius);
|
||||
|
||||
// Calculate the tangent with Geom2dGcc_Circ2dTanRan
|
||||
|
||||
const Geom2dAdaptor_Curve AdaptedCurve1(curve1);
|
||||
const Geom2dAdaptor_Curve AdaptedCurve2(curve2);
|
||||
|
||||
GccEnt_Position curveQualif1 = GccEnt_unqualified;
|
||||
GccEnt_Position curveQualif2 = GccEnt_unqualified;
|
||||
|
||||
const Geom2dGcc_QualifiedCurve qualifiedCurve1(AdaptedCurve1, curveQualif1);
|
||||
const Geom2dGcc_QualifiedCurve qualifiedCurve2(AdaptedCurve2, curveQualif2);
|
||||
|
||||
const Geom2dGcc_Circ2d2TanRad circCalc(qualifiedCurve1,
|
||||
qualifiedCurve2,
|
||||
radius,
|
||||
/*Precision::Approximation()*/ 1.0e-9);
|
||||
|
||||
const Standard_Integer aNbSol = circCalc.NbSolutions();
|
||||
di << "Solutions " << aNbSol << "\n";
|
||||
|
||||
if ((SolID < 1) || (SolID > aNbSol))
|
||||
{
|
||||
di << "Wrong SolID value\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
gp_Circ2d calculated_tangent = circCalc.ThisSolution(SolID);
|
||||
|
||||
char Buf[10];
|
||||
for (Standard_Integer i = 1; i <= aNbSol; i++)
|
||||
{
|
||||
gp_Circ2d ct = circCalc.ThisSolution(i);
|
||||
Handle(Geom2d_Circle) GSol = new Geom2d_Circle(ct);
|
||||
Sprintf(Buf, "Sol%d", i);
|
||||
DrawTrSurf::Set(Buf, GSol);
|
||||
}
|
||||
|
||||
// This distance is different in OC 6.5.4 and OC 6.6.0
|
||||
Standard_Real dist = theorical_tangent.Location().Distance(calculated_tangent.Location());
|
||||
di << "Distance = " << dist << "\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QABugs::Commands_9(Draw_Interpretor& theCommands)
|
||||
{
|
||||
const char* group = "QABugs";
|
||||
|
||||
theCommands.Add("BUC60857", "BUC60857", __FILE__, BUC60857, group);
|
||||
theCommands.Add("OCC24303", "OCC24303 SolID ", __FILE__, OCC24303, group);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -16,10 +16,14 @@
|
||||
#include <Bnd_BoundSortBox.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Bnd_HArray1OfBox.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <BRepPrimAPI_MakeBox.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <random>
|
||||
#include <chrono>
|
||||
@@ -277,3 +281,41 @@ TEST_F(Bnd_BoundSortBoxTest, DegenerateBoxes)
|
||||
EXPECT_EQ(1, pointResult.Extent()) << "Expected to find only the point box";
|
||||
EXPECT_EQ(1, pointResult.First()) << "Point box (index 1) should be the only result";
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
// Test BUC60729: Initialize Bnd_BoundSortBox with face boxes from a solid
|
||||
// Migrated from QABugs_3.cxx
|
||||
TEST(Bnd_BoundSortBox_Test, BUC60729_InitializeWithFaceBoxes)
|
||||
{
|
||||
// Create a simple box solid
|
||||
TopoDS_Shape aShape = BRepPrimAPI_MakeBox(1.0, 1.0, 1.0).Solid();
|
||||
|
||||
// Create main bounding box for the shape
|
||||
Bnd_Box aMainBox;
|
||||
BRepBndLib::Add(aShape, aMainBox);
|
||||
|
||||
// Initialize BoundSortBox with 6 boxes (for 6 faces of the cube)
|
||||
const Standard_Integer aMaxNbrBox = 6;
|
||||
Bnd_BoundSortBox aBoundSortBox;
|
||||
aBoundSortBox.Initialize(aMainBox, aMaxNbrBox);
|
||||
|
||||
// Iterate through faces and add their bounding boxes
|
||||
TopExp_Explorer aExplorer(aShape, TopAbs_FACE);
|
||||
Standard_Integer i;
|
||||
|
||||
for (i = 1, aExplorer.ReInit(); aExplorer.More(); aExplorer.Next(), i++)
|
||||
{
|
||||
const TopoDS_Shape& aFace = aExplorer.Current();
|
||||
Bnd_Box aBox;
|
||||
BRepBndLib::Add(aFace, aBox);
|
||||
aBoundSortBox.Add(aBox, i);
|
||||
}
|
||||
|
||||
// Verify that 6 faces were processed
|
||||
EXPECT_EQ(7, i) << "Expected to process 6 faces (i should be 7 after loop)";
|
||||
|
||||
// The test passes if no exceptions occurred during initialization and addition
|
||||
// This test originally verified that the Bnd_BoundSortBox could handle
|
||||
// initialization and addition of multiple boxes without crashing
|
||||
}
|
||||
|
||||
@@ -812,4 +812,37 @@ TEST(Bnd_BoxTest, DumpJsonAndInitFromJson)
|
||||
EXPECT_DOUBLE_EQ(aZmax1, aZmax2) << "Deserialized box should match original";
|
||||
EXPECT_DOUBLE_EQ(aBox.GetGap(), aDeserializedBox.GetGap())
|
||||
<< "Deserialized gap should match original";
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
// Regression Tests
|
||||
//==================================================================================================
|
||||
|
||||
// Test OCC16485: Bnd_Box tolerance issue with cumulative enlargement
|
||||
// Migrated from QABugs_14.cxx
|
||||
TEST(Bnd_BoxTest, OCC16485_CumulativeEnlargeTolerance)
|
||||
{
|
||||
// Create points with X coordinate varying from 0 to 1000
|
||||
// and compute cumulative bounding box by adding boxes for all the
|
||||
// points, enlarged on tolerance
|
||||
const Standard_Real aTol = 1e-3;
|
||||
const Standard_Integer aNbStep = 1000;
|
||||
Bnd_Box aBox;
|
||||
|
||||
for (Standard_Integer i = 0; i <= aNbStep; i++)
|
||||
{
|
||||
gp_Pnt aP(i, 0., 0.);
|
||||
Bnd_Box aB;
|
||||
aB.Add(aP);
|
||||
aB.Enlarge(aTol);
|
||||
aB.Add(aBox);
|
||||
aBox = aB; // This was causing XMin to grow each time (regression)
|
||||
}
|
||||
|
||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
|
||||
aBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
||||
|
||||
// Verify that Xmin is approximately -tolerance (not growing with iterations)
|
||||
EXPECT_NEAR(-aTol, aXmin, 1e-10) << "Xmin should be equal to -tolerance";
|
||||
EXPECT_NEAR(aNbStep + aTol, aXmax, 1e-10) << "Xmax should be equal to nbstep + tolerance";
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// 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 <Bnd_OBB.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(Bnd_OBB_Test, OCC33009_ReBuildWithPoints)
|
||||
{
|
||||
Bnd_OBB aBndBox;
|
||||
|
||||
TColgp_Array1OfPnt aPoints(1, 5);
|
||||
aPoints.ChangeValue(1) = gp_Pnt(1, 2, 3);
|
||||
aPoints.ChangeValue(2) = gp_Pnt(3, 2, 1);
|
||||
aPoints.ChangeValue(3) = gp_Pnt(2, 3, 1);
|
||||
aPoints.ChangeValue(4) = gp_Pnt(1, 3, 2);
|
||||
aPoints.ChangeValue(5) = gp_Pnt(2, 1, 3);
|
||||
|
||||
// Should not throw exception when rebuilding with points
|
||||
EXPECT_NO_THROW(aBndBox.ReBuild(aPoints, (const TColStd_Array1OfReal*)0, true));
|
||||
}
|
||||
@@ -4,13 +4,18 @@ set(OCCT_TKMath_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
|
||||
set(OCCT_TKMath_GTests_FILES
|
||||
Bnd_BoundSortBox_Test.cxx
|
||||
Bnd_Box_Test.cxx
|
||||
Bnd_OBB_Test.cxx
|
||||
ElCLib_Test.cxx
|
||||
gp_Ax3_Test.cxx
|
||||
gp_Mat_Test.cxx
|
||||
gp_Trsf_Test.cxx
|
||||
math_BFGS_Test.cxx
|
||||
math_BissecNewton_Test.cxx
|
||||
math_BracketMinimum_Test.cxx
|
||||
math_BracketedRoot_Test.cxx
|
||||
math_Crout_Test.cxx
|
||||
math_BrentMinimum_Test.cxx
|
||||
math_ComputeKronrodPointsAndWeights_Test.cxx
|
||||
math_DirectPolynomialRoots_Test.cxx
|
||||
math_DoubleTab_Test.cxx
|
||||
math_EigenValuesSearcher_Test.cxx
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
// 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 <gp_Ax3.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(gp_Ax3_Test, OCC29406_SetDirectionPreservesOrientation)
|
||||
{
|
||||
// Test Main (Z) direction
|
||||
{
|
||||
// gp_Ax3::SetDirection() test
|
||||
gp_Ax3 anAx1, anAx2, anAx3, anAx4;
|
||||
anAx3.ZReverse();
|
||||
anAx4.ZReverse();
|
||||
|
||||
Standard_Boolean bDirect1 = anAx1.Direct();
|
||||
anAx1.SetDirection(gp::DX());
|
||||
EXPECT_EQ(bDirect1, anAx1.Direct()) << "Coordinate system orientation should be preserved";
|
||||
EXPECT_TRUE(gp::DX().IsEqual(anAx1.Direction(), Precision::Angular()));
|
||||
|
||||
Standard_Boolean bDirect2 = anAx2.Direct();
|
||||
anAx2.SetDirection(-gp::DX());
|
||||
EXPECT_EQ(bDirect2, anAx2.Direct());
|
||||
EXPECT_TRUE((-gp::DX()).IsEqual(anAx2.Direction(), Precision::Angular()));
|
||||
|
||||
Standard_Boolean bDirect3 = anAx3.Direct();
|
||||
anAx3.SetDirection(gp::DX());
|
||||
EXPECT_EQ(bDirect3, anAx3.Direct());
|
||||
EXPECT_TRUE(gp::DX().IsEqual(anAx3.Direction(), Precision::Angular()));
|
||||
|
||||
Standard_Boolean bDirect4 = anAx4.Direct();
|
||||
anAx4.SetDirection(-gp::DX());
|
||||
EXPECT_EQ(bDirect4, anAx4.Direct());
|
||||
EXPECT_TRUE((-gp::DX()).IsEqual(anAx4.Direction(), Precision::Angular()));
|
||||
|
||||
// gp_Ax3::SetAxis() test
|
||||
gp_Ax3 anAx5, anAx6;
|
||||
gp_Ax1 anAx0_1(gp::Origin(), gp::DX());
|
||||
gp_Ax1 anAx0_2(gp::Origin(), -gp::DX());
|
||||
|
||||
Standard_Boolean bDirect5 = anAx5.Direct();
|
||||
anAx5.SetAxis(anAx0_1);
|
||||
EXPECT_EQ(bDirect5, anAx5.Direct());
|
||||
EXPECT_TRUE(anAx0_1.Direction().IsEqual(anAx5.Direction(), Precision::Angular()));
|
||||
|
||||
Standard_Boolean bDirect6 = anAx6.Direct();
|
||||
anAx6.SetAxis(anAx0_2);
|
||||
EXPECT_EQ(bDirect6, anAx6.Direct());
|
||||
EXPECT_TRUE(anAx0_2.Direction().IsEqual(anAx6.Direction(), Precision::Angular()));
|
||||
}
|
||||
|
||||
// Test X direction
|
||||
{
|
||||
gp_Ax3 anAx1, anAx2, anAx3, anAx4;
|
||||
anAx3.XReverse();
|
||||
anAx4.XReverse();
|
||||
|
||||
Standard_Boolean bDirect1 = anAx1.Direct();
|
||||
anAx1.SetXDirection(gp::DZ());
|
||||
EXPECT_EQ(bDirect1, anAx1.Direct());
|
||||
gp_Dir aGoodY1 = anAx1.Direction().Crossed(gp::DZ());
|
||||
if (anAx1.Direct())
|
||||
{
|
||||
EXPECT_TRUE(aGoodY1.IsEqual(anAx1.YDirection(), Precision::Angular()));
|
||||
}
|
||||
else
|
||||
{
|
||||
EXPECT_TRUE(aGoodY1.IsOpposite(anAx1.YDirection(), Precision::Angular()));
|
||||
}
|
||||
|
||||
Standard_Boolean bDirect2 = anAx2.Direct();
|
||||
anAx2.SetXDirection(-gp::DZ());
|
||||
EXPECT_EQ(bDirect2, anAx2.Direct());
|
||||
|
||||
Standard_Boolean bDirect3 = anAx3.Direct();
|
||||
anAx3.SetXDirection(gp::DZ());
|
||||
EXPECT_EQ(bDirect3, anAx3.Direct());
|
||||
|
||||
Standard_Boolean bDirect4 = anAx4.Direct();
|
||||
anAx4.SetXDirection(-gp::DZ());
|
||||
EXPECT_EQ(bDirect4, anAx4.Direct());
|
||||
}
|
||||
|
||||
// Test Y direction
|
||||
{
|
||||
gp_Ax3 anAx1, anAx2, anAx3, anAx4;
|
||||
anAx3.YReverse();
|
||||
anAx4.YReverse();
|
||||
|
||||
Standard_Boolean bDirect1 = anAx1.Direct();
|
||||
anAx1.SetYDirection(gp::DZ());
|
||||
EXPECT_EQ(bDirect1, anAx1.Direct());
|
||||
gp_Dir aGoodX1 = anAx1.Direction().Crossed(gp::DZ());
|
||||
if (anAx1.Direct())
|
||||
{
|
||||
EXPECT_TRUE(aGoodX1.IsOpposite(anAx1.XDirection(), Precision::Angular()));
|
||||
}
|
||||
else
|
||||
{
|
||||
EXPECT_TRUE(aGoodX1.IsEqual(anAx1.XDirection(), Precision::Angular()));
|
||||
}
|
||||
|
||||
Standard_Boolean bDirect2 = anAx2.Direct();
|
||||
anAx2.SetYDirection(-gp::DZ());
|
||||
EXPECT_EQ(bDirect2, anAx2.Direct());
|
||||
|
||||
Standard_Boolean bDirect3 = anAx3.Direct();
|
||||
anAx3.SetYDirection(gp::DZ());
|
||||
EXPECT_EQ(bDirect3, anAx3.Direct());
|
||||
|
||||
Standard_Boolean bDirect4 = anAx4.Direct();
|
||||
anAx4.SetYDirection(-gp::DZ());
|
||||
EXPECT_EQ(bDirect4, anAx4.Direct());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// 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 <gp_Mat.hxx>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(gp_MatTest, OCC22595_DefaultConstructor)
|
||||
{
|
||||
gp_Mat aM0;
|
||||
|
||||
// Bug OCC22595: gp_Mat's constructors incompletely initialize memory
|
||||
// Test that default constructor properly initializes all matrix elements to zero
|
||||
EXPECT_DOUBLE_EQ(0.0, aM0(1, 1));
|
||||
EXPECT_DOUBLE_EQ(0.0, aM0(1, 2));
|
||||
EXPECT_DOUBLE_EQ(0.0, aM0(1, 3));
|
||||
|
||||
EXPECT_DOUBLE_EQ(0.0, aM0(2, 1));
|
||||
EXPECT_DOUBLE_EQ(0.0, aM0(2, 2));
|
||||
EXPECT_DOUBLE_EQ(0.0, aM0(2, 3));
|
||||
|
||||
EXPECT_DOUBLE_EQ(0.0, aM0(3, 1));
|
||||
EXPECT_DOUBLE_EQ(0.0, aM0(3, 2));
|
||||
EXPECT_DOUBLE_EQ(0.0, aM0(3, 3));
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// 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 <gp_Trsf.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(gp_TrsfTest, OCC23361_TransformationComposition)
|
||||
{
|
||||
gp_Pnt aP(0, 0, 2);
|
||||
|
||||
gp_Trsf aT1, aT2;
|
||||
aT1.SetRotation(gp_Ax1(aP, gp_Dir(gp_Dir::D::Y)), -0.49328285294022267);
|
||||
aT2.SetRotation(gp_Ax1(aP, gp_Dir(gp_Dir::D::Z)), 0.87538474718473880);
|
||||
|
||||
gp_Trsf aTComp = aT2 * aT1;
|
||||
|
||||
gp_Pnt aP1(10, 3, 4);
|
||||
gp_Pnt aP2 = aP1.Transformed(aTComp);
|
||||
gp_Pnt aP3 = aP1.Transformed(aT1);
|
||||
aP3.Transform(aT2);
|
||||
|
||||
// Points must be equal: equivalent transformations should produce equal points
|
||||
EXPECT_TRUE(aP2.IsEqual(aP3, Precision::Confusion()));
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// 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 <math_ComputeKronrodPointsAndWeights.hxx>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(math_ComputeKronrodPointsAndWeights_Test, OCC33048_ComputeWithOrder125)
|
||||
{
|
||||
// This method uses raw pointers for memory manipulations
|
||||
// Test that it completes successfully without crashes
|
||||
Standard_Boolean isOK = Standard_True;
|
||||
try
|
||||
{
|
||||
math_ComputeKronrodPointsAndWeights aCalc(125);
|
||||
EXPECT_TRUE(aCalc.IsDone()) << "Kronrod points and weights calculation should succeed";
|
||||
isOK = aCalc.IsDone();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
FAIL() << "Exception occurred during calculation of Kronrod points and weights";
|
||||
isOK = Standard_False;
|
||||
}
|
||||
|
||||
EXPECT_TRUE(isOK);
|
||||
}
|
||||
@@ -22,7 +22,11 @@ set(OCCT_TKernel_GTests_FILES
|
||||
OSD_Path_Test.cxx
|
||||
OSD_PerfMeter_Test.cxx
|
||||
Standard_ArrayStreamBuffer_Test.cxx
|
||||
Standard_Atomic_Test.cxx
|
||||
Standard_Character_Test.cxx
|
||||
Standard_Dump_Test.cxx
|
||||
Standard_Handle_Test.cxx
|
||||
TCollection_AsciiString_Test.cxx
|
||||
TCollection_ExtendedString_Test.cxx
|
||||
UnitsAPI_Test.cxx
|
||||
)
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <NCollection_Map.hxx>
|
||||
#include <NCollection_MapAlgo.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
@@ -215,4 +216,81 @@ TEST(NCollection_MapTest, ExhaustiveIterator)
|
||||
// Calculate expected sum: 0 + 1 + 2 + ... + (NUM_ELEMENTS-1)
|
||||
int expectedSum = (NUM_ELEMENTS * (NUM_ELEMENTS - 1)) / 2;
|
||||
EXPECT_EQ(expectedSum, sum);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(NCollection_MapTest, OCC24271_BooleanOperations)
|
||||
{
|
||||
const Standard_Integer aLeftLower = 1;
|
||||
const Standard_Integer aLeftUpper = 10;
|
||||
const Standard_Integer aRightLower = 5;
|
||||
const Standard_Integer aRightUpper = 15;
|
||||
|
||||
NCollection_Map<Standard_Integer> aMapLeft;
|
||||
for (Standard_Integer aKeyIter = aLeftLower; aKeyIter <= aLeftUpper; ++aKeyIter)
|
||||
{
|
||||
aMapLeft.Add(aKeyIter);
|
||||
}
|
||||
|
||||
NCollection_Map<Standard_Integer> aMapRight;
|
||||
for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aRightUpper; ++aKeyIter)
|
||||
{
|
||||
aMapRight.Add(aKeyIter);
|
||||
}
|
||||
|
||||
EXPECT_FALSE(NCollection_MapAlgo::Contains(aMapLeft, aMapRight));
|
||||
EXPECT_FALSE(NCollection_MapAlgo::Contains(aMapRight, aMapLeft));
|
||||
|
||||
NCollection_Map<Standard_Integer> aMapUnion;
|
||||
NCollection_MapAlgo::Union(aMapUnion, aMapLeft, aMapRight);
|
||||
EXPECT_EQ(aRightUpper - aLeftLower + 1, aMapUnion.Extent());
|
||||
for (Standard_Integer aKeyIter = aLeftLower; aKeyIter <= aRightUpper; ++aKeyIter)
|
||||
{
|
||||
EXPECT_TRUE(aMapUnion.Contains(aKeyIter));
|
||||
}
|
||||
|
||||
NCollection_Map<Standard_Integer> aMapSect;
|
||||
NCollection_MapAlgo::Intersection(aMapSect, aMapLeft, aMapRight);
|
||||
EXPECT_EQ(aLeftUpper - aRightLower + 1, aMapSect.Extent());
|
||||
for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aLeftUpper; ++aKeyIter)
|
||||
{
|
||||
EXPECT_TRUE(aMapSect.Contains(aKeyIter));
|
||||
}
|
||||
EXPECT_TRUE(NCollection_MapAlgo::Contains(aMapLeft, aMapSect));
|
||||
EXPECT_TRUE(NCollection_MapAlgo::Contains(aMapRight, aMapSect));
|
||||
|
||||
NCollection_Map<Standard_Integer> aMapSubsLR;
|
||||
NCollection_MapAlgo::Subtraction(aMapSubsLR, aMapLeft, aMapRight);
|
||||
EXPECT_EQ(aRightLower - aLeftLower, aMapSubsLR.Extent());
|
||||
for (Standard_Integer aKeyIter = aLeftLower; aKeyIter < aRightLower; ++aKeyIter)
|
||||
{
|
||||
EXPECT_TRUE(aMapSubsLR.Contains(aKeyIter));
|
||||
}
|
||||
|
||||
NCollection_Map<Standard_Integer> aMapSubsRL;
|
||||
NCollection_MapAlgo::Subtraction(aMapSubsRL, aMapRight, aMapLeft);
|
||||
EXPECT_EQ(aRightUpper - aLeftUpper, aMapSubsRL.Extent());
|
||||
for (Standard_Integer aKeyIter = aLeftUpper + 1; aKeyIter <= aRightUpper; ++aKeyIter)
|
||||
{
|
||||
EXPECT_TRUE(aMapSubsRL.Contains(aKeyIter));
|
||||
}
|
||||
|
||||
NCollection_Map<Standard_Integer> aMapDiff;
|
||||
NCollection_MapAlgo::Difference(aMapDiff, aMapLeft, aMapRight);
|
||||
EXPECT_EQ(aRightLower - aLeftLower + aRightUpper - aLeftUpper, aMapDiff.Extent());
|
||||
for (Standard_Integer aKeyIter = aLeftLower; aKeyIter < aRightLower; ++aKeyIter)
|
||||
{
|
||||
EXPECT_TRUE(aMapDiff.Contains(aKeyIter));
|
||||
}
|
||||
for (Standard_Integer aKeyIter = aLeftUpper + 1; aKeyIter <= aRightUpper; ++aKeyIter)
|
||||
{
|
||||
EXPECT_TRUE(aMapDiff.Contains(aKeyIter));
|
||||
}
|
||||
|
||||
NCollection_Map<Standard_Integer> aMapSwap;
|
||||
aMapSwap.Exchange(aMapSect);
|
||||
for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aLeftUpper; ++aKeyIter)
|
||||
{
|
||||
EXPECT_TRUE(aMapSwap.Contains(aKeyIter));
|
||||
}
|
||||
EXPECT_TRUE(aMapSect.IsEmpty());
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <OSD_Path.hxx>
|
||||
#include <OSD_Process.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
@@ -243,4 +244,38 @@ TEST_F(OSD_PathTest, MixedSeparators)
|
||||
OSD_Path::FolderAndFileFromPath("C:/Users/John\\Documents/file.txt", aFolder, aFileName);
|
||||
// The exact behavior might depend on implementation, but it should handle this gracefully
|
||||
EXPECT_FALSE(aFolder.IsEmpty() || aFileName.IsEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(OSD_PathTest, OCC310_TrekAndUpTrek)
|
||||
{
|
||||
OSD_Path aPath("/where/you/want/tmp/qwerty/tmp/");
|
||||
TCollection_AsciiString aTrek = aPath.Trek();
|
||||
|
||||
// OSD_Path uses | as the internal portable trek separator on all platforms
|
||||
EXPECT_STREQ("|where|you|want|tmp|qwerty|tmp|", aTrek.ToCString());
|
||||
|
||||
aPath.UpTrek();
|
||||
aTrek = aPath.Trek();
|
||||
|
||||
EXPECT_STREQ("|where|you|want|tmp|qwerty|", aTrek.ToCString());
|
||||
}
|
||||
|
||||
TEST_F(OSD_PathTest, OCC309_CurrentDirectoryAndUpTrek)
|
||||
{
|
||||
OSD_Process aProcess;
|
||||
OSD_Path aPath = aProcess.CurrentDirectory();
|
||||
TCollection_AsciiString aSystemName1;
|
||||
aPath.SystemName(aSystemName1);
|
||||
EXPECT_FALSE(aSystemName1.IsEmpty());
|
||||
|
||||
aPath.UpTrek();
|
||||
TCollection_AsciiString aSystemName2;
|
||||
aPath.SystemName(aSystemName2);
|
||||
EXPECT_FALSE(aSystemName2.IsEmpty());
|
||||
EXPECT_NE(aSystemName1, aSystemName2);
|
||||
EXPECT_LT(aSystemName2.Length(), aSystemName1.Length());
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
// Validation Tests
|
||||
//==================================================================================================
|
||||
@@ -0,0 +1,66 @@
|
||||
// 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 <OSD_Parallel.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
|
||||
#include <atomic>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
class IncrementerDecrementer
|
||||
{
|
||||
public:
|
||||
IncrementerDecrementer(std::atomic<int>* theVal, Standard_Boolean thePositive)
|
||||
: myVal(theVal),
|
||||
myPositive(thePositive)
|
||||
{
|
||||
}
|
||||
|
||||
void operator()(const size_t) const
|
||||
{
|
||||
if (myPositive)
|
||||
++(*myVal);
|
||||
else
|
||||
--(*myVal);
|
||||
}
|
||||
|
||||
private:
|
||||
std::atomic<int>* myVal;
|
||||
Standard_Boolean myPositive;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
TEST(Standard_AtomicTest, OCC22980_AtomicOperations)
|
||||
{
|
||||
std::atomic<int> aSum(0);
|
||||
|
||||
// Check returned value
|
||||
EXPECT_EQ(-1, aSum.fetch_sub(1) - 1);
|
||||
EXPECT_EQ(0, aSum.fetch_add(1) + 1);
|
||||
EXPECT_EQ(1, aSum.fetch_add(1) + 1);
|
||||
EXPECT_EQ(2, aSum.fetch_add(1) + 1);
|
||||
|
||||
// Check atomicity
|
||||
aSum = 0;
|
||||
const int N = 1 << 24; // big enough to ensure concurrency
|
||||
|
||||
// Increment
|
||||
OSD_Parallel::For(0, N, IncrementerDecrementer(&aSum, Standard_True));
|
||||
EXPECT_EQ(N, aSum);
|
||||
|
||||
// Decrement
|
||||
OSD_Parallel::For(0, N, IncrementerDecrementer(&aSum, Standard_False));
|
||||
EXPECT_EQ(0, aSum);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// 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 <Standard_Character.hxx>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(Standard_Character_Test, OCC29925_CharacterClassificationFunctions)
|
||||
{
|
||||
// Test that all character classification functions work without crashes
|
||||
// for all valid ASCII chars (including extended)
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
Standard_Character c = (char)(unsigned char)i;
|
||||
|
||||
// These functions should not throw exceptions for any valid ASCII character
|
||||
EXPECT_NO_THROW(IsAlphabetic(c));
|
||||
EXPECT_NO_THROW(IsDigit(c));
|
||||
EXPECT_NO_THROW(IsXDigit(c));
|
||||
EXPECT_NO_THROW(IsAlphanumeric(c));
|
||||
EXPECT_NO_THROW(IsControl(c));
|
||||
EXPECT_NO_THROW(IsGraphic(c));
|
||||
EXPECT_NO_THROW(IsLowerCase(c));
|
||||
EXPECT_NO_THROW(IsPrintable(c));
|
||||
EXPECT_NO_THROW(IsPunctuation(c));
|
||||
EXPECT_NO_THROW(IsSpace(c));
|
||||
EXPECT_NO_THROW(IsUpperCase(c));
|
||||
EXPECT_NO_THROW(LowerCase(c));
|
||||
EXPECT_NO_THROW(UpperCase(c));
|
||||
}
|
||||
|
||||
// Verify some specific character classifications
|
||||
EXPECT_TRUE(IsAlphabetic('A'));
|
||||
EXPECT_TRUE(IsAlphabetic('z'));
|
||||
EXPECT_FALSE(IsAlphabetic('5'));
|
||||
|
||||
EXPECT_TRUE(IsDigit('0'));
|
||||
EXPECT_TRUE(IsDigit('9'));
|
||||
EXPECT_FALSE(IsDigit('A'));
|
||||
|
||||
EXPECT_TRUE(IsSpace(' '));
|
||||
EXPECT_TRUE(IsSpace('\t'));
|
||||
EXPECT_FALSE(IsSpace('A'));
|
||||
|
||||
EXPECT_TRUE(IsLowerCase('a'));
|
||||
EXPECT_FALSE(IsLowerCase('A'));
|
||||
|
||||
EXPECT_TRUE(IsUpperCase('A'));
|
||||
EXPECT_FALSE(IsUpperCase('a'));
|
||||
|
||||
EXPECT_EQ('a', LowerCase('A'));
|
||||
EXPECT_EQ('A', UpperCase('a'));
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// 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 <Standard_Transient.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(Standard_Handle_Test, OCC24533_IsNullAndPointerChecks)
|
||||
{
|
||||
Handle(Standard_Transient) aHandle;
|
||||
|
||||
// Test IsNull() for default-constructed handle
|
||||
EXPECT_TRUE(aHandle.IsNull());
|
||||
|
||||
// Test pointer access for null handle
|
||||
const Standard_Transient* p = aHandle.get();
|
||||
EXPECT_FALSE(static_cast<bool>(p));
|
||||
EXPECT_EQ(nullptr, p);
|
||||
|
||||
// Create non-null handle
|
||||
aHandle = new Standard_Transient();
|
||||
|
||||
// Test IsNull() for non-null handle
|
||||
EXPECT_FALSE(aHandle.IsNull());
|
||||
|
||||
// Test pointer access for non-null handle
|
||||
p = aHandle.get();
|
||||
EXPECT_TRUE(static_cast<bool>(p));
|
||||
EXPECT_NE(nullptr, p);
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@@ -1414,3 +1415,158 @@ TEST(TCollection_AsciiStringTest, AssignCat_MultipleInLoop)
|
||||
EXPECT_TRUE(strstr(aResult, "1:On") != nullptr);
|
||||
EXPECT_TRUE(strstr(aResult, "alpha:") != nullptr);
|
||||
}
|
||||
|
||||
// Test BUC60724: Empty string initialization
|
||||
// Migrated from QABugs_3.cxx
|
||||
TEST(TCollection_AsciiStringTest, BUC60724_EmptyStringInitialization)
|
||||
{
|
||||
// Test empty string initialization with empty C string
|
||||
TCollection_AsciiString aString1("");
|
||||
EXPECT_NE(nullptr, aString1.ToCString());
|
||||
EXPECT_EQ(0, aString1.Length());
|
||||
EXPECT_EQ('\0', aString1.ToCString()[0]);
|
||||
|
||||
// Test empty string initialization with null character
|
||||
TCollection_AsciiString aString2('\0');
|
||||
EXPECT_NE(nullptr, aString2.ToCString());
|
||||
EXPECT_EQ(0, aString2.Length());
|
||||
EXPECT_EQ('\0', aString2.ToCString()[0]);
|
||||
}
|
||||
|
||||
// Test BUC60773: TCollection_HAsciiString initialization
|
||||
// Migrated from QABugs_3.cxx
|
||||
TEST(TCollection_AsciiStringTest, BUC60773_HAsciiStringInitialization)
|
||||
{
|
||||
// Create empty HAsciiString
|
||||
Handle(TCollection_HAsciiString) anHAscii = new TCollection_HAsciiString();
|
||||
EXPECT_FALSE(anHAscii.IsNull());
|
||||
|
||||
// Get C string from HAsciiString
|
||||
Standard_CString aStr = anHAscii->ToCString();
|
||||
EXPECT_NE(nullptr, aStr);
|
||||
|
||||
// Create AsciiString from C string
|
||||
TCollection_AsciiString aAscii(aStr);
|
||||
EXPECT_EQ(0, aAscii.Length());
|
||||
EXPECT_TRUE(aAscii.IsEmpty());
|
||||
}
|
||||
|
||||
// Test OCC6794: TCollection_AsciiString large concatenation
|
||||
// Migrated from QABugs_14.cxx
|
||||
TEST(TCollection_AsciiStringTest, OCC6794_LargeConcatenation)
|
||||
{
|
||||
// Test concatenation of many small strings to verify memory handling
|
||||
const Standard_Integer aNb = 10000; // Use a smaller number for faster test
|
||||
const char* aC = "a";
|
||||
|
||||
TCollection_AsciiString anAscii;
|
||||
for (Standard_Integer i = 1; i <= aNb; i++)
|
||||
{
|
||||
anAscii += TCollection_AsciiString(aC);
|
||||
}
|
||||
|
||||
// Verify the final length matches expected
|
||||
EXPECT_EQ(aNb, anAscii.Length()) << "Concatenated string should have correct length";
|
||||
EXPECT_FALSE(anAscii.IsEmpty()) << "Concatenated string should not be empty";
|
||||
}
|
||||
|
||||
TEST(TCollection_AsciiStringTest, OCC11758_ComprehensiveConstructorsAndMethods)
|
||||
{
|
||||
const char* theStr = "0123456789";
|
||||
|
||||
for (Standard_Integer i = 0; i < 5; ++i)
|
||||
{
|
||||
// TCollection_AsciiString(const Standard_CString astring)
|
||||
TCollection_AsciiString a(theStr + i);
|
||||
EXPECT_STREQ(theStr + i, a.ToCString());
|
||||
|
||||
// TCollection_AsciiString(const Standard_CString astring, const Standard_Integer aLen)
|
||||
TCollection_AsciiString b(theStr + i, 3);
|
||||
EXPECT_EQ(3, b.Length());
|
||||
EXPECT_EQ(0, strncmp(b.ToCString(), theStr + i, 3));
|
||||
|
||||
// TCollection_AsciiString(const Standard_Integer aValue)
|
||||
TCollection_AsciiString c(i);
|
||||
EXPECT_TRUE(c.IsIntegerValue());
|
||||
EXPECT_EQ(i, c.IntegerValue());
|
||||
|
||||
// TCollection_AsciiString(const Standard_Real aValue)
|
||||
TCollection_AsciiString d(0.1 * i);
|
||||
EXPECT_TRUE(d.IsRealValue(Standard_True));
|
||||
EXPECT_FALSE(TCollection_AsciiString("3.3!").IsRealValue(Standard_True));
|
||||
EXPECT_TRUE(TCollection_AsciiString("3.3!").IsRealValue(Standard_False));
|
||||
EXPECT_STREQ("3.3", TCollection_AsciiString(3.3).ToCString());
|
||||
|
||||
// Copy constructor
|
||||
TCollection_AsciiString e(d);
|
||||
EXPECT_STREQ(d.ToCString(), e.ToCString());
|
||||
EXPECT_EQ(d.Length(), e.Length());
|
||||
|
||||
// Concatenation with char
|
||||
TCollection_AsciiString f(e, '\a');
|
||||
EXPECT_EQ(e.Length() + 1, f.Length());
|
||||
EXPECT_EQ(0, strncmp(f.ToCString(), e.ToCString(), e.Length()));
|
||||
EXPECT_EQ('\a', f.Value(f.Length()));
|
||||
|
||||
// Concatenation with C string
|
||||
TCollection_AsciiString g(f, theStr);
|
||||
EXPECT_EQ(f.Length() + (Standard_Integer)strlen(theStr), g.Length());
|
||||
EXPECT_EQ(0, strncmp(g.ToCString(), f.ToCString(), f.Length()));
|
||||
EXPECT_EQ(f.Length() + 1, g.Search(theStr));
|
||||
|
||||
// Concatenation with TCollection_AsciiString
|
||||
TCollection_AsciiString h(d, a);
|
||||
EXPECT_EQ(d.Length() + a.Length(), h.Length());
|
||||
EXPECT_EQ(0, strncmp(h.ToCString(), d.ToCString(), d.Length()));
|
||||
EXPECT_EQ(0, strncmp(h.ToCString() + d.Length(), a.ToCString(), a.Length()));
|
||||
|
||||
// AssignCat with C string
|
||||
c.AssignCat(a.ToCString());
|
||||
EXPECT_EQ(1 + a.Length(), c.Length());
|
||||
EXPECT_EQ(2, c.Search(a));
|
||||
|
||||
// AssignCat with TCollection_AsciiString
|
||||
Standard_Integer dl = d.Length();
|
||||
d.AssignCat(a);
|
||||
EXPECT_EQ(dl + a.Length(), d.Length());
|
||||
EXPECT_EQ(dl + 1, d.Search(a));
|
||||
|
||||
// Capitalize
|
||||
TCollection_AsciiString capitalize("aBC");
|
||||
capitalize.Capitalize();
|
||||
EXPECT_STREQ("Abc", capitalize.ToCString());
|
||||
|
||||
// Copy assignment
|
||||
d = theStr + i;
|
||||
EXPECT_STREQ(theStr + i, d.ToCString());
|
||||
|
||||
d = h;
|
||||
EXPECT_STREQ(h.ToCString(), d.ToCString());
|
||||
|
||||
// Insert C string
|
||||
dl = d.Length();
|
||||
d.Insert(2, theStr);
|
||||
EXPECT_EQ(dl + (Standard_Integer)strlen(theStr), d.Length());
|
||||
EXPECT_EQ(0, strncmp(d.ToCString() + 1, theStr, strlen(theStr)));
|
||||
|
||||
// Insert char
|
||||
d = theStr;
|
||||
d.Insert(i + 1, 'i');
|
||||
EXPECT_EQ((Standard_Integer)strlen(theStr) + 1, d.Length());
|
||||
EXPECT_EQ('i', d.Value(i + 1));
|
||||
EXPECT_STREQ(theStr + i, d.ToCString() + i + 1);
|
||||
|
||||
// Insert TCollection_AsciiString
|
||||
d = theStr;
|
||||
d.Insert(i + 1, TCollection_AsciiString("i"));
|
||||
EXPECT_EQ((Standard_Integer)strlen(theStr) + 1, d.Length());
|
||||
EXPECT_EQ('i', d.Value(i + 1));
|
||||
EXPECT_STREQ(theStr + i, d.ToCString() + i + 1);
|
||||
|
||||
// IsDifferent
|
||||
EXPECT_TRUE(d.IsDifferent(theStr));
|
||||
EXPECT_TRUE(d.IsDifferent("theStr"));
|
||||
EXPECT_TRUE(d.IsDifferent(""));
|
||||
EXPECT_FALSE(d.IsDifferent(d.ToCString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,3 +413,35 @@ TEST(TCollection_ExtendedStringTest, BoundaryValues)
|
||||
EXPECT_EQ(1, aStringMaxBMP.Length());
|
||||
EXPECT_FALSE(aStringMaxBMP.IsAscii());
|
||||
}
|
||||
|
||||
// Test TestMem: Large string memory allocation
|
||||
// Migrated from QABugs_3.cxx
|
||||
TEST(TCollection_ExtendedStringTest, TestMem_LargeStringAllocation)
|
||||
{
|
||||
// Test allocation of a large extended string (1MB of characters)
|
||||
// This test verifies that the string can handle large allocations without crashing
|
||||
const Standard_Integer aLargeSize = 1024 * 1024;
|
||||
TCollection_ExtendedString aString(aLargeSize, 'A');
|
||||
|
||||
EXPECT_EQ(aLargeSize, aString.Length());
|
||||
EXPECT_FALSE(aString.IsEmpty());
|
||||
}
|
||||
|
||||
// Test OCC3277: TCollection_ExtendedString Cat operation
|
||||
TEST(TCollection_ExtendedStringTest, OCC3277_CatOperation)
|
||||
{
|
||||
// Test concatenation of an input string to an empty extended string
|
||||
TCollection_ExtendedString anExtendedString;
|
||||
TCollection_ExtendedString anInputString("TestString");
|
||||
|
||||
// Cat() returns a new string, it doesn't modify the original
|
||||
TCollection_ExtendedString aResult = anExtendedString.Cat(anInputString);
|
||||
|
||||
// Verify the result
|
||||
EXPECT_EQ(anInputString.Length(), aResult.Length())
|
||||
<< "Concatenated string should have same length as input";
|
||||
EXPECT_FALSE(aResult.IsEmpty()) << "Concatenated string should not be empty";
|
||||
|
||||
// Verify the content matches
|
||||
EXPECT_EQ(anInputString, aResult) << "Concatenated string should match input string";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// 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 <UnitsAPI.hxx>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
// Test BUC60727: UnitsAPI unit conversion
|
||||
// Migrated from QABugs_3.cxx
|
||||
TEST(UnitsAPI_Test, BUC60727_AnyToLS_Conversion)
|
||||
{
|
||||
// Set local system to MDTV (Millimeter, Degree, Ton, Velocity)
|
||||
UnitsAPI::SetLocalSystem(UnitsAPI_MDTV);
|
||||
|
||||
// Test conversion: 3 mm in the MDTV system should remain 3
|
||||
// (since the base unit for length in MDTV is millimeter)
|
||||
Standard_Real aResult = UnitsAPI::AnyToLS(3.0, "mm");
|
||||
EXPECT_DOUBLE_EQ(3.0, aResult);
|
||||
}
|
||||
@@ -2028,3 +2028,24 @@ TEST_F(BFuseSimpleTest, BlendBoxWithCylinderBottomNegY_K9)
|
||||
const TopoDS_Shape aResult = PerformFuse(aBlendedBox, aCylinder);
|
||||
ValidateResult(aResult, 322832);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
// Additional Tests
|
||||
//==================================================================================================
|
||||
|
||||
TEST_F(BFuseSimpleTest, OCC277_FuseAndCommonOfOverlappingBoxes)
|
||||
{
|
||||
BRepPrimAPI_MakeBox aBox1Maker(100, 100, 100);
|
||||
BRepPrimAPI_MakeBox aBox2Maker(gp_Pnt(50, 50, 50), 200, 200, 200);
|
||||
|
||||
TopoDS_Shape aShape1 = aBox1Maker.Shape();
|
||||
TopoDS_Shape aShape2 = aBox2Maker.Shape();
|
||||
|
||||
BRepAlgoAPI_Fuse aFuseOp(aShape1, aShape2);
|
||||
TopoDS_Shape aFuseResult = aFuseOp.Shape();
|
||||
EXPECT_FALSE(aFuseResult.IsNull());
|
||||
|
||||
BRepAlgoAPI_Common aCommonOp(aShape1, aShape2);
|
||||
TopoDS_Shape aCommonResult = aCommonOp.Shape();
|
||||
EXPECT_FALSE(aCommonResult.IsNull());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# Test source files for TKGeomAlgo
|
||||
set(OCCT_TKGeomAlgo_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
|
||||
set(OCCT_TKGeomAlgo_GTests_FILES
|
||||
Geom2dAPI_InterCurveCurve_Test.cxx
|
||||
GeomFill_CorrectedFrenet_Test.cxx
|
||||
GeomPlate_BuildPlateSurface_Test.cxx
|
||||
)
|
||||
@@ -0,0 +1,66 @@
|
||||
// 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 <Geom2dAPI_InterCurveCurve.hxx>
|
||||
#include <Geom2d_Ellipse.hxx>
|
||||
#include <gp_Elips2d.hxx>
|
||||
#include <gp_Ax2d.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <math_NewtonFunctionRoot.hxx>
|
||||
#include <math_TrigonometricEquationFunction.hxx>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(Geom2dAPI_InterCurveCurve_Test, OCC29289_EllipseIntersectionNewtonRoot)
|
||||
{
|
||||
// Create two ellipses
|
||||
gp_Elips2d e1(gp_Ax2d(gp_Pnt2d(0., 0.), gp_Dir2d(gp_Dir2d::D::X)), 2., 1.);
|
||||
Handle(Geom2d_Ellipse) Ge1 = new Geom2d_Ellipse(e1);
|
||||
gp_Elips2d e2(gp_Ax2d(gp_Pnt2d(0.5, 0.5), gp_Dir2d(1., 1.)), 2., 1.);
|
||||
Handle(Geom2d_Ellipse) Ge2 = new Geom2d_Ellipse(e2);
|
||||
|
||||
// Find intersection points
|
||||
Geom2dAPI_InterCurveCurve Intersector;
|
||||
Intersector.Init(Ge1, Ge2, 1.e-7);
|
||||
EXPECT_GT(Intersector.NbPoints(), 0) << "Error: intersector found no points";
|
||||
|
||||
// Setup trigonometric equation: A*Cos(x) + B*Sin(x) + C*Cos(2*x) + D*Sin(2*x) + E
|
||||
Standard_Real A, B, C, D, E;
|
||||
A = 1.875;
|
||||
B = -.75;
|
||||
C = -.5;
|
||||
D = -.25;
|
||||
E = -.25;
|
||||
math_TrigonometricEquationFunction MyF(A, B, C, D, E);
|
||||
|
||||
Standard_Real Tol1 = 1.e-15;
|
||||
Standard_Real Eps = 1.5e-12;
|
||||
Standard_Integer Nit[] = {5, 6, 7, 6};
|
||||
|
||||
// For each intersection point, verify Newton root finding
|
||||
Standard_Real TetaPrev = 0.;
|
||||
Standard_Integer i;
|
||||
for (i = 1; i <= Intersector.NbPoints(); i++)
|
||||
{
|
||||
Standard_Real Teta = Intersector.Intersector().Point(i).ParamOnFirst();
|
||||
Standard_Real X = Teta - 0.1 * (Teta - TetaPrev);
|
||||
TetaPrev = Teta;
|
||||
|
||||
math_NewtonFunctionRoot Resol(MyF, X, Tol1, Eps, Nit[i - 1]);
|
||||
ASSERT_TRUE(Resol.IsDone()) << "Error: Newton is not done for " << Teta;
|
||||
|
||||
Standard_Real TetaNewton = Resol.Root();
|
||||
EXPECT_LE(Abs(Teta - TetaNewton), 1.e-7) << "Error: Newton root is wrong for " << Teta;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// 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 <GeomPlate_BuildPlateSurface.hxx>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(GeomPlate_BuildPlateSurface, OCC525_PerformWithoutConstraints)
|
||||
{
|
||||
GeomPlate_BuildPlateSurface aBuilder;
|
||||
aBuilder.Perform();
|
||||
|
||||
// Note: Due to implementation behavior, IsDone() returns true after Init()
|
||||
// even though Perform() returns early when there are no constraints.
|
||||
// The resulting surface is null, which is the expected behavior.
|
||||
// Original bug OCC525: Bug in GeomPlate_BuildPlateSurface::ComputeSurfInit()
|
||||
EXPECT_TRUE(aBuilder.IsDone());
|
||||
EXPECT_TRUE(aBuilder.Surface().IsNull())
|
||||
<< "Surface should be null when Perform() is called without constraints";
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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 <BRepLib_MakeWire.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(BRepLib_MakeWire_Test, OCC30708_2_InitializeWithNullWire)
|
||||
{
|
||||
TopoDS_Wire empty;
|
||||
|
||||
// Should not throw exception when initializing with null wire
|
||||
EXPECT_NO_THROW(BRepLib_MakeWire aWBuilder(empty));
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// 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 <gtest/gtest.h>
|
||||
|
||||
#include <BRepAlgoAPI_Fuse.hxx>
|
||||
#include <BRepBuilderAPI_MakePolygon.hxx>
|
||||
#include <BRepOffsetAPI_ThruSections.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
// Test OCC10006: BRepOffsetAPI_ThruSections loft operation with Boolean fusion
|
||||
TEST(BRepOffsetAPI_ThruSections_Test, OCC10006_LoftAndFusion)
|
||||
{
|
||||
// Define bottom and top polygon coordinates for first loft
|
||||
double aBottomPoints1[12] = {10, -10, 0, 100, -10, 0, 100, -100, 0, 10, -100, 0};
|
||||
double aTopPoints1[12] = {0, 0, 10, 100, 0, 10, 100, -100, 10, 0, -100, 10};
|
||||
|
||||
// Define bottom and top polygon coordinates for second loft
|
||||
double aBottomPoints2[12] = {0, 0, 10.00, 100, 0, 10.00, 100, -100, 10.00, 0, -100, 10.00};
|
||||
double aTopPoints2[12] = {0, 0, 250, 100, 0, 250, 100, -100, 250, 0, -100, 250};
|
||||
|
||||
// Create polygons
|
||||
BRepBuilderAPI_MakePolygon aBottomPolygon1, aTopPolygon1, aBottomPolygon2, aTopPolygon2;
|
||||
gp_Pnt aTmpPnt;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
aTmpPnt.SetCoord(aBottomPoints1[3 * i], aBottomPoints1[3 * i + 1], aBottomPoints1[3 * i + 2]);
|
||||
aBottomPolygon1.Add(aTmpPnt);
|
||||
|
||||
aTmpPnt.SetCoord(aTopPoints1[3 * i], aTopPoints1[3 * i + 1], aTopPoints1[3 * i + 2]);
|
||||
aTopPolygon1.Add(aTmpPnt);
|
||||
|
||||
aTmpPnt.SetCoord(aBottomPoints2[3 * i], aBottomPoints2[3 * i + 1], aBottomPoints2[3 * i + 2]);
|
||||
aBottomPolygon2.Add(aTmpPnt);
|
||||
|
||||
aTmpPnt.SetCoord(aTopPoints2[3 * i], aTopPoints2[3 * i + 1], aTopPoints2[3 * i + 2]);
|
||||
aTopPolygon2.Add(aTmpPnt);
|
||||
}
|
||||
|
||||
// Close polygons
|
||||
aBottomPolygon1.Close();
|
||||
aTopPolygon1.Close();
|
||||
aBottomPolygon2.Close();
|
||||
aTopPolygon2.Close();
|
||||
|
||||
// Create first loft (ThruSections)
|
||||
BRepOffsetAPI_ThruSections aLoft1(Standard_True, Standard_True);
|
||||
aLoft1.AddWire(aBottomPolygon1.Wire());
|
||||
aLoft1.AddWire(aTopPolygon1.Wire());
|
||||
aLoft1.Build();
|
||||
|
||||
// Create second loft (ThruSections)
|
||||
BRepOffsetAPI_ThruSections aLoft2(Standard_True, Standard_True);
|
||||
aLoft2.AddWire(aBottomPolygon2.Wire());
|
||||
aLoft2.AddWire(aTopPolygon2.Wire());
|
||||
aLoft2.Build();
|
||||
|
||||
// Verify that loft operations succeeded
|
||||
EXPECT_FALSE(aLoft1.Shape().IsNull()) << "First loft operation should produce a valid shape";
|
||||
EXPECT_FALSE(aLoft2.Shape().IsNull()) << "Second loft operation should produce a valid shape";
|
||||
|
||||
// Perform Boolean fusion of the two lofted shapes
|
||||
BRepAlgoAPI_Fuse aFusion(aLoft1.Shape(), aLoft2.Shape());
|
||||
|
||||
// Verify that fusion operation succeeded
|
||||
EXPECT_FALSE(aFusion.Shape().IsNull())
|
||||
<< "Boolean fusion of lofted shapes should produce a valid shape";
|
||||
}
|
||||
@@ -2,4 +2,6 @@
|
||||
set(OCCT_TKTopAlgo_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
set(OCCT_TKTopAlgo_GTests_FILES
|
||||
BRepLib_MakeWire_Test.cxx
|
||||
BRepOffsetAPI_ThruSections_Test.cxx
|
||||
)
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
// 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 <gtest/gtest.h>
|
||||
|
||||
#include <BRepAdaptor_CompCurve.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
|
||||
// Test OCC5696: BRepAdaptor_CompCurve::Edge() method
|
||||
// Migrated from QABugs_5.cxx
|
||||
TEST(BRepAdaptor_CompCurve_Test, OCC5696_EdgeMethod)
|
||||
{
|
||||
// Create a simple edge from two points
|
||||
TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(gp_Pnt(0, 0, 0), gp_Pnt(2, 0, 0));
|
||||
|
||||
// Create a wire from the edge
|
||||
TopoDS_Wire aWire = BRepBuilderAPI_MakeWire(anEdge);
|
||||
|
||||
// Create a composite curve adaptor
|
||||
BRepAdaptor_CompCurve aCurve(aWire);
|
||||
|
||||
// Get curve parameters
|
||||
Standard_Real aFirst = aCurve.FirstParameter();
|
||||
Standard_Real aLast = aCurve.LastParameter();
|
||||
Standard_Real aPar = (aFirst + aLast) / 2.0;
|
||||
|
||||
// Test the Edge() method
|
||||
Standard_Real aParEdge = 0.0;
|
||||
TopoDS_Edge anEdgeFound;
|
||||
|
||||
// The original test was checking that this method doesn't throw an exception
|
||||
// and returns valid parameter
|
||||
EXPECT_NO_THROW({ aCurve.Edge(aPar, anEdgeFound, aParEdge); })
|
||||
<< "Edge() method should not throw an exception";
|
||||
|
||||
// Verify that the returned edge is valid
|
||||
EXPECT_FALSE(anEdgeFound.IsNull()) << "Returned edge should not be null";
|
||||
|
||||
// Verify that the parameter is within valid range [0, edge length]
|
||||
EXPECT_GE(aParEdge, 0.0) << "Edge parameter should be non-negative";
|
||||
EXPECT_LE(aParEdge, 2.0) << "Edge parameter should not exceed edge length";
|
||||
|
||||
// The parameter should be approximately half of the edge length
|
||||
EXPECT_NEAR(1.0, aParEdge, 0.01) << "Edge parameter should be approximately 1.0";
|
||||
}
|
||||
@@ -2,4 +2,7 @@
|
||||
set(OCCT_TKBRep_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
set(OCCT_TKBRep_GTests_FILES
|
||||
BRepAdaptor_CompCurve_Test.cxx
|
||||
TopoDS_Edge_Test.cxx
|
||||
TopoDS_Iterator_Test.cxx
|
||||
)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// 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 <gtest/gtest.h>
|
||||
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
|
||||
// Test BUC60828: TopoDS_Edge Infinite flag getter/setter
|
||||
// Migrated from QABugs_16.cxx
|
||||
TEST(TopoDS_Edge_Test, BUC60828_InfiniteFlag)
|
||||
{
|
||||
// Create a simple edge
|
||||
TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(gp_Pnt(0., 0., 0.), gp_Pnt(0., 0., 1.));
|
||||
|
||||
// Check initial flag value (should be false by default)
|
||||
Standard_Boolean anInitialValue = anEdge.Infinite();
|
||||
EXPECT_FALSE(anInitialValue) << "Initial Infinite flag should be false";
|
||||
|
||||
// Set the flag to true
|
||||
anEdge.Infinite(Standard_True);
|
||||
|
||||
// Verify the flag was set correctly
|
||||
Standard_Boolean aCurrentValue = anEdge.Infinite();
|
||||
EXPECT_TRUE(aCurrentValue) << "Infinite flag should be true after setting";
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// 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 <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(TopoDS_Iterator_Test, OCC30708_1_InitializeWithNullShape)
|
||||
{
|
||||
TopoDS_Iterator it;
|
||||
TopoDS_Shape empty;
|
||||
|
||||
// Should not throw exception when initializing with null shape
|
||||
EXPECT_NO_THROW(it.Initialize(empty));
|
||||
|
||||
// More() should return false on null shape
|
||||
EXPECT_FALSE(it.More());
|
||||
}
|
||||
@@ -5,4 +5,5 @@ set(OCCT_TKG2d_GTests_FILES
|
||||
Geom2d_BSplineCurve_Test.cxx
|
||||
Geom2d_BezierCurve_Test.cxx
|
||||
Geom2d_OffsetCurve_Test.cxx
|
||||
Geom2dGcc_Circ2d2TanRad_Test.cxx
|
||||
)
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
// 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 <gtest/gtest.h>
|
||||
|
||||
#include <Geom2d_Ellipse.hxx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <Geom2dGcc_Circ2d2TanRad.hxx>
|
||||
#include <Geom2dGcc_QualifiedCurve.hxx>
|
||||
#include <GccEnt_Position.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <gp_Elips2d.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
|
||||
// Test OCC24303: Geom2dGcc_Circ2d2TanRad - Circle tangent to two ellipses
|
||||
// Migrated from QABugs_9.cxx
|
||||
TEST(Geom2dGcc_Circ2d2TanRad_Test, OCC24303_CircleTangentToTwoEllipses)
|
||||
{
|
||||
// Create two ellipses
|
||||
Standard_Real aMajorRadius = 2.0;
|
||||
Standard_Real aMinorRadius = 1.0;
|
||||
gp_Pnt2d aP0(gp::Origin2d());
|
||||
gp_Pnt2d aP1(4.0, 0.0);
|
||||
|
||||
gp_Elips2d anEllipse1 = gp_Elips2d(gp_Ax2d(aP0, gp::DX2d()), aMajorRadius, aMinorRadius, true);
|
||||
gp_Elips2d anEllipse2 = gp_Elips2d(gp_Ax2d(aP1, gp::DX2d()), aMajorRadius, aMinorRadius, true);
|
||||
|
||||
Handle(Geom2d_Curve) aCurve1 = new Geom2d_Ellipse(anEllipse1);
|
||||
Handle(Geom2d_Curve) aCurve2 = new Geom2d_Ellipse(anEllipse2);
|
||||
|
||||
// Expected tangent circle
|
||||
gp_Pnt2d aCentre(5.0, 0.0);
|
||||
Standard_Real aRadius = 3.0;
|
||||
gp_Circ2d aTheoricalTangent = gp_Circ2d(gp_Ax2d(aCentre, gp::DX2d()), aRadius);
|
||||
|
||||
// Calculate the tangent circles with Geom2dGcc_Circ2d2TanRad
|
||||
const Geom2dAdaptor_Curve anAdaptedCurve1(aCurve1);
|
||||
const Geom2dAdaptor_Curve anAdaptedCurve2(aCurve2);
|
||||
|
||||
GccEnt_Position aCurveQualif1 = GccEnt_unqualified;
|
||||
GccEnt_Position aCurveQualif2 = GccEnt_unqualified;
|
||||
|
||||
const Geom2dGcc_QualifiedCurve aQualifiedCurve1(anAdaptedCurve1, aCurveQualif1);
|
||||
const Geom2dGcc_QualifiedCurve aQualifiedCurve2(anAdaptedCurve2, aCurveQualif2);
|
||||
|
||||
const Geom2dGcc_Circ2d2TanRad aCircCalc(aQualifiedCurve1, aQualifiedCurve2, aRadius, 1.0e-9);
|
||||
|
||||
const Standard_Integer aNbSol = aCircCalc.NbSolutions();
|
||||
|
||||
// Verify that solutions were found
|
||||
EXPECT_GT(aNbSol, 0) << "Should find at least one solution";
|
||||
|
||||
// Check that all solutions have the correct radius
|
||||
for (Standard_Integer i = 1; i <= aNbSol; i++)
|
||||
{
|
||||
gp_Circ2d aCt = aCircCalc.ThisSolution(i);
|
||||
EXPECT_NEAR(aRadius, aCt.Radius(), 1.0e-6)
|
||||
<< "Solution " << i << " should have radius " << aRadius;
|
||||
}
|
||||
|
||||
// For the first solution, check the distance from theoretical tangent
|
||||
if (aNbSol > 0)
|
||||
{
|
||||
gp_Circ2d aCalculatedTangent = aCircCalc.ThisSolution(1);
|
||||
Standard_Real aDist = aTheoricalTangent.Location().Distance(aCalculatedTangent.Location());
|
||||
|
||||
// The distance should be relatively small (solutions should be close)
|
||||
// Note: The exact distance may vary depending on which solution is returned
|
||||
EXPECT_LT(aDist, 10.0) << "Distance from theoretical tangent should be reasonable";
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,6 @@ set(OCCT_TKG3d_GTests_FILES
|
||||
Geom_BSplineSurface_Test.cxx
|
||||
Geom_OffsetCurve_Test.cxx
|
||||
Geom_OffsetSurface_Test.cxx
|
||||
GeomAPI_ExtremaCurveCurve_Test.cxx
|
||||
GeomAPI_Interpolate_Test.cxx
|
||||
)
|
||||
|
||||
@@ -0,0 +1,323 @@
|
||||
// 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 <gtest/gtest.h>
|
||||
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <GeomAPI_ExtremaCurveCurve.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
|
||||
// Test OCC862: GeomAPI_ExtremaCurveCurve - Extrema between BSpline and line
|
||||
TEST(GeomAPI_ExtremaCurveCurve_Test, OCC862_ExtremaBSplineAndLine)
|
||||
{
|
||||
// Define BSpline curve data (from Glob_Poles, Glob_Knots, Glob_Mults)
|
||||
const Standard_Integer aNbPoles = 195;
|
||||
const Standard_Real aPoles[195][3] = {
|
||||
{60000, 31.937047503393231, 799.36226142892554},
|
||||
{60000.000000027772, 16.712487623992825, 799.97053069028755},
|
||||
{59999.999999875639, 7.3723603687660546, 799.97042131653711},
|
||||
{60000.000000331296, 1.2070383839533065, 799.90534456032105},
|
||||
{59999.999999361171, -2.5807810139032785, 799.77442818789041},
|
||||
{60000.000000952597, -4.7405254527655112, 799.70146419719595},
|
||||
{59999.999998867599, -5.3922917628932563, 799.62943054158143},
|
||||
{60000.000001091154, -5.1399175234965044, 799.63364074172011},
|
||||
{59999.999999142601, -3.6992503431468067, 799.67179299415568},
|
||||
{60000.000000546061, -1.6910663098148713, 799.76799688166773},
|
||||
{59999.999999725333, 1.1886267067330731, 799.91818018455035},
|
||||
{60000.000000101914, 4.5979596894282677, 800.11782874041273},
|
||||
{59999.999999977204, 8.5921385739756673, 800.36980220999453},
|
||||
{60000.000000018619, 16.600658956791417, 800.90755378048414},
|
||||
{59999.999999985768, 26.040687605616604, 801.59827916977554},
|
||||
{60000.000000052918, 30.448324872994441, 801.9310695501531},
|
||||
{59999.999999883308, 35.089921752286457, 802.29194004854389},
|
||||
{60000.000000186978, 39.947755013962528, 802.68007678107051},
|
||||
{59999.99999976845, 45.005892525213071, 803.09465896567826},
|
||||
{60000.000000227068, 50.249778854659326, 803.53486876081706},
|
||||
{59999.999999821659, 55.665932960782108, 803.9998957687626},
|
||||
{60000.000000112479, 61.241734208767859, 804.48893829648762},
|
||||
{59999.999999943684, 66.965272918611916, 805.00120177704798},
|
||||
{60000.000000021486, 72.8252416954995, 805.53589657709654},
|
||||
{59999.99999999431, 78.810843745189473, 806.09223572876306},
|
||||
{60000.000000004045, 87.962119756404547, 806.95803383418911},
|
||||
{59999.99999999725, 97.349976765262795, 807.869010426567},
|
||||
{60000.000000017491, 100.50428991828356, 808.17759139897635},
|
||||
{59999.99999994829, 103.68239055379394, 808.49099684342912},
|
||||
{60000.000000105072, 106.88305649144334, 808.80912918631941},
|
||||
{59999.999999835563, 110.10508187457555, 809.13189073948308},
|
||||
{60000.000000207947, 113.34727572158297, 809.45918381767103},
|
||||
{59999.999999784653, 116.60846040037053, 809.79091039912782},
|
||||
{60000.000000180742, 119.88747020406682, 810.12697237079749},
|
||||
{59999.999999880296, 123.18314981484644, 810.46727114678265},
|
||||
{60000.000000059626, 126.49435287223255, 810.81170785335109},
|
||||
{59999.999999979838, 129.81994045902351, 811.16018308253979},
|
||||
{60000.000000015229, 134.8281992328765, 811.68880383859914},
|
||||
{59999.99999998945, 139.86373510893441, 812.2260602582727},
|
||||
{60000.000000059066, 141.54513692067022, 812.40609267860532},
|
||||
{59999.999999845008, 143.22928798266199, 812.58705944070834},
|
||||
{60000.000000278043, 144.91604799540772, 812.7689478797023},
|
||||
{59999.999999621934, 146.60527693312631, 812.95174532592102},
|
||||
{60000.000000407505, 148.29683501034282, 813.13543899059755},
|
||||
{59999.999999644526, 149.99058265886663, 813.32001613307352},
|
||||
{60000.000000252723, 151.68638048575326, 813.5054638442823},
|
||||
{59999.999999853622, 153.38408925794459, 813.69176926621947},
|
||||
{60000.000000068765, 155.08356985703421, 813.87891939578799},
|
||||
{59999.999999973967, 156.7846832610312, 814.06690122038856},
|
||||
{60000.00000002468, 159.33859412935516, 814.35010184114628},
|
||||
{59999.999999977736, 161.89555354531564, 814.63511466528189},
|
||||
{60000.000000145039, 162.74819471256941, 814.73031865086841},
|
||||
{59999.999999608634, 163.60113987644607, 814.82572069112655},
|
||||
{60000.000000709108, 164.45437167903589, 814.92131914784375},
|
||||
{59999.999999031643, 165.3078727497936, 815.0171123286641},
|
||||
{60000.000001042623, 166.16162573916125, 815.11309861889924},
|
||||
{59999.999999097396, 167.01561326831904, 815.20927628960794},
|
||||
{60000.000000630716, 167.86981798631649, 815.30564372626975},
|
||||
{59999.999999648215, 168.72422251240596, 815.40219920078994},
|
||||
{60000.000000151289, 169.57880948189478, 815.4989410625825},
|
||||
{59999.999999954052, 170.43356151298337, 815.5958676029403},
|
||||
{60000.000000034408, 171.71591108030151, 815.74153190228753},
|
||||
{59999.999999976135, 172.9985538007256, 815.88760410128577},
|
||||
{60000.000000129759, 173.42613177350728, 815.93633994702668},
|
||||
{59999.999999664251, 173.85373796967124, 815.98512067846866},
|
||||
{60000.00000060827, 174.28137021936112, 816.03394612011459},
|
||||
{59999.99999914426, 174.70902633885802, 816.08281598496671},
|
||||
{60000.000000969369, 175.13670416564241, 816.13173017155248},
|
||||
{59999.999999107844, 175.56440150794049, 816.18068832455049},
|
||||
{60000.00000066567, 175.9921162052986, 816.22969037578832},
|
||||
{59999.999999602165, 176.41984606692156, 816.27873598355484},
|
||||
{60000.00000018561, 176.84758892491178, 816.3278250228899},
|
||||
{59999.999999935775, 177.27534259516338, 816.37695722529566},
|
||||
{60000.000000054533, 177.91698605475608, 816.45071998561696},
|
||||
{59999.999999955864, 178.55864403901305, 816.52457892469988},
|
||||
{60000.000000281914, 178.7725313764083, 816.54920923644852},
|
||||
{59999.999999214248, 178.98641977813006, 816.57385016025694},
|
||||
{60000.000001492997, 179.20030898752373, 816.59850173903158},
|
||||
{59999.999997853804, 179.41419870083473, 816.62316380941468},
|
||||
{60000.000002424618, 179.62808869307457, 816.647836551757},
|
||||
{59999.999997816361, 179.84197863289955, 816.6725196831527},
|
||||
{60000.000001566797, 180.05586830671322, 816.69721343479125},
|
||||
{59999.999999121159, 180.26975739282756, 816.72191756454924},
|
||||
{60000.00000036486, 180.48364565146377, 816.74663219124841},
|
||||
{59999.999999904954, 180.69753279192835, 816.7713572079532},
|
||||
{60000.000000054562, 181.0183614269956, 816.8084603269557},
|
||||
{59999.999999978463, 181.33918632988278, 816.84558675379014},
|
||||
{60000.000000049782, 181.44612751539663, 816.85796481705847},
|
||||
{59999.999999914071, 181.55306821881811, 816.87034546240886},
|
||||
{60000.000000125139, 181.66000840292782, 816.88272868833144},
|
||||
{59999.999999843392, 181.76694804030186, 816.89511449082431},
|
||||
{60000.000000167289, 181.87388708628473, 816.90750286566583},
|
||||
{59999.999999847467, 181.98082551962966, 816.9198938103757},
|
||||
{60000.000000119864, 182.08776329350809, 816.93228732197861},
|
||||
{59999.999999917491, 182.19470038386558, 816.94468339453306},
|
||||
{60000.000000050633, 182.30163675019068, 816.9570820285785},
|
||||
{59999.999999972366, 182.40857236133851, 816.96948321649302},
|
||||
{60000.000000032509, 182.56897459276843, 816.98808882907122},
|
||||
{59999.999999965934, 182.7293749693155, 817.00670017517837},
|
||||
{60000.000000238462, 182.78284155215263, 817.01290459816312},
|
||||
{59999.999999345615, 182.83630791626743, 817.01910964099045},
|
||||
{60000.00000119608, 182.88977407140584, 817.02531535916364},
|
||||
{59999.999998362182, 182.94323998619015, 817.03152164472851},
|
||||
{60000.000001757064, 182.99670569682132, 817.03772865736005},
|
||||
{59999.999998499035, 183.05017115047181, 817.04393620474377},
|
||||
{60000.00000101691, 183.10363639052409, 817.05014447471717},
|
||||
{59999.999999469313, 183.15710137432194, 817.05635331513508},
|
||||
{60000.000000196254, 183.21056612270786, 817.06256282498509},
|
||||
{59999.999999961823, 183.26403061846696, 817.06877295237007},
|
||||
{60000.000000031148, 183.37095910597188, 817.0811944807366},
|
||||
{59999.999999975873, 183.47788656385964, 817.09361853568328},
|
||||
{60000.000000078871, 183.53291535756762, 817.10001332133618},
|
||||
{59999.999999822408, 183.57465447580566, 817.10486251586156},
|
||||
{60000.000000306398, 183.67093862701302, 817.11605868308925},
|
||||
{59999.999999580868, 183.62493711493508, 817.11070057755603},
|
||||
{60000.000000457883, 183.83983154073323, 817.13569840343439},
|
||||
{59999.999999600586, 183.70298550843307, 817.11977179379392},
|
||||
{60000.000000274122, 183.92091406059222, 817.14512405357789},
|
||||
{59999.999999859414, 183.87191278066462, 817.13941945054194},
|
||||
{60000.000000045809, 183.96882854112027, 817.15069318206758},
|
||||
{59999.99999999682, 184.01172713386404, 817.15568252551441},
|
||||
{60000.000000002117, 199.05860625274244, 818.90605990894926},
|
||||
{60000.000000011685, 213.77441984052732, 820.66779572748067},
|
||||
{59999.999999945896, 228.63273752574398, 822.50191665906459},
|
||||
{60000.000000137385, 243.60930053773387, 824.4160390659564},
|
||||
{59999.999999745312, 257.44864608947171, 826.20557537898253},
|
||||
{60000.000000371336, 272.37732017567259, 828.28374145687258},
|
||||
{59999.999999564294, 283.4609507719199, 829.76911975631128},
|
||||
{60000.000000411754, 297.87730027160165, 831.94635758332913},
|
||||
{59999.999999691667, 308.39894455125989, 833.48120705572103},
|
||||
{60000.000000175751, 321.04689540263291, 835.47802201470222},
|
||||
{59999.999999930937, 332.7974681685576, 837.36295119087083},
|
||||
{60000.000000012922, 344.23852019267594, 839.26003269871717},
|
||||
{59999.999999978521, 380.87159046869039, 845.50264944092885},
|
||||
{60000.000000031927, 417.67053058140004, 852.32838657260925},
|
||||
{59999.999999895757, 443.71876268540638, 857.33613824789597},
|
||||
{60000.00000023668, 470.42282907220516, 863.40925211937144},
|
||||
{59999.999999591026, 506.36442771103123, 868.70489233101273},
|
||||
{60000.000000559063, 504.29569767668107, 873.82665736030435},
|
||||
{59999.999999387175, 618.22680165126303, 889.69085497467483},
|
||||
{60000.00000054048, 520.96760954336719, 878.60259543512541},
|
||||
{59999.999999620944, 695.15397128954748, 909.33199431749756},
|
||||
{60000.000000202854, 652.21259368585868, 902.32746593221361},
|
||||
{59999.999999925931, 713.31441817738153, 914.25671409207371},
|
||||
{60000.000000011525, 744.93626878652026, 920.45067498376648},
|
||||
{59999.999999986139, 851.85145355849977, 941.08553924856312},
|
||||
{60000.000000015752, 955.13474569084099, 960.32812261133847},
|
||||
{59999.99999996031, 1019.9477908992111, 972.25457694191095},
|
||||
{60000.000000078573, 1109.7424197388102, 989.27219905591903},
|
||||
{59999.999999866697, 1103.4472241364576, 986.24901738812696},
|
||||
{60000.000000196575, 1283.5502566789903, 1025.857653448167},
|
||||
{59999.999999756859, 1241.170752696316, 1010.5034788173898},
|
||||
{60000.000000241002, 1380.0598100152401, 1044.321387312001},
|
||||
{59999.999999814674, 1417.3346489504095, 1047.4285724180056},
|
||||
{60000.000000106025, 1498.5882349740116, 1064.7148393296281},
|
||||
{59999.999999959189, 1562.4075471540843, 1076.5692870450682},
|
||||
{60000.000000006847, 1632.0446827427525, 1089.9951747091934},
|
||||
{59999.999999992855, 1819.187180960379, 1125.8766969823027},
|
||||
{60000.000000006774, 2005.7867190244558, 1161.6893152514506},
|
||||
{59999.999999993102, 2127.1610378717864, 1184.8982806691761},
|
||||
{59999.999999983789, 2224.9504474907289, 1204.7794295042536},
|
||||
{60000.000000076092, 2423.4034586285211, 1239.2849934128672},
|
||||
{59999.999999843334, 2352.5108743508281, 1233.9178625300717},
|
||||
{60000.00000021555, 2789.1958451831979, 1304.7841887599538},
|
||||
{59999.999999781059, 2516.5832651666447, 1267.6317850640198},
|
||||
{60000.000000168911, 2997.8479508975411, 1347.2273537129538},
|
||||
{59999.999999901927, 2872.9560675152225, 1329.8998228537541},
|
||||
{60000.000000040534, 3100.1634765888271, 1371.640798220885},
|
||||
{59999.999999990199, 3186.6552406648925, 1389.3336814233451},
|
||||
{60000.000000019143, 3570.5318534479206, 1462.8626017289478},
|
||||
{59999.999999969914, 3906.3811637172125, 1522.697974792497},
|
||||
{60000.000000105116, 4081.0496155485694, 1554.1195061318422},
|
||||
{59999.999999764274, 4440.4680391955444, 1682.9362787226369},
|
||||
{60000.000000389882, 4025.4579062184348, 1482.6543564450828},
|
||||
{59999.999999500047, 5340.2058728577267, 2096.5041911809035},
|
||||
{60000.000000509819, 4233.9915572764976, 1518.9299243967394},
|
||||
{59999.999999583706, 5430.8345183928068, 2200.8401562891845},
|
||||
{60000.000000267981, 5054.5402162751188, 1969.4793692255021},
|
||||
{59999.999999871681, 5428.966058504895, 2244.2141001944756},
|
||||
{60000.000000038024, 5546.4649349764723, 2352.3606428637349},
|
||||
{59999.999999998952, 5706.4753141683368, 2517.0835536242184},
|
||||
{59999.999999991771, 6129.2268892602051, 3030.8327236291348},
|
||||
{60000.000000020089, 6420.3065439166912, 3661.6495160497966},
|
||||
{59999.99999990526, 6235.8646808219391, 3444.1541944672813},
|
||||
{60000.000000247288, 8126.8536394010316, 8890.661747328244},
|
||||
{59999.99999954299, 2104.925285609057, -7996.1134321147983},
|
||||
{60000.00000064441, 14264.475617875083, 34652.739991203249},
|
||||
{59999.999999283253, -1684.3290491164355, -33238.811620330394},
|
||||
{60000.000000641696, 13782.902589951687, 46532.286752882486},
|
||||
{59999.999999532913, 2699.6074087223524, -19079.410940396814},
|
||||
{60000.000000275439, 9084.6892111341349, 21937.827319607131},
|
||||
{59999.999999871587, 6474.8937324409353, 5006.3713661893671},
|
||||
{60000.000000044485, 7350.4434791870981, 10709.698171043074},
|
||||
{59999.999999990541, 7306.414330937022, 10560.108503883888},
|
||||
{60000, 7397.0783263606427, 11218.963217145942}};
|
||||
|
||||
const Standard_Integer aNbKnots = 17;
|
||||
const Standard_Real aKnots[17] = {0,
|
||||
0.0087664292723375857,
|
||||
0.015654339342331427,
|
||||
0.019098294377328347,
|
||||
0.020820271894826808,
|
||||
0.021681260653576038,
|
||||
0.022111755032950653,
|
||||
0.022327002222637962,
|
||||
0.022434625817481617,
|
||||
0.022488437614903441,
|
||||
0.022542249412325268,
|
||||
0.037523693790797889,
|
||||
0.071526893170125505,
|
||||
0.1421299556831544,
|
||||
0.26514857375331263,
|
||||
0.51350664396810353,
|
||||
1};
|
||||
|
||||
const Standard_Integer aMults[17] =
|
||||
{15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15};
|
||||
|
||||
// Fill array of poles
|
||||
TColgp_Array1OfPnt aPolesArray(1, aNbPoles);
|
||||
for (Standard_Integer i = 0; i < aNbPoles; i++)
|
||||
{
|
||||
aPolesArray.SetValue(i + 1, gp_Pnt(aPoles[i][0], aPoles[i][1], aPoles[i][2]));
|
||||
}
|
||||
|
||||
// Fill array of knots
|
||||
TColStd_Array1OfReal aKnotsArray(1, aNbKnots);
|
||||
for (Standard_Integer i = 0; i < aNbKnots; i++)
|
||||
{
|
||||
aKnotsArray.SetValue(i + 1, aKnots[i]);
|
||||
}
|
||||
|
||||
// Fill array of mults
|
||||
TColStd_Array1OfInteger aMultsArray(1, aNbKnots);
|
||||
for (Standard_Integer i = 0; i < aNbKnots; i++)
|
||||
{
|
||||
aMultsArray.SetValue(i + 1, aMults[i]);
|
||||
}
|
||||
|
||||
// Create B-Spline curve
|
||||
const Standard_Integer aDegree = 14;
|
||||
Handle(Geom_BSplineCurve) aC1 =
|
||||
new Geom_BSplineCurve(aPolesArray, aKnotsArray, aMultsArray, aDegree);
|
||||
|
||||
// Create trimmed line
|
||||
gp_XYZ aP1(60000, -7504.83, 6000);
|
||||
gp_XYZ aP2(60000, 7504.83, 6000);
|
||||
Handle(Geom_Line) aLine = new Geom_Line(gp_Pnt(aP1), gp_Dir(aP2 - aP1));
|
||||
Handle(Geom_TrimmedCurve) aC2 = new Geom_TrimmedCurve(aLine, 0.0, (aP2 - aP1).Modulus());
|
||||
|
||||
// Try to find extrema
|
||||
// IMPORTANT: it is not allowed to input infinite curves!
|
||||
GeomAPI_ExtremaCurveCurve anEx(aC1, aC2);
|
||||
|
||||
// Check if curves are parallel
|
||||
if (anEx.Extrema().IsParallel())
|
||||
{
|
||||
// Parallel case - should have infinite number of extrema
|
||||
EXPECT_GT(anEx.LowerDistance(), 0.0) << "Parallel curves should have a distance";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check if extrema were found
|
||||
const Standard_Integer aNbEx = anEx.NbExtrema();
|
||||
EXPECT_GT(aNbEx, 0) << "Extrema should be found between BSpline and line";
|
||||
|
||||
if (aNbEx > 0)
|
||||
{
|
||||
// Get minimal distance data
|
||||
gp_Pnt aPoint1, aPoint2;
|
||||
anEx.NearestPoints(aPoint1, aPoint2);
|
||||
|
||||
Standard_Real aU1, aU2;
|
||||
anEx.LowerDistanceParameters(aU1, aU2);
|
||||
|
||||
const Standard_Real aDistance = anEx.LowerDistance();
|
||||
|
||||
// Verify minimal distance is reasonable
|
||||
EXPECT_GE(aDistance, 0.0) << "Minimal distance should be non-negative";
|
||||
|
||||
// Verify parameters are within valid range [0, 1] for the curves
|
||||
EXPECT_GE(aU1, 0.0) << "Parameter U1 should be non-negative";
|
||||
EXPECT_LE(aU1, 1.0) << "Parameter U1 should not exceed 1.0";
|
||||
EXPECT_GE(aU2, 0.0) << "Parameter U2 should be non-negative";
|
||||
|
||||
// Verify nearest points are valid
|
||||
EXPECT_FALSE(aPoint1.IsEqual(gp_Pnt(0, 0, 0), 1e-10)
|
||||
&& aPoint2.IsEqual(gp_Pnt(0, 0, 0), 1e-10))
|
||||
<< "Nearest points should not both be at origin";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// 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 <gtest/gtest.h>
|
||||
|
||||
#include <GeomAPI_Interpolate.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
// Test BUC60902: GeomAPI_Interpolate tangent computation
|
||||
TEST(GeomAPI_Interpolate_Test, BUC60902_TangentPreservation)
|
||||
{
|
||||
// Create 5 points along a sine wave
|
||||
Handle(TColgp_HArray1OfPnt) aPnts = new TColgp_HArray1OfPnt(1, 5);
|
||||
gp_Pnt aP(0., 0., 0.);
|
||||
for (Standard_Integer i = 1; i <= 5; i++)
|
||||
{
|
||||
aP.SetX((i - 1) * 1.57);
|
||||
aP.SetY(sin((i - 1) * 1.57));
|
||||
aPnts->SetValue(i, aP);
|
||||
}
|
||||
|
||||
// First interpolation without tangents
|
||||
GeomAPI_Interpolate anInterpolater(aPnts, Standard_False, Precision::Confusion());
|
||||
anInterpolater.Perform();
|
||||
ASSERT_TRUE(anInterpolater.IsDone()) << "First interpolation should succeed";
|
||||
|
||||
// Get the generated tangents
|
||||
Handle(Geom_BSplineCurve) aCur = anInterpolater.Curve();
|
||||
ASSERT_FALSE(aCur.IsNull()) << "Interpolated curve should not be null";
|
||||
|
||||
gp_Vec aFirstTang, aLastTang;
|
||||
aCur->D1(aCur->FirstParameter(), aP, aFirstTang);
|
||||
aCur->D1(aCur->LastParameter(), aP, aLastTang);
|
||||
|
||||
// Second interpolation with the same tangents explicitly provided
|
||||
GeomAPI_Interpolate anInterpolater1(aPnts, Standard_False, Precision::Confusion());
|
||||
anInterpolater1.Load(aFirstTang, aLastTang, Standard_False);
|
||||
anInterpolater1.Perform();
|
||||
ASSERT_TRUE(anInterpolater1.IsDone()) << "Second interpolation should succeed";
|
||||
|
||||
// Get the tangents after recomputation
|
||||
aCur = anInterpolater1.Curve();
|
||||
ASSERT_FALSE(aCur.IsNull()) << "Second interpolated curve should not be null";
|
||||
|
||||
gp_Vec aFirstTang1, aLastTang1;
|
||||
aCur->D1(aCur->FirstParameter(), aP, aFirstTang1);
|
||||
aCur->D1(aCur->LastParameter(), aP, aLastTang1);
|
||||
|
||||
// Verify that the tangents are preserved
|
||||
EXPECT_TRUE(aFirstTang.IsEqual(aFirstTang1, Precision::Confusion(), Precision::Angular()))
|
||||
<< "First tangent should be preserved after recomputation";
|
||||
|
||||
EXPECT_TRUE(aLastTang.IsEqual(aLastTang1, Precision::Confusion(), Precision::Angular()))
|
||||
<< "Last tangent should be preserved after recomputation";
|
||||
}
|
||||
Reference in New Issue
Block a user