28 #include <vtkDebugLeaks.h> 32 CPPUNIT_TEST_SUITE(mitkBaseDataTestSuite);
35 MITK_TEST(InitializationOfBaseData_Success);
38 MITK_TEST(InitializationOfCloneBaseData_Success);
44 MITK_TEST(GetGeometryForSingleTimeGeometries_Failure);
48 MITK_TEST(TestingGetUpdateGeometry_Success);
55 MITK_TEST(BaseDataSetAndGetProperty_Success);
56 MITK_TEST(CloneBaseDataSetAndGetProperty_Success);
59 MITK_TEST(BasePorpertyIsSetInPropertyList_Success);
61 MITK_TEST(UpdateOutputInformationOfBaseData_Failure);
62 MITK_TEST(CopyingInformationOfBaseData_Failure);
64 CPPUNIT_TEST_SUITE_END();
83 m_CloneBaseData = m_BaseDataImpl->Clone();
98 void tearDown()
override 100 m_BaseDataImpl =
nullptr;
101 m_CloneBaseData =
nullptr;
106 m_Geometry3D =
nullptr;
113 m_PropertyList =
nullptr;
116 void CreateBaseData_Success()
119 MITK_INFO <<
"Creating a base data instance...";
120 CPPUNIT_ASSERT_MESSAGE(
"Testing instantiation", m_BaseDataImpl.IsNotNull());
123 void InitializationOfBaseData_Success()
125 CPPUNIT_ASSERT_MESSAGE(
"BaseDataTestImplementation is initialized", m_BaseDataImpl->IsInitialized());
126 CPPUNIT_ASSERT_MESSAGE(
"BaseDataTestImplementation is initialized and empty", m_BaseDataImpl->IsEmpty());
129 void CreateCloneBaseData_Success()
132 MITK_INFO <<
"Creating a clone base data instance...";
133 CPPUNIT_ASSERT_MESSAGE(
"Testing instantiation of base data clone", m_CloneBaseData.IsNotNull());
136 void InitializationOfCloneBaseData_Success()
138 CPPUNIT_ASSERT_MESSAGE(
"Clone of BaseDataTestImplementation is initialized", m_CloneBaseData->IsInitialized());
139 CPPUNIT_ASSERT_MESSAGE(
"Clone of BaseDataTestImplementation is initialized and empty", m_CloneBaseData->IsEmpty());
142 void GetAndSetTimeGeometry_Success()
145 MITK_INFO <<
"Testing setter and getter for geometries...";
146 CPPUNIT_ASSERT_MESSAGE(
"Testing creation of TimeGeometry", m_BaseDataImpl->GetTimeGeometry());
149 void ResetTimeGeometry_Success()
151 m_BaseDataImpl->SetTimeGeometry(m_Geo);
152 CPPUNIT_ASSERT_MESSAGE(
"Reset Geometry", m_BaseDataImpl->GetTimeGeometry() ==
nullptr);
155 void ReinitOfTimeGeometry_Success()
157 m_BaseDataImpl->SetTimeGeometry(m_Geo2);
158 m_Geo2->Initialize(2);
159 CPPUNIT_ASSERT_MESSAGE(
"Correct Reinit of TimeGeometry", m_BaseDataImpl->GetTimeGeometry() == m_Geo2.GetPointer());
162 void GetGeometryForSingleTimeGeometries_Failure()
165 CPPUNIT_ASSERT_MESSAGE(
"Testing Creation of single TimeGeometries", m_BaseDataImpl->GetGeometry(1) ==
nullptr);
168 void TestingExpand_Success()
171 m_BaseDataImpl->Expand(5);
172 CPPUNIT_ASSERT_MESSAGE(
"Expand the geometry to further time slices!", m_BaseDataImpl->GetTimeSteps() == 5);
175 void TestingGetUpdateGeometry_Success()
178 m_BaseDataImpl->Expand(5);
181 if (timeGeometry.IsNotNull())
183 timeGeometry->SetTimeStepGeometry(m_Geo3, 1);
186 CPPUNIT_ASSERT_MESSAGE(
"Set Geometry for time step 1", m_BaseDataImpl->GetUpdatedGeometry(1) == m_Geo3);
187 CPPUNIT_ASSERT_MESSAGE(
"Check if modified time is set", m_BaseDataImpl->GetMTime() != 0);
190 void GetOriginOfBaseData_Success()
192 m_BaseDataImpl->Expand(5);
193 m_BaseDataImpl->SetClonedGeometry(m_Geo3, 1);
196 m_BaseDataImpl->SetOrigin(p3d);
197 m_Geo3->SetOrigin(p3d);
198 CPPUNIT_ASSERT_MESSAGE(
"Testing Origin set", m_BaseDataImpl->GetGeometry(1)->GetOrigin() == m_Geo3->GetOrigin());
200 void GetOriginOfCloneBaseData()
202 m_BaseDataImpl->Expand(5);
203 m_BaseDataImpl->SetClonedGeometry(m_Geo3, 1);
206 m_BaseDataImpl->SetOrigin(p3d);
207 m_Geo3->SetOrigin(p3d);
209 m_CloneBaseData = m_BaseDataImpl->Clone();
210 CPPUNIT_ASSERT_MESSAGE(
"Testing origin set in clone!",
211 m_CloneBaseData->GetGeometry(1)->GetOrigin() == m_Geo3->GetOrigin());
214 void ClearATimeStep()
216 CPPUNIT_ASSERT_MESSAGE(
"Is not empty before clear()!", !m_BaseDataImpl->IsEmptyTimeStep(1));
217 m_BaseDataImpl->Clear();
218 CPPUNIT_ASSERT_MESSAGE(
"...but afterwards!", m_BaseDataImpl->IsEmptyTimeStep(1));
221 void BaseDataSetAndGetProperty_Success()
225 CPPUNIT_ASSERT_MESSAGE(
"Check if base property is set correctly!",
226 m_BaseDataImpl->GetProperty(
"property38")->GetValueAsString() ==
"testproperty");
229 void CloneBaseDataSetAndGetProperty_Success()
232 m_CloneBaseData = m_BaseDataImpl->Clone();
233 CPPUNIT_ASSERT_MESSAGE(
"Testing origin set in clone!",
234 m_CloneBaseData->GetProperty(
"property38")->GetValueAsString() ==
"testproperty");
237 void BasePropertyListIsSet_Success()
240 m_PropertyList->SetFloatProperty(
"floatProperty1", 123.45);
241 m_PropertyList->SetBoolProperty(
"visibility",
true);
242 m_PropertyList->SetStringProperty(
"nameXY",
"propertyName");
243 m_BaseDataImpl->SetPropertyList(m_PropertyList);
245 CPPUNIT_ASSERT_MESSAGE(
"Check if base property list is set correctly!",
246 m_BaseDataImpl->GetPropertyList() == m_PropertyList);
249 void BasePorpertyIsSetInPropertyList_Success()
251 m_PropertyList->SetFloatProperty(
"floatProperty1", 123.45);
252 m_PropertyList->SetBoolProperty(
"visibility",
true);
253 m_PropertyList->SetStringProperty(
"nameXY",
"propertyName");
254 m_BaseDataImpl->SetPropertyList(m_PropertyList);
256 CPPUNIT_ASSERT_MESSAGE(
"Check if base property is set correctly in the property list!",
257 m_BaseDataImpl->GetPropertyList()->GetBoolProperty(
"visibility", value) ==
true);
260 void UpdateOutputInformationOfBaseData_Failure()
263 m_BaseDataImpl->UpdateOutputInformation();
264 m_Geo2->Initialize(2);
266 CPPUNIT_ASSERT_MESSAGE(
"TimeGeometry update!", m_BaseDataImpl->GetUpdatedTimeGeometry() != m_Geo2);
269 void CopyingInformationOfBaseData_Failure()
273 newBaseData->CopyInformation(m_BaseDataImpl);
274 CPPUNIT_ASSERT_MESSAGE(
"Check copying of Basedata Data Object!",
275 newBaseData->GetTimeGeometry()->CountTimeSteps() != 5);
MITK_TEST_SUITE_REGISTRATION(mitkImageToItk)
#define MITK_TEST(TESTMETHOD)
Adds a test to the current test suite.
Test fixture for parameterized tests.
BaseGeometry Describes the geometry of a data object.