MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / atypicalPathTest

Method atypicalPathTest

test/path_object_t.cpp:1106–1149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1104
1105
1106void PathObjectTest::atypicalPathTest()
1107{
1108 // This is a zero-length closed path of three arcs.
1109 MapCoordVector coords(10, {2.0, 2.0});
1110 coords[0].setCurveStart(true);
1111 coords[3].setCurveStart(true);
1112 coords[6].setCurveStart(true);
1113 coords[9].setClosePoint(true);
1114 coords[9].setHolePoint(true);
1115
1116 PathCoordVector path_coords { coords };
1117 path_coords.update(0);
1118 QCOMPARE(path_coords.size(), std::size_t(7));
1119
1120 for (std::size_t i = 0, end = path_coords.size(); i< end; ++i)
1121 {
1122 switch (i)
1123 {
1124 case 0:
1125 case 2:
1126 case 4:
1127 case 6:
1128 QCOMPARE(std::size_t(path_coords[i].index), (i/2)*3);
1129 QCOMPARE(path_coords[i].param, 0.0f);
1130 QCOMPARE(path_coords[i].clen, 0.0f);
1131 break;
1132 case 1:
1133 case 3:
1134 case 5:
1135 QCOMPARE(path_coords[i].index, path_coords[i-1].index);
1136 QVERIFY(path_coords[i].param > 0.0f);
1137 QVERIFY(path_coords[i].param < 1.0f);
1138 QCOMPARE(path_coords[i].clen, 0.0f);
1139 break;
1140 default:
1141 Q_UNREACHABLE();
1142 }
1143
1144 auto split = SplitPathCoord::at(path_coords, i);
1145 QCOMPARE(std::size_t(split.path_coord_index), i);
1146 auto tangent = split.tangentVector();
1147 QVERIFY(qIsNull(tangent.lengthSquared()));
1148 }
1149}
1150
1151
1152

Callers

nothing calls this directly

Calls 7

setCurveStartMethod · 0.80
setClosePointMethod · 0.80
setHolePointMethod · 0.80
tangentVectorMethod · 0.80
lengthSquaredMethod · 0.80
updateMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected