MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkClaronInterfaceTest.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 "mitkClaronInterface.h"
14
15#include "mitkTestingMacros.h"
16
17#include <iostream>
18
25int mitkClaronInterfaceTest(int /* argc */, char* /*argv*/[])
26{
27 MITK_TEST_BEGIN("ClaronInterface")
28
29 // let's create an object of our class
30 mitk::ClaronInterface::Pointer myClaronInterface = mitk::ClaronInterface::New();
31 myClaronInterface->Initialize("Test","Test");
32
33 // first test: did this work?
34 MITK_TEST_CONDITION_REQUIRED((myClaronInterface.IsNotNull()),"Testing instantiation:")
35
36 // if the Microntracker is not installed we could also test the returnValues of the stubs
37 if (!myClaronInterface->IsMicronTrackerInstalled())
38 {
39 MITK_TEST_OUTPUT(<< "In the following stubs are tested, errors are expected and should occur.")
40 MITK_TEST_CONDITION_REQUIRED((myClaronInterface->GetAllActiveTools().empty()),"Testing stub of GetAllActiveTools() ");
41 MITK_TEST_CONDITION_REQUIRED((myClaronInterface->GetName(0)==nullptr),"Testing stub of GetName() ");
42 MITK_TEST_CONDITION_REQUIRED((myClaronInterface->GetPosition(0).empty()),"Testing stub of GetPosition() ");
43 MITK_TEST_CONDITION_REQUIRED((myClaronInterface->GetQuaternions(0).empty()),"Testing stub of GetQuaternions() ");
44 MITK_TEST_CONDITION_REQUIRED((myClaronInterface->GetTipPosition(0).empty()),"Testing stub of GetTipPosition() ");
45 MITK_TEST_CONDITION_REQUIRED((myClaronInterface->GetTipQuaternions(0).empty()),"Testing stub of GetTipQuaternions() ");
46 MITK_TEST_CONDITION_REQUIRED(!(myClaronInterface->StartTracking()),"Testing stub of StartTracking() ");
47 MITK_TEST_CONDITION_REQUIRED(!(myClaronInterface->StopTracking()),"Testing stub of StopTracking() ");
48 bool success = true;
49 try
50 {
51 myClaronInterface->GrabFrame();
52 }
53 catch(...)
54 {
55 success = false;
56 }
57 MITK_TEST_CONDITION_REQUIRED(success,"Testing stub of GrabFrame() ");
58 }
59
60 // always end with this!
61 MITK_TEST_END()
62}
63
64
int mitkClaronInterfaceTest(int, char *[])