MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkNDIPassiveToolTest.cpp
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12
13#include "mitkNDIPassiveTool.h"
14#include "mitkTestingMacros.h"
15#include "mitkIGTConfig.h"
16#include <iostream>
17
25{
26public:
28
33 itkCloneMacro(Self)
34
35protected:
36 NDIPassiveToolTestClass() : mitk::NDIPassiveTool()
37 {
38 }
39};
40
44int mitkNDIPassiveToolTest(int /* argc */, char* /*argv*/[])
45{
46 // always start with this!
47 MITK_TEST_BEGIN("NDIPassiveTool");
48
49 // let's create an object of our class
50 mitk::NDIPassiveTool::Pointer myNDIPassiveTool = NDIPassiveToolTestClass::New().GetPointer();
51
52 // using MITK_TEST_CONDITION_REQUIRED makes the test stop after failure, since
53 // it makes no sense to continue without an object.
54 MITK_TEST_CONDITION_REQUIRED(myNDIPassiveTool.IsNotNull(),"Testing instantiation");
55
56 myNDIPassiveTool->SetTrackingPriority(mitk::NDIPassiveTool::Dynamic);
57 MITK_TEST_CONDITION(myNDIPassiveTool->GetTrackingPriority()==mitk::NDIPassiveTool::Dynamic,"Testing Set/GetTrackingPriority() with 'Dynamic'");
58
59 myNDIPassiveTool->SetTrackingPriority(mitk::NDIPassiveTool::ButtonBox);
60 MITK_TEST_CONDITION(myNDIPassiveTool->GetTrackingPriority()==mitk::NDIPassiveTool::ButtonBox,"Testing Set/GetTrackingPriority() with 'ButtonBox'");
61
62 myNDIPassiveTool->SetTrackingPriority(mitk::NDIPassiveTool::Static);
63 MITK_TEST_CONDITION(myNDIPassiveTool->GetTrackingPriority()==mitk::NDIPassiveTool::Static,"Testing Set/GetTrackingPriority() with 'Static'");
64
65 std::string file(MITK_IGT_DATA_DIR);
66 file.append("/SROMFile.rom");
67 const char *name = file.c_str();
68 const char *name2 = "";
69 MITK_TEST_CONDITION(myNDIPassiveTool->LoadSROMFile(name) == true ,"Test LoadSROMFile() with valid file")
70
71 const unsigned char *temp = myNDIPassiveTool->GetSROMData();
72 unsigned int templen = myNDIPassiveTool->GetSROMDataLength();
73
74 MITK_TEST_CONDITION(myNDIPassiveTool->LoadSROMFile(name2) == false ,"Test LoadSROMFile() without file")
75
76 MITK_TEST_CONDITION(myNDIPassiveTool->GetSROMData()== temp, "Test GetSROMData() returns same after failed load")
77 MITK_TEST_CONDITION(myNDIPassiveTool->GetSROMDataLength()== templen,"Test GetSROMDataLength() returns same after failed load")
78
79 // always end with this!
80 MITK_TEST_END();
81}
mitkClassMacro(NDIPassiveToolTestClass, NDIPassiveTool)
itkFactorylessNewMacro(Self) itkCloneMacro(Self) protected
Implementation of a passive NDI optical tool.
itkCloneMacro(Self) NDIPassiveTool()
int mitkNDIPassiveToolTest(int, char *[])
IGT Exceptions.