20 #include <vtkDebugLeaks.h> 21 #include <vtkPoints.h> 22 #include <vtkSmartPointer.h> 23 #include <vtkUnstructuredGrid.h> 25 class mitkUnstructuredGridToUnstructuredGridFilterTestSuite :
public mitk::TestFixture 27 CPPUNIT_TEST_SUITE(mitkUnstructuredGridToUnstructuredGridFilterTestSuite);
29 vtkDebugLeaks::SetExitError(0);
31 MITK_TEST(testUnstructuredGridToUnstructuredGridFilterInitialization);
34 MITK_TEST(testUnstructuredGridGeneration);
35 CPPUNIT_TEST_SUITE_END();
46 vtkSmartPointer<vtkUnstructuredGrid> vtkGrid = vtkSmartPointer<vtkUnstructuredGrid>::New();
47 vtkSmartPointer<vtkUnstructuredGrid> vtkGrid2 = vtkSmartPointer<vtkUnstructuredGrid>::New();
48 vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
49 vtkSmartPointer<vtkPoints> points2 = vtkSmartPointer<vtkPoints>::New();
51 for (
int i = 0; i < 3; i++)
53 for (
int j = 0; j < 3; j++)
55 for (
int k = 0;
k < 3;
k++)
62 points->InsertNextPoint(point[0], point[1], point[2]);
63 points2->InsertNextPoint(point[0] + 5, point[1] + 5, point[2] + 5);
68 vtkGrid->SetPoints(points);
69 vtkGrid2->SetPoints(points2);
70 m_UnstructuredGrid->SetVtkUnstructuredGrid(vtkGrid);
71 m_2ndUnstructuredGrid->SetVtkUnstructuredGrid(vtkGrid2);
74 void testUnstructuredGridToUnstructuredGridFilterInitialization()
78 CPPUNIT_ASSERT_MESSAGE(
"Testing instantiation of test object", testFilter.IsNotNull());
85 testFilter->SetInput(m_UnstructuredGrid);
86 CPPUNIT_ASSERT_MESSAGE(
"Testing set / get input!", testFilter->GetInput() == m_UnstructuredGrid);
89 void testMultipleInputs()
93 testFilter->SetInput(0, m_UnstructuredGrid);
94 testFilter->SetInput(1, m_2ndUnstructuredGrid);
95 CPPUNIT_ASSERT_MESSAGE(
"Testing first input!", testFilter->GetInput(0) == m_UnstructuredGrid);
96 CPPUNIT_ASSERT_MESSAGE(
"Testing second input!", testFilter->GetInput(1) == m_2ndUnstructuredGrid);
99 void testUnstructuredGridGeneration()
103 testFilter->SetInput(m_UnstructuredGrid);
104 testFilter->Update();
105 CPPUNIT_ASSERT_MESSAGE(
"Testing unstructured grid generation!", testFilter->GetOutput() !=
nullptr);
MITK_TEST_SUITE_REGISTRATION(mitkImageToItk)
#define MITK_TEST(TESTMETHOD)
Adds a test to the current test suite.
Test fixture for parameterized tests.