Classes | Functions

mitkClaronToolTest.cpp File Reference

#include "mitkClaronTool.h"
#include "mitkTestingMacros.h"

Go to the source code of this file.

Classes

class  ClaronToolTestClass

Functions

int mitkClaronToolTest (int, char *[])

Function Documentation

int mitkClaronToolTest ( int  ,
char *  [] 
)

This function tests the ClaronTool class.

Definition at line 44 of file mitkClaronToolTest.cpp.

References MITK_TEST_BEGIN, MITK_TEST_CONDITION, MITK_TEST_CONDITION_REQUIRED, MITK_TEST_END, and ClaronToolTestClass::New().

{
  // always start with this!
  MITK_TEST_BEGIN("ClaronTool")
  {
    // let's create an object of our class  
    mitk::ClaronTool::Pointer myClaronTool = ClaronToolTestClass::New().GetPointer();

    // first test: did this work?
    // using MITK_TEST_CONDITION_REQUIRED makes the test stop after failure, since
    // it makes no sense to continue without an object.
    MITK_TEST_CONDITION_REQUIRED(myClaronTool.IsNotNull(),"Testing instantiation:") 
  
      mitk::Point3D pos;
    pos[0] = 10;
    pos[1] = 20;
    pos[2] = 30;
    myClaronTool->SetPosition(pos);
    mitk::Point3D testPos;
    myClaronTool->GetPosition(testPos);
    MITK_TEST_CONDITION((testPos==pos),"Testing position update:")

      mitk::Quaternion orientation(10,20,30,40);
      myClaronTool->SetOrientation(orientation);
    mitk::Quaternion testOri;
    myClaronTool->GetOrientation(testOri);
    MITK_TEST_CONDITION((testOri==orientation),"Testing orientation update:")

    std::string name = "//testfilename";
    std::string name1 = "/testfilename";
    std::string name2 = "testfilename";
    MITK_TEST_CONDITION(myClaronTool->LoadFile(name) == true ,"Test LoadFile() with valid windows file name")
    MITK_TEST_CONDITION(myClaronTool->LoadFile(name1) == true ,"Test LoadFile() with valid Linux file name")
    MITK_TEST_CONDITION(myClaronTool->LoadFile(name2) == false, "Test LoadFile() with invalid file name")
    MITK_TEST_CONDITION(myClaronTool->GetCalibrationName() == name2 ,"Test GetCalibrationName() after setting with LoadFile()")
    myClaronTool->SetCalibrationName(name);
    MITK_TEST_CONDITION(myClaronTool->GetCalibrationName() == name ,"Test GetCalibrationName() after setting with SetCalibrationName()")

    myClaronTool->LoadFile(name);
    MITK_TEST_CONDITION(myClaronTool->GetFile() == name ,"Testing GetFile() after setting file name with LoadFile()")

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