16#include "mitkTestingMacros.h"
32 MITK_TEST_BEGIN(
"IGTTimeStamp")
35 itk::Object::Pointer tester = itk::Object::New();
36 itk::Object::Pointer tester2 = itk::Object::New();
39 MITK_TEST_OUTPUT(<<
"Testing behavior of methodes if they are called at the wrong moment (error should occure).");
47 MITK_TEST_CONDITION_REQUIRED(timestampX==-1,
"..Testing method GetCurrentTimeStamp().");
49 MITK_TEST_CONDITION_REQUIRED(offsetX==-1.0,
"..Testing method GetOffset().");
53 MITK_INFO <<
"first device has started tracking\n";
56 #if defined (WIN32) || defined (_WIN32)
62 MITK_INFO <<
"supposed to have waited 20ms \n";
64 double time_elapsed, relative_time_elapsed;
69 MITK_INFO <<
"have actually waited : " << time_elapsed <<
"ms \n";
72 MITK_TEST_CONDITION_REQUIRED((time_elapsed-20) > -10 ,
"Testing if elapsed time is correct (-10)");
77 MITK_INFO <<
"second device has started\n";
80 MITK_INFO <<
"first device has stopped tracking\n";
85 MITK_INFO <<
"time elapsed supposed to be greater than 20 ms\n";
86 MITK_INFO << time_elapsed <<
" actually elapsed\n";
88 MITK_INFO <<
"relative time elapsed supposed to be smaller than absolute time elapsed : \n";
89 MITK_INFO << relative_time_elapsed <<
" actually elapsed\n";
92 MITK_TEST_CONDITION_REQUIRED( time_elapsed > relative_time_elapsed ,
" testing if relative timespan is shorter than absolute timespan");
98 MITK_INFO <<
" second device has stopped tracking\n";
102 MITK_TEST_CONDITION_REQUIRED( time_elapsed == -1 ,
"testing if -1 is returned after all devices have stopped");
static IGTTimeStamp * CreateInstance()
creates a new instance of mitkTimeStamp
static IGTTimeStamp * GetInstance()
returns a pointer to the current instance of mitkTimeStamp
void Start(itk::Object::Pointer device)
starts the time-acquisition
void Stop(itk::Object::Pointer device)
stops the time-acqusition
double GetElapsed()
returns the time elapsed since calling Start() for the first time in milliseconds
void SetRealTimeClock(mitk::RealTimeClock::Pointer Clock)
setter for the internally used RealTimeClock()
double GetOffset(itk::Object::Pointer Device)
returns the offset of this device's starting-time to the reference-time in ms
static Pointer New(void)
instanciates a new, operating-system dependant, instance of mitk::RealTimeClock.
int mitkTimeStampTest(int, char *[])