22 class mitkPlanarSubdivisionPolygonTestClass
29 "Minimum number of control points");
33 "Maximum number of control points");
36 MITK_TEST_CONDITION(planarSubdivisionPolygon->GetSubdivisionRounds() == 5,
"Subdivision point generation depth");
39 MITK_TEST_CONDITION(planarSubdivisionPolygon->GetTensionParameter() == 0.0625,
"Tension parameter");
47 planarSubdivisionPolygon->PlaceFigure(p0);
53 planarSubdivisionPolygon->SetControlPoint(1, p1);
59 planarSubdivisionPolygon->AddControlPoint(p2);
65 planarSubdivisionPolygon->AddControlPoint(p3);
69 "Number of control points after placement");
72 MITK_TEST_CONDITION(planarSubdivisionPolygon->IsClosed(),
"Test if property 'closed' is set by default");
76 auto iter = polyLine0.begin();
77 MITK_TEST_CONDITION(planarSubdivisionPolygon->GetPolyLinesSize() == 1,
"Number of polylines after placement");
80 MITK_TEST_CONDITION(polyLine0.size() == 128,
"correct number of subdivision points for this depth level");
83 bool correctPoint =
true;
84 iter = polyLine0.begin();
86 if (static_cast<mitk::Point2D>(*iter) != p0)
91 if (static_cast<mitk::Point2D>(*iter) != p1)
96 if (static_cast<mitk::Point2D>(*iter) != p2)
101 if (static_cast<mitk::Point2D>(*iter) != p3)
103 correctPoint =
false;
105 MITK_TEST_CONDITION(correctPoint,
"Test if control points are in correct order in polyline");
111 testPoint[0] = 81.25;
112 testPoint[1] = 48.243;
113 iter = polyLine0.begin();
118 if ((static_cast<mitk::Point2D>(*iter)[0] - testPoint[0]) + (static_cast<mitk::Point2D>(*iter)[1] - testPoint[1]) >
121 correctPoint =
false;
124 testPoint[0] = 39.624;
125 testPoint[1] = 19.3268;
126 iter = polyLine0.begin();
128 if ((static_cast<mitk::Point2D>(*iter)[0] - testPoint[0]) + (static_cast<mitk::Point2D>(*iter)[1] - testPoint[1]) >
131 correctPoint =
false;
134 testPoint[0] = 71.2887;
135 testPoint[1] = 77.5248;
136 iter = polyLine0.begin();
138 if ((static_cast<mitk::Point2D>(*iter)[0] - testPoint[0]) + (static_cast<mitk::Point2D>(*iter)[1] - testPoint[1]) >
141 correctPoint =
false;
166 unsigned int initialNumberOfControlPoints = planarSubdivisionPolygon->GetNumberOfControlPoints();
171 planarSubdivisionPolygon->AddControlPoint(pnt);
173 MITK_TEST_CONDITION(planarSubdivisionPolygon->GetNumberOfControlPoints() == initialNumberOfControlPoints + 1,
174 "A new control-point shall be added");
176 planarSubdivisionPolygon->GetControlPoint(planarSubdivisionPolygon->GetNumberOfControlPoints() - 1) == pnt,
177 "Control-point shall be added at the end.");
179 planarSubdivisionPolygon->RemoveControlPoint(3);
180 MITK_TEST_CONDITION(planarSubdivisionPolygon->GetNumberOfControlPoints() == initialNumberOfControlPoints,
181 "A control-point has been removed");
183 "It shall be possible to remove any control-point.");
185 planarSubdivisionPolygon->RemoveControlPoint(0);
186 planarSubdivisionPolygon->RemoveControlPoint(0);
187 planarSubdivisionPolygon->RemoveControlPoint(0);
189 "Control-points cannot be removed if only three points remain.");
194 planarSubdivisionPolygon->AddControlPoint(pnt1, 0);
195 MITK_TEST_CONDITION(planarSubdivisionPolygon->GetNumberOfControlPoints() == 4,
"A control-point has been added");
197 "It shall be possible to insert a control-point at any position.");
213 planeGeometry->InitializeStandardPlane(100.0, 100.0);
218 planarSubdivisionPolygon->SetPlaneGeometry(planeGeometry);
224 mitkPlanarSubdivisionPolygonTestClass::TestPlanarSubdivisionPolygonPlacement(planarSubdivisionPolygon);
226 mitkPlanarSubdivisionPolygonTestClass::TestPlanarSubdivisionPolygonEditing(planarSubdivisionPolygon);
#define MITK_TEST_CONDITION_REQUIRED(COND, MSG)
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
#define MITK_TEST_CONDITION(COND, MSG)
int mitkPlanarSubdivisionPolygonTest(int, char *[])
static const mitk::ScalarType testEps