56 mitk::NavigationData::Pointer nd0;
57 mitk::NavigationData::Pointer nd1;
58 for(
unsigned int i=0; i<player->GetNumberOfSnapshots(); ++i)
60 nd0 = player->GetOutput(0);
61 nd1 = player->GetOutput(1);
64 if(nd0.IsNull() || nd1.IsNull())
return false;
67 mitk::NavigationData::Pointer ref0 = NavigationDataSet->GetNavigationDataForIndex(i,0);
68 mitk::NavigationData::Pointer ref1 = NavigationDataSet->GetNavigationDataForIndex(i,1);
69 if (!(ref0->GetOrientation().as_vector() == nd0->GetOrientation().as_vector())) {
return false;}
70 if (!(ref1->GetOrientation().as_vector() == nd1->GetOrientation().as_vector())) {
return false;}
71 if (!(ref0->GetPosition().GetVnlVector() == nd0->GetPosition().GetVnlVector())) {
return false;}
72 if (!(ref1->GetPosition().GetVnlVector() == nd1->GetPosition().GetVnlVector())) {
return false;}
75 player->GoToNextSnapshot();
83 player->SetNavigationDataSet(NavigationDataSet);
85 MITK_TEST_CONDITION(player->GetNumberOfSnapshots() == 3,
"Testing if player reports correct number of Snapshots");
86 MITK_TEST_CONDITION(player->GetNumberOfIndexedOutputs() == 2,
"Testing number of outputs");
89 player->SetRepeat(
true);
91 MITK_TEST_CONDITION(
runLoop(),
"Testing first run.");
92 MITK_TEST_CONDITION(
runLoop(),
"Testing second run.");
95 player->GoToSnapshot(2);
96 mitk::NavigationData::Pointer nd1 = player->GetOutput(1);
97 mitk::NavigationData::Pointer ref1 = NavigationDataSet->GetNavigationDataForIndex(2,1);
98 MITK_TEST_CONDITION(ref1->GetPosition().GetVnlVector() == nd1->GetPosition().GetVnlVector(),
99 "Testing GoToSnapshot() [1]");
103 player->GoToSnapshot(0);
104 mitk::NavigationData::Pointer nd0 = player->GetOutput();
105 mitk::NavigationData::Pointer ref0 = NavigationDataSet->GetNavigationDataForIndex(0,0);
106 MITK_TEST_CONDITION(ref0->GetOrientation().as_vector() == nd0->GetOrientation().as_vector(),
107 "Testing GoToSnapshot() [2]");
114 player->SetNavigationDataSet(NavigationDataSet);
116 player->SetNavigationDataSet(NavigationDataSet);
119 MITK_TEST_CONDITION(nd1 == nd2,
"First output must be the same after setting same navigation data again.");
122 std::string file = GetTestDataFilePath(
"IGT-Data/NavigationDataTestData.xml");
123 mitk::NavigationDataSet::Pointer dataset =
dynamic_cast<mitk::NavigationDataSet*
> (mitk::IOUtil::Load(file)[0].GetPointer());
130 mitk::NavigationDataSequentialPlayer::Pointer myTestPlayer2 = mitk::NavigationDataSequentialPlayer::New();
131 std::string file = GetTestDataFilePath(
"IGT-Data/NavigationDataTestData_2Tools.xml");
132 mitk::NavigationDataSet::Pointer dataset =
dynamic_cast<mitk::NavigationDataSet*
> (mitk::IOUtil::Load(file)[0].GetPointer());
133 myTestPlayer2->SetNavigationDataSet(dataset);
135 bool exceptionThrown2=
false;
138 unsigned int invalidSnapshot = 1000;
139 myTestPlayer2->GoToSnapshot(invalidSnapshot);
143 exceptionThrown2=
true;
145 MITK_TEST_CONDITION(exceptionThrown2,
"Testing if exception is thrown when GoToSnapShot method is called with an index that doesn't exist.");
154 player->SetNavigationDataSet(NavigationDataSet);
157 mitk::Quaternion nd1Orientation = player->GetOutput()->GetOrientation();
160 mitk::Quaternion nd2Orientation = player->GetOutput()->GetOrientation();
162 MITK_TEST_CONDITION(nd1Orientation.as_vector() == nd2Orientation.as_vector(),
"Output must be the same no matter if Update() was called between.");
164 MITK_TEST_CONDITION(player->GoToNextSnapshot(),
"There must be a next snapshot available.");
166 mitk::Quaternion nd3Orientation = player->GetOutput()->GetOrientation();
168 MITK_TEST_CONDITION(nd1Orientation.as_vector() != nd3Orientation.as_vector(),
"Output must be different if GoToNextSnapshot() was called between.");