30 itkFactorylessNewMacro(Self)
34 this->SetNumberOfIndexedOutputs(1);
40 class mitkNavigationDataSourceTestClass
44 static void TestInstantiation()
55 MITK_TEST_CONDITION(myFilter->GetNumberOfInputs() == 0,
"testing initial number of inputs");
56 MITK_TEST_CONDITION(myFilter->GetNumberOfOutputs() == 0,
"testing initial number of outputs");
57 myFilter->CreateOutput();
58 MITK_TEST_CONDITION(myFilter->GetNumberOfOutputs() == 1,
"testing SetNumberOfOutputs() and MakeOutput()");
59 MITK_TEST_CONDITION(dynamic_cast<mitk::NavigationData*>(myFilter->GetOutput()) != NULL,
"test GetOutput() returning valid output object");
62 static void TestMethodsNormalCases()
66 myFilter->CreateOutput();
71 bool initialValid(
true);
73 nd1->SetPosition(initialPos);
74 nd1->SetOrientation(initialOri);
75 nd1->SetPositionAccuracy(initialError);
76 nd1->SetDataValid(initialValid);
80 myFilter->GraftOutput(nd1);
82 MITK_TEST_CONDITION(out.GetPointer() != nd1.GetPointer(),
"testing if output is same object as source of graft");
85 MITK_TEST_CONDITION((out->GetCovErrorMatrix() == nd1->GetCovErrorMatrix()),"testing error matrix equality after graft")
86 MITK_TEST_CONDITION((out->IsDataValid() == nd1->IsDataValid()),"testing data valid equality after graft")
94 static
void TestMethodsInvalidCases()
102 testOutput = myFilter->GetOutput(
"test");
103 MITK_TEST_CONDITION(testOutput.IsNull(),
"testing GetOutput(string) before initialization");
106 myFilter->CreateOutput();
107 bool exceptionThrown=
false;
110 myFilter->GetOutputIndex(
"nonsense name");
112 catch(std::invalid_argument e)
114 exceptionThrown=
true;
116 MITK_TEST_CONDITION(exceptionThrown,
"Testing method GetOutputIndex with invalid navigation data name");
119 exceptionThrown=
false;
123 myFilter->GraftNthOutput(100,graftObject);
125 catch(itk::ExceptionObject e)
127 exceptionThrown=
true;
132 static void TestMicroserviceRegister()
135 myFilter->CreateOutput();
140 bool initialValid(
true);
142 nd1->SetPosition(initialPos);
143 nd1->SetOrientation(initialOri);
144 nd1->SetPositionAccuracy(initialError);
145 nd1->SetDataValid(initialValid);
146 myFilter->RegisterAsMicroservice();
147 MITK_TEST_CONDITION(myFilter->GetMicroserviceID()!=
"",
"Testing if microservice was registered successfully.");
149 static void TestMicroserviceAvailabilityAndUnregister()
167 mitkNavigationDataSourceTestClass::TestInstantiation();
168 mitkNavigationDataSourceTestClass::TestMethodsNormalCases();
169 mitkNavigationDataSourceTestClass::TestMethodsInvalidCases();
170 mitkNavigationDataSourceTestClass::TestMicroserviceRegister();
171 mitkNavigationDataSourceTestClass::TestMicroserviceAvailabilityAndUnregister();
itk::SmartPointer< Self > Pointer
#define MITK_TEST_CONDITION_REQUIRED(COND, MSG)
int mitkNavigationDataSourceTest(int, char *[])
DataCollection - Class to facilitate loading/accessing structured data.
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
mitk::Quaternion OrientationType
Type that holds the orientation part of the tracking data.
void FillVector3D(Tout &out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z)
itk::SmartPointer< const Self > ConstPointer
#define MITK_TEST_OUTPUT(x)
Output some text.
virtual itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override
#define MITK_TEST_CONDITION(COND, MSG)
#define mitkClassMacro(className, SuperClassName)
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.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.