23 CPPUNIT_TEST_SUITE(mitkGeometry3DEqualTestSuite);
24 MITK_TEST(Equal_CloneAndOriginal_ReturnsTrue);
25 MITK_TEST(Equal_DifferentOrigin_ReturnsFalse);
26 MITK_TEST(Equal_DifferentIndexToWorldTransform_ReturnsFalse);
27 MITK_TEST(Equal_DifferentSpacing_ReturnsFalse);
28 MITK_TEST(Equal_DifferentImageGeometry_ReturnsFalse);
29 MITK_TEST(Equal_DifferentBoundingBox_ReturnsFalse);
30 CPPUNIT_TEST_SUITE_END();
45 m_Geometry3D->Initialize();
46 m_AnotherGeometry3D = m_Geometry3D->Clone();
49 void tearDown()
override
51 m_Geometry3D =
nullptr;
52 m_AnotherGeometry3D =
nullptr;
55 void Equal_CloneAndOriginal_ReturnsTrue()
57 MITK_ASSERT_EQUAL(m_Geometry3D, m_AnotherGeometry3D,
"A clone should be equal to its original.");
60 void Equal_DifferentOrigin_ReturnsFalse()
66 m_AnotherGeometry3D->SetOrigin(origin);
68 MITK_ASSERT_NOT_EQUAL(m_Geometry3D, m_AnotherGeometry3D,
"Origin was modified. Result should be false.");
71 void Equal_DifferentIndexToWorldTransform_ReturnsFalse()
76 mitk::AffineTransform3D::MatrixType differentMatrix;
77 differentMatrix.SetIdentity();
78 differentMatrix(1, 1) = 2;
80 differentIndexToWorldTransform->SetMatrix(differentMatrix);
81 m_AnotherGeometry3D->SetIndexToWorldTransform(differentIndexToWorldTransform);
84 m_Geometry3D, m_AnotherGeometry3D,
"IndexToWorldTransform was modified. Result should be false.");
87 void Equal_DifferentSpacing_ReturnsFalse()
90 differentSpacing[0] = 1.0;
91 differentSpacing[1] = 1.0 + 2 *
mitk::eps;
92 differentSpacing[2] = 1.0;
94 m_AnotherGeometry3D->SetSpacing(differentSpacing);
96 MITK_ASSERT_NOT_EQUAL(m_Geometry3D, m_AnotherGeometry3D,
"Spacing was modified. Result should be false.");
99 void Equal_DifferentImageGeometry_ReturnsFalse()
101 m_AnotherGeometry3D->SetImageGeometry(
true);
104 m_Geometry3D, m_AnotherGeometry3D,
"One Geometry is image, the other is not. Result should be false.");
107 void Equal_DifferentBoundingBox_ReturnsFalse()
111 m_AnotherGeometry3D->SetBounds(bounds);
113 MITK_ASSERT_NOT_EQUAL(m_Geometry3D, m_AnotherGeometry3D,
"Bounds are different. Result should be false.");
itk::SmartPointer< Self > Pointer
MITK_TEST_SUITE_REGISTRATION(mitkImageToItk)
#define MITK_TEST(TESTMETHOD)
Adds a test to the current test suite.
#define MITK_ASSERT_NOT_EQUAL(OBJ1, OBJ2, MSG)
Testing macro to test if two objects are not equal.
Test fixture for parameterized tests.
#define MITK_ASSERT_EQUAL(EXPECTED, ACTUAL, MSG)
Testing macro to test if two objects are equal.
MITKCORE_EXPORT const ScalarType eps
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.