Toponaming: Remove all FC_USE_TNP_FIX protected old code

This commit is contained in:
bgbsww
2024-05-20 21:57:39 -04:00
committed by Chris Hennes
parent 60640fa441
commit ecf7e51ab3
52 changed files with 22 additions and 4760 deletions

View File

@@ -42,7 +42,6 @@ TEST_F(FeatureMirroringTest, testXMirror)
// Mirrored it around X from 0,0,0 -> 1,2,3 to 0,0,-3 -> 1,2,0
EXPECT_TRUE(boxesMatch(bb, Base::BoundBox3d(0, 0, -3, 1, 2, 0)));
// Assert correct element Map
#ifdef FC_USE_TNP_FIX
EXPECT_TRUE(allElementsMatch(
_mirror->Shape.getShape(),
{
@@ -56,9 +55,6 @@ TEST_F(FeatureMirroringTest, testXMirror)
"Vertex4;:M;MIR;:H70c:7,V", "Vertex5;:M;MIR;:H70c:7,V", "Vertex6;:M;MIR;:H70c:7,V",
"Vertex7;:M;MIR;:H70c:7,V", "Vertex8;:M;MIR;:H70c:7,V",
}));
#else
EXPECT_EQ(_mirror->Shape.getShape().getElementMapSize(), 0);
#endif
}
TEST_F(FeatureMirroringTest, testYMirrorWithExistingElementMap)
@@ -80,7 +76,6 @@ TEST_F(FeatureMirroringTest, testYMirrorWithExistingElementMap)
// Mirrored it around X from 0,0,0 -> 1,2,3 to 0,0,-3 -> 1,2,0
EXPECT_TRUE(boxesMatch(bb, Base::BoundBox3d(0, 0, -3, 1, 3, 0)));
// Assert correct element Map
#ifdef FC_USE_TNP_FIX
EXPECT_TRUE(elementsMatch(_mirror->Shape.getShape(),
{
"Edge10;:H11c3,E;:M;MIR;:H11ca:7,E",
@@ -142,10 +137,6 @@ TEST_F(FeatureMirroringTest, testYMirrorWithExistingElementMap)
"Vertex8;:H11c3,V;:M;MIR;:H11ca:7,V",
"Vertex8;:H11c4,V;:M;MIR;:H11ca:7,V",
}));
#else
EXPECT_EQ(_mirror->Shape.getShape().getElementMapSize(), 0);
#endif
}
// NOLINTEND(readability-magic-numbers,cppcoreguidelines-avoid-magic-numbers)

View File

@@ -43,13 +43,9 @@ TEST_F(FeatureOffsetTest, testOffset3D)
EXPECT_EQ(getVolume(_offset->Shape.getShape().getShape()), 60);
EXPECT_TRUE(boxesMatch(bb, Base::BoundBox3d(-1, -1, -1, 2, 3, 4)));
// Assert correct element Map
#ifdef FC_USE_TNP_FIX
EXPECT_EQ(_offset->Shape.getShape().countSubElements("Vertex"), 8);
EXPECT_EQ(_offset->Shape.getShape().countSubElements("Edge"), 12);
EXPECT_EQ(_offset->Shape.getShape().countSubElements("Face"), 6);
#else
EXPECT_EQ(_offset->Shape.getShape().getElementMapSize(), 0);
#endif
}
TEST_F(FeatureOffsetTest, testOffset3DWithExistingElementMap)
@@ -72,13 +68,9 @@ TEST_F(FeatureOffsetTest, testOffset3DWithExistingElementMap)
EXPECT_EQ(getVolume(_offset->Shape.getShape().getShape()), 245);
EXPECT_TRUE(boxesMatch(bb, Base::BoundBox3d(-2, -2, -2, 3, 5, 5)));
// Assert correct element Map
#ifdef FC_USE_TNP_FIX
EXPECT_EQ(_offset->Shape.getShape().countSubElements("Vertex"), 8);
EXPECT_EQ(_offset->Shape.getShape().countSubElements("Edge"), 12);
EXPECT_EQ(_offset->Shape.getShape().countSubElements("Face"), 6);
#else
EXPECT_EQ(_offset->Shape.getShape().getElementMapSize(), 0);
#endif
}
TEST_F(FeatureOffsetTest, testOffset2D)

View File

@@ -185,24 +185,8 @@ TEST_F(FeaturePartCommonTest, testHistory)
_common->execute();
hist = _common->History.getValues();
// Assert
#ifndef FC_USE_TNP_FIX
ASSERT_EQ(hist.size(), 2);
EXPECT_EQ(hist[0].shapeMap, compare1);
EXPECT_EQ(hist[1].shapeMap, compare2);
// Act to reverse the histories
_common->Base.setValue(_boxes[1]);
_common->Tool.setValue(_boxes[0]);
_common->execute();
hist = _common->History.getValues();
// Assert
ASSERT_EQ(hist.size(), 2);
EXPECT_EQ(hist[0].shapeMap, compare2);
EXPECT_EQ(hist[1].shapeMap, compare1);
#else
ASSERT_EQ(hist.size(),
0); // TODO: with TNP enabled, this becomes 0, matches the code. Correct?
#endif
}
TEST_F(FeaturePartCommonTest, testMapping)
@@ -215,9 +199,5 @@ TEST_F(FeaturePartCommonTest, testMapping)
_common->execute();
const Part::TopoShape& ts1 = _common->Shape.getShape();
// Assert
#ifndef FC_USE_TNP_FIX
EXPECT_EQ(ts1.getElementMap().size(), 0);
#else
EXPECT_EQ(ts1.getElementMap().size(), 26);
#endif
}

View File

@@ -183,11 +183,7 @@ TEST_F(FeaturePartCutTest, testMapping)
_cut->execute();
const Part::TopoShape& ts1 = _cut->Shape.getShape();
// Assert
#ifndef FC_USE_TNP_FIX
EXPECT_EQ(ts1.getElementMap().size(), 0);
#else
EXPECT_EQ(ts1.getElementMap().size(), 26);
#endif
}
// See FeaturePartCommon.cpp for a history test. It would be exactly the same and redundant here.

View File

@@ -53,11 +53,7 @@ TEST_F(FeaturePartTest, testGetElementName)
EXPECT_STREQ(namePairExport.oldName.c_str(), "test");
EXPECT_STREQ(namePairSelf.newName.c_str(), "");
EXPECT_STREQ(namePairSelf.oldName.c_str(), "");
#ifndef FC_USE_TNP_FIX
EXPECT_EQ(ts.getElementMap().size(), 0);
#else
EXPECT_EQ(ts.getElementMap().size(), 26);
#endif
// TBD
}
@@ -166,14 +162,10 @@ TEST_F(FeaturePartTest, getRelatedElements)
HistoryTraceType::followTypeChange,
true);
// Assert
#ifdef FC_USE_TNP_FIX
EXPECT_EQ(result.size(), 1); // Found the one.
EXPECT_EQ(result2.size(), 0); // No element map, so no related elements
// The results are always going to vary, so we can't test for specific values:
// EXPECT_STREQ(result.front().name.toString().c_str(),"Edge3;:M;CMN;:H38d:7,E");
#else
EXPECT_EQ(result.size(), 0);
#endif
}
// Note that this test is pretty trivial and useless .. but the method in question is never

View File

@@ -49,11 +49,7 @@ TEST_F(PropertyTopoShapeTest, testPropertyPartShapeTopoShape)
EXPECT_TRUE(topoShapeOut.isSame(topoShapeIn));
EXPECT_TRUE(topoDsShapeOut.IsSame(topoDsShapeIn));
EXPECT_EQ(getVolume(topoDsShapeOut), 3);
#ifdef FC_USE_TNP_FIX
EXPECT_EQ(topoShapeOut.getElementMapSize(), 26);
#else
EXPECT_EQ(topoShapeOut.getElementMapSize(), 0);
#endif
}
TEST_F(PropertyTopoShapeTest, testPropertyPartShapeTopoDSShape)

View File

@@ -1432,14 +1432,6 @@ TEST_F(TopoShapeExpansionTest, makeElementBooleanCut)
// Assert elementMap is correct
EXPECT_EQ(elements.size(), 38);
EXPECT_EQ(elements.count(IndexedName("Face", 1)), 1);
#ifndef FC_USE_TNP_FIX
EXPECT_EQ(
elements[IndexedName("Face", 1)],
MappedName(
"Face3;:M;CUT;:H1:7,F;:U;CUT;:H1:7,E;:L(Face5;:M;CUT;:H1:7,F;:U2;CUT;:H1:8,E|Face5;:M;"
"CUT;:H1:7,F;:U2;CUT;:H1:8,E;:U;CUT;:H1:7,V;:L(Face6;:M;CUT;:H1:7,F;:U2;CUT;:H1:8,E;:U;"
"CUT;:H1:7,V);CUT;:H1:3c,E|Face6;:M;CUT;:H1:7,F;:U2;CUT;:H1:8,E);CUT;:H1:cb,F"));
#else
EXPECT_TRUE(allElementsMatch(result,
{
"Edge1",
@@ -1481,7 +1473,6 @@ TEST_F(TopoShapeExpansionTest, makeElementBooleanCut)
"Vertex7",
"Vertex8",
}));
#endif
}
TEST_F(TopoShapeExpansionTest, makeElementBooleanFuse)
@@ -1502,14 +1493,6 @@ TEST_F(TopoShapeExpansionTest, makeElementBooleanFuse)
// Assert element map is correct
EXPECT_EQ(elements.size(), 66);
EXPECT_EQ(elements.count(IndexedName("Face", 1)), 1);
#ifndef FC_USE_TNP_FIX
EXPECT_EQ(
elements[IndexedName("Face", 1)],
MappedName(
"Face3;:M;FUS;:H1:7,F;:U;FUS;:H1:7,E;:L(Face5;:M;FUS;:H1:7,F;:U2;FUS;:H1:8,E|Face5;:M;"
"FUS;:H1:7,F;:U2;FUS;:H1:8,E;:U;FUS;:H1:7,V;:L(Face6;:M;FUS;:H1:7,F;:U2;FUS;:H1:8,E;:U;"
"FUS;:H1:7,V);FUS;:H1:3c,E|Face6;:M;FUS;:H1:7,F;:U2;FUS;:H1:8,E);FUS;:H1:cb,F"));
#else
EXPECT_TRUE(allElementsMatch(result,
{
"Edge1",
@@ -1579,7 +1562,6 @@ TEST_F(TopoShapeExpansionTest, makeElementBooleanFuse)
"Vertex8",
"Vertex8;:H2,V",
}));
#endif
}
TEST_F(TopoShapeExpansionTest, makeElementDraft)
@@ -1852,14 +1834,6 @@ TEST_F(TopoShapeExpansionTest, makeElementGeneralFuse)
// Assert elementMap is correct
EXPECT_EQ(elements.size(), 72);
EXPECT_EQ(elements.count(IndexedName("Face", 1)), 1);
#ifndef FC_USE_TNP_FIX
EXPECT_EQ(
elements[IndexedName("Face", 1)],
MappedName(
"Face3;:M;GFS;:H1:7,F;:U;GFS;:H1:7,E;:L(Face5;:M;GFS;:H1:7,F;:U2;GFS;:H1:8,E|Face5;:M;"
"GFS;:H1:7,F;:U2;GFS;:H1:8,E;:U;GFS;:H1:7,V;:L(Face6;:M;GFS;:H1:7,F;:U2;GFS;:H1:8,E;:U;"
"GFS;:H1:7,V);GFS;:H1:3c,E|Face6;:M;GFS;:H1:7,F;:U2;GFS;:H1:8,E);GFS;:H1:cb,F"));
#else
EXPECT_TRUE(allElementsMatch(result,
{
"Edge1",
@@ -1935,7 +1909,6 @@ TEST_F(TopoShapeExpansionTest, makeElementGeneralFuse)
"Vertex8",
"Vertex8;:H2,V",
}));
#endif
}
TEST_F(TopoShapeExpansionTest, makeElementFuse)
@@ -1955,14 +1928,6 @@ TEST_F(TopoShapeExpansionTest, makeElementFuse)
// Assert elementMap is correct
EXPECT_EQ(elements.size(), 66);
EXPECT_EQ(elements.count(IndexedName("Face", 1)), 1);
#ifndef FC_USE_TNP_FIX
EXPECT_EQ(
elements[IndexedName("Face", 1)],
MappedName(
"Face3;:M;FUS;:H1:7,F;:U;FUS;:H1:7,E;:L(Face5;:M;FUS;:H1:7,F;:U2;FUS;:H1:8,E|Face5;:M;"
"FUS;:H1:7,F;:U2;FUS;:H1:8,E;:U;FUS;:H1:7,V;:L(Face6;:M;FUS;:H1:7,F;:U2;FUS;:H1:8,E;:U;"
"FUS;:H1:7,V);FUS;:H1:3c,E|Face6;:M;FUS;:H1:7,F;:U2;FUS;:H1:8,E);FUS;:H1:cb,F"));
#else
EXPECT_TRUE(allElementsMatch(result,
{
"Edge1",
@@ -2032,7 +1997,6 @@ TEST_F(TopoShapeExpansionTest, makeElementFuse)
"Vertex8",
"Vertex8;:H2,V",
}));
#endif
}
TEST_F(TopoShapeExpansionTest, makeElementCut)
@@ -2053,14 +2017,6 @@ TEST_F(TopoShapeExpansionTest, makeElementCut)
// Assert elementMap is correct
EXPECT_EQ(elements.size(), 38);
EXPECT_EQ(elements.count(IndexedName("Face", 1)), 1);
#ifndef FC_USE_TNP_FIX
EXPECT_EQ(
elements[IndexedName("Face", 1)],
MappedName(
"Face3;:M;CUT;:H1:7,F;:U;CUT;:H1:7,E;:L(Face5;:M;CUT;:H1:7,F;:U2;CUT;:H1:8,E|Face5;:M;"
"CUT;:H1:7,F;:U2;CUT;:H1:8,E;:U;CUT;:H1:7,V;:L(Face6;:M;CUT;:H1:7,F;:U2;CUT;:H1:8,E;:U;"
"CUT;:H1:7,V);CUT;:H1:3c,E|Face6;:M;CUT;:H1:7,F;:U2;CUT;:H1:8,E);CUT;:H1:cb,F"));
#else
EXPECT_TRUE(allElementsMatch(result,
{
"Edge1",
@@ -2102,7 +2058,6 @@ TEST_F(TopoShapeExpansionTest, makeElementCut)
"Vertex7",
"Vertex8",
}));
#endif
}
TEST_F(TopoShapeExpansionTest, makeElementChamfer)
@@ -2498,14 +2453,6 @@ TEST_F(TopoShapeExpansionTest, makeElementTransformWithMap)
// Assert elementMap is correct
EXPECT_EQ(elements.size(), 66);
EXPECT_EQ(elements.count(IndexedName("Face", 1)), 1);
#ifndef FC_USE_TNP_FIX
EXPECT_EQ(
elements[IndexedName("Face", 1)],
MappedName(
"Face3;:M;FUS;:H1:7,F;:U;FUS;:H1:7,E;:L(Face5;:M;FUS;:H1:7,F;:U2;FUS;:H1:8,E|Face5;:M;"
"FUS;:H1:7,F;:U2;FUS;:H1:8,E;:U;FUS;:H1:7,V;:L(Face6;:M;FUS;:H1:7,F;:U2;FUS;:H1:8,E;:U;"
"FUS;:H1:7,V);FUS;:H1:3c,E|Face6;:M;FUS;:H1:7,F;:U2;FUS;:H1:8,E);FUS;:H1:cb,F"));
#else
EXPECT_TRUE(allElementsMatch(result,
{
"Edge1",
@@ -2575,7 +2522,6 @@ TEST_F(TopoShapeExpansionTest, makeElementTransformWithMap)
"Vertex8",
"Vertex8;:H2,V",
}));
#endif
}
TEST_F(TopoShapeExpansionTest, makeElementGTransformWithoutMap)
@@ -2616,14 +2562,6 @@ TEST_F(TopoShapeExpansionTest, makeElementGTransformWithMap)
// Assert elementMap is correct
EXPECT_EQ(elements.size(), 66);
EXPECT_EQ(elements.count(IndexedName("Face", 1)), 1);
#ifndef FC_USE_TNP_FIX
EXPECT_EQ(
elements[IndexedName("Face", 1)],
MappedName(
"Face3;:M;FUS;:H1:7,F;:U;FUS;:H1:7,E;:L(Face5;:M;FUS;:H1:7,F;:U2;FUS;:H1:8,E|Face5;:M;"
"FUS;:H1:7,F;:U2;FUS;:H1:8,E;:U;FUS;:H1:7,V;:L(Face6;:M;FUS;:H1:7,F;:U2;FUS;:H1:8,E;:U;"
"FUS;:H1:7,V);FUS;:H1:3c,E|Face6;:M;FUS;:H1:7,F;:U2;FUS;:H1:8,E);FUS;:H1:cb,F"));
#else
EXPECT_TRUE(allElementsMatch(result,
{
"Edge1",
@@ -2693,7 +2631,6 @@ TEST_F(TopoShapeExpansionTest, makeElementGTransformWithMap)
"Vertex8",
"Vertex8;:H2,V",
}));
#endif
}
// Not testing _makeElementTransform as it is a thin wrapper that calls the same places as the four
@@ -3066,55 +3003,6 @@ TEST_F(TopoShapeExpansionTest, traceElement)
// Act
result.traceElement(mappedName, cb);
// Assert we have the element map we think we do.
#ifndef FC_USE_TNP_FIX
EXPECT_TRUE(allElementsMatch(
result,
{
"Edge10;:G(Edge2;K-1;:H2:4,E);CUT;:H1:1a,V",
"Edge10;:M;CUT;:H1:7,E",
"Edge10;:M;CUT;:H1:7,E;:U;CUT;:H1:7,V",
"Edge11;:M;CUT;:H2:7,E",
"Edge12;:M;CUT;:H2:7,E",
"Edge2;:M;CUT;:H2:7,E",
"Edge2;:M;CUT;:H2:7,E;:U;CUT;:H2:7,V",
"Edge4;:M;CUT;:H2:7,E",
"Edge4;:M;CUT;:H2:7,E;:U;CUT;:H2:7,V",
"Edge6;:G(Edge12;K-1;:H2:4,E);CUT;:H1:1b,V",
"Edge6;:M;CUT;:H1:7,E",
"Edge6;:M;CUT;:H1:7,E;:U;CUT;:H1:7,V",
"Edge8;:G(Edge11;K-1;:H2:4,E);CUT;:H1:1b,V",
"Edge8;:M;CUT;:H1:7,E",
"Edge8;:M;CUT;:H1:7,E;:U;CUT;:H1:7,V",
"Edge9;:G(Edge4;K-1;:H2:4,E);CUT;:H1:1a,V",
"Edge9;:M;CUT;:H1:7,E",
"Edge9;:M;CUT;:H1:7,E;:U;CUT;:H1:7,V",
"Face1;:M;CUT;:H2:7,F",
"Face1;:M;CUT;:H2:7,F;:U;CUT;:H2:7,E",
"Face2;:G(Face4;K-1;:H2:4,F);CUT;:H1:1a,E",
"Face2;:M;CUT;:H1:7,F",
"Face2;:M;CUT;:H1:7,F;:U;CUT;:H1:7,E",
"Face2;:M;CUT;:H1:7,F;:U;CUT;:H1:7,E;:L(Face5;:M;CUT;:H1:7,F;:U2;CUT;:H1:8,E;:U;CUT;:"
"H1:7,V;:L(Face6;:M;CUT;:H1:7,F;:U2;CUT;:H1:8,E;:U;CUT;:H1:7,V);CUT;:H1:3c,E|Face5;:M;"
"CUT;:H1:7,F;:U;CUT;:H1:7,E|Face6;:M;CUT;:H1:7,F;:U;CUT;:H1:7,E);CUT;:H1:c9,F",
"Face3;:G(Face1;K-1;:H2:4,F);CUT;:H1:1a,E",
"Face3;:M;CUT;:H1:7,F",
"Face3;:M;CUT;:H1:7,F;:U;CUT;:H1:7,E",
"Face3;:M;CUT;:H1:7,F;:U;CUT;:H1:7,E;:L(Face5;:M;CUT;:H1:7,F;:U2;CUT;:H1:8,E|Face5;:M;"
"CUT;:H1:7,F;:U2;CUT;:H1:8,E;:U;CUT;:H1:7,V;:L(Face6;:M;CUT;:H1:7,F;:U2;CUT;:H1:8,E;:U;"
"CUT;:H1:7,V);CUT;:H1:3c,E|Face6;:M;CUT;:H1:7,F;:U2;CUT;:H1:8,E);CUT;:H1:cb,F",
"Face4;:M;CUT;:H2:7,F",
"Face5;:M;CUT;:H1:7,F",
"Face5;:M;CUT;:H1:7,F;:U2;CUT;:H1:8,E",
"Face5;:M;CUT;:H1:7,F;:U2;CUT;:H1:8,E;:U;CUT;:H1:7,V",
"Face5;:M;CUT;:H1:7,F;:U2;CUT;:H1:8,E;:U;CUT;:H1:7,V;:L(Face6;:M;CUT;:H1:7,F;:U2;CUT;:"
"H1:8,E;:U;CUT;:H1:7,V);CUT;:H1:3c,E",
"Face5;:M;CUT;:H1:7,F;:U;CUT;:H1:7,E",
"Face6;:M;CUT;:H1:7,F",
"Face6;:M;CUT;:H1:7,F;:U2;CUT;:H1:8,E",
"Face6;:M;CUT;:H1:7,F;:U2;CUT;:H1:8,E;:U;CUT;:H1:7,V",
"Face6;:M;CUT;:H1:7,F;:U;CUT;:H1:7,E",
}));
#else
EXPECT_TRUE(allElementsMatch(result,
{
"Edge1",
@@ -3156,7 +3044,6 @@ TEST_F(TopoShapeExpansionTest, traceElement)
"Vertex7",
"Vertex8",
}));
#endif
}
TEST_F(TopoShapeExpansionTest, makeElementOffset)

View File

@@ -286,19 +286,10 @@ TEST_F(SketchObjectTest, testGetElementName)
EXPECT_STREQ(map[2].name.toString().c_str(), (tagName + "v2;SKT").c_str());
EXPECT_EQ(map[2].index.toString(), "Vertex2");
// Assert
#ifndef FC_USE_TNP_FIX
EXPECT_STREQ(forward_normal_name.newName.c_str(), "");
EXPECT_STREQ(forward_normal_name.oldName.c_str(), "g1;SKT");
EXPECT_STREQ(reverse_normal_name.newName.c_str(), "");
EXPECT_STREQ(reverse_normal_name.oldName.c_str(), "Vertex2");
EXPECT_STREQ(reverse_export_name.newName.c_str(), ";g1v1;SKT.Vertex1");
EXPECT_STREQ(reverse_export_name.oldName.c_str(), "Vertex1");
#else
EXPECT_STREQ(forward_normal_name.newName.c_str(), (";" + tagName + ";SKT.Edge1").c_str());
EXPECT_STREQ(forward_normal_name.oldName.c_str(), "Edge1");
EXPECT_STREQ(reverse_normal_name.newName.c_str(), (";" + tagName + "v2;SKT.Vertex2").c_str());
EXPECT_STREQ(reverse_normal_name.oldName.c_str(), "Vertex2");
EXPECT_STREQ(reverse_export_name.newName.c_str(), (";" + tagName + "v1;SKT.Vertex1").c_str());
EXPECT_STREQ(reverse_export_name.oldName.c_str(), "Vertex1");
#endif
}