MCPcopy Create free account
hub / github.com/MITK/MITK / mitkPlanarCrossTest

Function mitkPlanarCrossTest

Modules/PlanarFigure/test/mitkPlanarCrossTest.cpp:345–395  ·  view source on GitHub ↗

* mitkPlanarCrossTest tests the methods and behavior of mitk::PlanarCross with four sub-tests: * * 1. Double-line mode instantiation and basic tests * 2. Single-line mode instantiation and basic tests * 3. Tests of application of spatial constraints for double-line mode * 4. Tests if editing of PlanarCross works as intended * */

Source from the content-addressed store, hash-verified

343 *
344 */
345int mitkPlanarCrossTest(int /* argc */, char * /*argv*/ [])
346{
347 // always start with this!
348 MITK_TEST_BEGIN("PlanarCross")
349
350 // create PlaneGeometry on which to place the PlanarCross
351 mitk::PlaneGeometry::Pointer planeGeometry = mitk::PlaneGeometry::New();
352 planeGeometry->InitializeStandardPlane(100.0, 100.0);
353
354 // **************************************************************************
355 // 1. Double-line mode instantiation and basic tests
356 mitk::PlanarCross::Pointer planarCross = mitk::PlanarCross::New();
357 planarCross->SetPlaneGeometry(planeGeometry);
358
359 // first test: did this work?
360 MITK_TEST_CONDITION_REQUIRED(planarCross.IsNotNull(), "Testing instantiation");
361
362 // test: default cross-mode (not single-line-mode)?
363 MITK_TEST_CONDITION_REQUIRED(!planarCross->GetSingleLineMode(), "Testing default cross mode");
364
365 // Test placement of PlanarCross by control points
366 mitkPlanarCrossTestClass::TestPlanarCrossPlacement(planarCross);
367
368 // **************************************************************************
369 // 2. Single-line mode instantiation and basic tests
370 planarCross = mitk::PlanarCross::New();
371 planarCross->SingleLineModeOn();
372 planarCross->SetPlaneGeometry(planeGeometry);
373
374 // test: single-line mode?
375 MITK_TEST_CONDITION_REQUIRED(planarCross->GetSingleLineMode(), "Testing activation of single-line mode");
376
377 // Test placement of single-line PlanarCross by control points
378 mitkPlanarCrossTestClass::TestPlanarCrossPlacementSingleLine(planarCross);
379
380 // **************************************************************************
381 // 3. Tests of application of spatial constraints for double-line mode
382 planarCross = mitk::PlanarCross::New();
383 planarCross->SetPlaneGeometry(planeGeometry);
384
385 // Test placement with various out-of-bounds control points (automatic application of
386 // constraints expected)
387 mitkPlanarCrossTestClass::TestPlanarCrossPlacementConstrained(planarCross);
388
389 // **************************************************************************
390 // 4. Tests if editing of PlanarCross works as intended
391 mitkPlanarCrossTestClass::TestPlanarCrossEdit(planarCross);
392
393 // always end with this!
394 MITK_TEST_END()
395}

Callers

nothing calls this directly

Calls 5

IsNotNullMethod · 0.80
GetSingleLineModeMethod · 0.80
NewFunction · 0.50
SetPlaneGeometryMethod · 0.45

Tested by

no test coverage detected