Classes | Functions

mitkPlanarCrossTest.cpp File Reference

#include "mitkTestingMacros.h"
#include "mitkPlanarCross.h"
#include "mitkPlaneGeometry.h"

Go to the source code of this file.

Classes

class  mitkPlanarCrossTestClass

Functions

int mitkPlanarCrossTest (int, char *[])

Function Documentation

int mitkPlanarCrossTest ( int  ,
char *  [] 
)

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

Definition at line 352 of file mitkPlanarCrossTest.cpp.

References MITK_TEST_BEGIN, MITK_TEST_CONDITION_REQUIRED, MITK_TEST_END, mitk::PlanarCross::New(), mitk::PlaneGeometry::New(), mitkPlanarCrossTestClass::TestPlanarCrossEdit(), mitkPlanarCrossTestClass::TestPlanarCrossPlacement(), mitkPlanarCrossTestClass::TestPlanarCrossPlacementConstrained(), and mitkPlanarCrossTestClass::TestPlanarCrossPlacementSingleLine().

{
  // always start with this!
  MITK_TEST_BEGIN("PlanarCross")

  // create PlaneGeometry on which to place the PlanarCross
  mitk::PlaneGeometry::Pointer planeGeometry = mitk::PlaneGeometry::New();
  planeGeometry->InitializeStandardPlane( 100.0, 100.0 );

  // **************************************************************************
  // 1. Double-line mode instantiation and basic tests
  mitk::PlanarCross::Pointer planarCross = mitk::PlanarCross::New();
  planarCross->SetGeometry2D( planeGeometry );

  // first test: did this work?
  MITK_TEST_CONDITION_REQUIRED( planarCross.IsNotNull(), "Testing instantiation" );

  // test: default cross-mode (not single-line-mode)?
  MITK_TEST_CONDITION_REQUIRED( !planarCross->GetSingleLineMode(), "Testing default cross mode" );


  // Test placement of PlanarCross by control points
  mitkPlanarCrossTestClass::TestPlanarCrossPlacement( planarCross );


  // **************************************************************************
  // 2. Single-line mode instantiation and basic tests
  planarCross = mitk::PlanarCross::New();
  planarCross->SingleLineModeOn();
  planarCross->SetGeometry2D( planeGeometry );

  // test: single-line mode?
  MITK_TEST_CONDITION_REQUIRED( planarCross->GetSingleLineMode(), "Testing activation of single-line mode" );

  // Test placement of single-line PlanarCross by control points
  mitkPlanarCrossTestClass::TestPlanarCrossPlacementSingleLine( planarCross );


  // **************************************************************************
  // 3. Tests of application of spatial constraints for double-line mode
  planarCross = mitk::PlanarCross::New();
  planarCross->SetGeometry2D( planeGeometry );

  // Test placement with various out-of-bounds control points (automatic application of
  // constraints expected)
  mitkPlanarCrossTestClass::TestPlanarCrossPlacementConstrained( planarCross );


  // **************************************************************************
  // 4. Tests if editing of PlanarCross works as intended
  mitkPlanarCrossTestClass::TestPlanarCrossEdit( planarCross );



  // always end with this!
  MITK_TEST_END()
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines