22 #include "itksys/SystemTools.hxx"
39 mySource->SetTrackingDevice(NULL);
40 MITK_TEST_CONDITION(mySource->GetTrackingDevice() == NULL,
"Testing Set/GetTrackingDevice(NULL)");
41 MITK_TEST_CONDITION(mySource->GetNumberOfOutputs() == 0,
"Testing GetNumberOfOutputs with NULL td");
46 tracker->SetRefreshRate(10);
49 mySource->SetTrackingDevice(tracker);
50 MITK_TEST_CONDITION(mySource->GetTrackingDevice() == tracker.GetPointer(),
"Testing Set/GetTrackingDevice(tracker)");
51 MITK_TEST_CONDITION(mySource->GetNumberOfOutputs() == 0,
"Testing GetNumberOfOutputs with no tool tracker");
55 tracker->AddTool(
"T0");
56 tracker->AddTool(
"T1");
57 mySource->SetTrackingDevice(tracker);
58 MITK_TEST_CONDITION(mySource->GetTrackingDevice() == tracker.GetPointer(),
"Testing Set/GetTrackingDevice(tracker2)");
59 MITK_TEST_CONDITION(mySource->GetNumberOfOutputs() == 2,
"Testing GetNumberOfOutputs with 2 tools tracker");
64 mySource->Disconnect();
65 MITK_TEST_CONDITION(mySource->IsConnected() ==
false,
"Testing Disconnect()/IsConnected()");
69 mySource->StartTracking();
70 MITK_TEST_CONDITION(mySource->IsConnected() ==
true,
"Testing StartTracking()/IsConnected()");
71 MITK_TEST_CONDITION(mySource->IsTracking() ==
true,
"Testing StartTracking()/IsTracking()");
74 unsigned long modTime = mySource->GetMTime();
75 mySource->UpdateOutputInformation();
76 MITK_TEST_CONDITION(mySource->GetMTime() != modTime,
"Testing if UpdateOutputInformation() modifies the object");
81 nd0 = mySource->GetOutput(nd0->GetName());
85 MITK_TEST_CONDITION(mySource->GetOutputIndex(nd0->GetName())==0,
"Testing GetOutputIndex()");
89 mySource->GraftNthOutput(1,nd0);
90 ndCopy = mySource->GetOutput(1);
91 MITK_TEST_CONDITION(std::string(ndCopy->GetName())==std::string(nd0->GetName()),
"Testing GraftNthOutput()");
99 unsigned long tmpMTime0 = nd0->GetMTime();
100 itksys::SystemTools::Delay(500);
103 if(nd0->GetMTime() == tmpMTime0)
112 mySource->StopTracking();
113 mySource->Disconnect();
116 mySource->SetTrackingDevice(tracker);
117 MITK_TEST_CONDITION(watch->GetReferenceCount() == 0,
"Testing if reference to previous tracker object is released");
123 mySource->StartTracking();
int mitkTrackingDeviceSourceTest(int, char *[])
itk::SmartPointer< Self > Pointer
#define MITK_TEST_CONDITION_REQUIRED(COND, MSG)
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
#define MITK_TEST_FOR_EXCEPTION(EXCEPTIONCLASS, STATEMENT)
Simplified version of MITK_TEST_FOR_EXCEPTION_BEGIN / END for a single statement. ...
Keeps track of the reference count of an object even if it is destroyed.
#define MITK_TEST_CONDITION(COND, MSG)
#define MITK_TEST_FAILED_MSG(MSG)
Fail and finish test with message MSG.
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.