Classes | Functions

mitkToolManagerTest.cpp File Reference

#include "mitkTestingMacros.h"
#include "mitkToolManager.h"
#include "mitkStandaloneDataStorage.h"
#include "mitkCoreObjectFactory.h"
#include "mitkAddContourTool.h"
#include "mitkGlobalInteraction.h"

Go to the source code of this file.

Classes

class  mitkToolManagerTestClass

Functions

int mitkToolManagerTest (int, char *[])

Function Documentation

int mitkToolManagerTest ( int  ,
char *  [] 
)

Definition at line 62 of file mitkToolManagerTest.cpp.

References mitk::GlobalInteraction::GetInstance(), MITK_TEST_BEGIN, MITK_TEST_CONDITION_REQUIRED, MITK_TEST_END, mitk::ToolManager::New(), mitk::StandaloneDataStorage::New(), mitkToolManagerTestClass::TestSetterMethods(), and mitkToolManagerTestClass::TestToolManagerWithTools().

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

  // Global interaction must(!) be initialized if used
  mitk::GlobalInteraction::GetInstance()->Initialize("global");

  // instantiation
  mitk::StandaloneDataStorage::Pointer dataStorage = mitk::StandaloneDataStorage::New();
  mitk::ToolManager::Pointer toolManager = mitk::ToolManager::New(dataStorage.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(toolManager.IsNotNull(),"Testing instantiation") 

  // write your own tests here and use the macros from mitkTestingMacros.h !!!
  // do not write to std::cout and do not return from this function yourself!
  //mitkToolManagerTestClass::TestToolManagerWithOutTools(toolManager);

  //now we add one tool
  toolManager = mitk::ToolManager::New(dataStorage.GetPointer());
 
  //start test with tool
  mitkToolManagerTestClass::TestToolManagerWithTools(toolManager);
  
  //now the setter methods
  mitkToolManagerTestClass::TestSetterMethods(toolManager);

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