21 class mitkPlanarCrossTestClass
27 MITK_TEST_CONDITION(planarCross->GetMinimumNumberOfControlPoints() == 4,
"Minimum number of control points");
30 MITK_TEST_CONDITION(planarCross->GetMaximumNumberOfControlPoints() == 4,
"Maximum number of control points");
36 planarCross->PlaceFigure(p0);
42 planarCross->SetCurrentControlPoint(p1);
48 planarCross->AddControlPoint(p2);
53 "Number of helper polylines after placing 3 points");
56 MITK_TEST_CONDITION(planarCross->IsHelperToBePainted(0),
"Helper line to be painted after placing 3 points");
77 planarCross->AddControlPoint(p3);
80 MITK_TEST_CONDITION(planarCross->GetNumberOfControlPoints() == 4,
"Number of control points after placement");
87 "Helper line no longer to be painted after placement of all 4 points");
92 MITK_TEST_CONDITION(planarCross->GetPolyLinesSize() == 2,
"Number of polylines after placement");
94 auto iter0 = polyLine0.begin();
95 auto iter1 = polyLine1.begin();
101 MITK_TEST_CONDITION(((pp0 == p0) && (pp1 == p1)) || ((pp0 == p1) && (pp1 == p0)),
"Correct polyline 1");
106 MITK_TEST_CONDITION(((pp2 == p2) && (pp3 == p3)) || ((pp2 == p3) && (pp3 == p2)),
"Correct polyline 2");
109 planarCross->EvaluateFeatures();
110 MITK_TEST_CONDITION(planarCross->GetNumberOfFeatures() == 2,
"Number of measurement features");
113 double length0 = sqrt(80.0 * 80.0 * 2.0);
116 double length1 = sqrt(60.0 * 60.0 * 2.0);
123 MITK_TEST_CONDITION(planarCross->GetMinimumNumberOfControlPoints() == 2,
"Minimum number of control points");
126 MITK_TEST_CONDITION(planarCross->GetMaximumNumberOfControlPoints() == 2,
"Maximum number of control points");
132 planarCross->PlaceFigure(p0);
138 planarCross->SetCurrentControlPoint(p1);
142 "No helper line to be painted in single-line mode");
145 MITK_TEST_CONDITION(planarCross->GetNumberOfControlPoints() == 2,
"Number of control points after placement");
152 auto iter = polyLine0.begin();
153 MITK_TEST_CONDITION(planarCross->GetPolyLinesSize() == 1,
"Number of polylines after placement");
159 MITK_TEST_CONDITION(((pp0 == p0) && (pp1 == p1)) || ((pp0 == p1) && (pp1 == p0)),
"Correct polyline 1");
162 planarCross->EvaluateFeatures();
163 MITK_TEST_CONDITION(planarCross->GetNumberOfFeatures() == 1,
"Number of measurement features");
166 double length0 = sqrt(5.0 * 5.0 + 50.0 * 50.0);
171 "Single-line PlanarCross should not be reset on point edit");
181 planarCross->PlaceFigure(p0);
186 "Point1 placed and constrained correctly");
193 planarCross->SetCurrentControlPoint(p1);
198 "Point2 placed and constrained correctly");
205 planarCross->AddControlPoint(p2);
210 "Point3 placed and constrained correctly");
215 planarCross->SetControlPoint(2, p2);
218 cp2 = planarCross->GetControlPoint(2);
220 "Point3 moved correctly");
227 planarCross->AddControlPoint(p3);
232 "Point4 placed and constrained correctly");
238 planarCross->SetControlPoint(3, p3);
241 cp3 = planarCross->GetControlPoint(3);
243 "Point4 placed and constrained correctly");
258 planarCross->SelectControlPoint(0);
262 "Editing control point 0: Double-line PlanarCross should be reset");
265 MITK_TEST_CONDITION(planarCross->GetNumberOfControlPoints() == 2,
"Two control points are left");
269 (planarCross->GetControlPoint(1).EuclideanDistanceTo(p0) <
mitk::eps),
270 "Reset to expected control points (p1, p0)");
273 ResetPlanarCross(planarCross, p0, p1, p2, p3);
277 planarCross->SelectControlPoint(1);
281 "Editing control point 1: Double-line PlanarCross should be reset");
284 MITK_TEST_CONDITION(planarCross->GetNumberOfControlPoints() == 2,
"Two control points are left");
288 (planarCross->GetControlPoint(1).EuclideanDistanceTo(p1) <
mitk::eps),
289 "Reset to expected control points (p0, p1)");
292 ResetPlanarCross(planarCross, p0, p1, p2, p3);
296 planarCross->SelectControlPoint(2);
300 "Editing control point 2: Double-line PlanarCross should be reset");
303 MITK_TEST_CONDITION(planarCross->GetNumberOfControlPoints() == 2,
"Two control points are left");
307 (planarCross->GetControlPoint(1).EuclideanDistanceTo(p2) <
mitk::eps),
308 "Reset to expected control points (p3, p2)");
311 ResetPlanarCross(planarCross, p0, p1, p2, p3);
315 planarCross->SelectControlPoint(3);
319 "Editing control point 3: Double-line PlanarCross should be reset");
322 MITK_TEST_CONDITION(planarCross->GetNumberOfControlPoints() == 2,
"Two control points are left");
326 (planarCross->GetControlPoint(1).EuclideanDistanceTo(p3) <
mitk::eps),
327 "Reset to expected control points (p2, p3)");
330 static void ResetPlanarCross(
333 planarCross->SetControlPoint(0, p0,
true);
334 planarCross->SetControlPoint(1, p1,
true);
335 planarCross->SetControlPoint(2, p2,
true);
336 planarCross->SetControlPoint(3, p3,
true);
356 planeGeometry->InitializeStandardPlane(100.0, 100.0);
361 planarCross->SetPlaneGeometry(planeGeometry);
370 mitkPlanarCrossTestClass::TestPlanarCrossPlacement(planarCross);
375 planarCross->SingleLineModeOn();
376 planarCross->SetPlaneGeometry(planeGeometry);
382 mitkPlanarCrossTestClass::TestPlanarCrossPlacementSingleLine(planarCross);
387 planarCross->SetPlaneGeometry(planeGeometry);
391 mitkPlanarCrossTestClass::TestPlanarCrossPlacementConstrained(planarCross);
395 mitkPlanarCrossTestClass::TestPlanarCrossEdit(planarCross);
#define MITK_TEST_CONDITION_REQUIRED(COND, MSG)
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
#define MITK_TEST_CONDITION(COND, MSG)
int mitkPlanarCrossTest(int, char *[])
MITKCORE_EXPORT const ScalarType eps