MCPcopy Create free account
hub / github.com/MITK/MITK / TestMapperSetting

Method TestMapperSetting

Modules/Core/test/mitkDataNodeTest.cpp:88–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86 "Testing if base data (already set) was replaced by a nullptr pointer")
87 }
88 static void TestMapperSetting(mitk::DataNode::Pointer dataNode)
89 {
90 // tests the SetMapper() method
91 // in dataNode is a mapper vector which can be accessed by index
92 // in this test method we use only slot 0 (filled with null) and slot 1
93 // so we also test the destructor of the mapper classes
94 mitk::Mapper::Pointer mapper;
95
96 dataNode->SetMapper(0, mapper);
97 MITK_TEST_CONDITION(mapper == dataNode->GetMapper(0), "Testing if a nullptr pointer was set correctly")
98
99 mapper = mitk::PlaneGeometryDataMapper2D::New();
100 dataNode->SetMapper(1, mapper);
101 MITK_TEST_CONDITION(mapper == dataNode->GetMapper(1), "Testing if a PlaneGeometryDataMapper2D was set correctly")
102 MITK_TEST_CONDITION(dataNode == mapper->GetDataNode(), "Testing if the mapper returns the right DataNode")
103
104 mapper = mitk::ImageVtkMapper2D::New();
105 dataNode->SetMapper(1, mapper);
106 MITK_TEST_CONDITION(mapper == dataNode->GetMapper(1), "Testing if a ImageVtkMapper2D was set correctly")
107 MITK_TEST_CONDITION(dataNode == mapper->GetDataNode(), "Testing if the mapper returns the right DataNode")
108
109 mapper = mitk::PointSetVtkMapper2D::New();
110 dataNode->SetMapper(1, mapper);
111 MITK_TEST_CONDITION(mapper == dataNode->GetMapper(1), "Testing if a PointSetVtkMapper2D was set correctly")
112 MITK_TEST_CONDITION(dataNode == mapper->GetDataNode(), "Testing if the mapper returns the right DataNode")
113
114 mapper = mitk::SurfaceVtkMapper2D::New();
115 dataNode->SetMapper(1, mapper);
116 MITK_TEST_CONDITION(mapper == dataNode->GetMapper(1), "Testing if a SurfaceVtkMapper2D was set correctly")
117 MITK_TEST_CONDITION(dataNode == mapper->GetDataNode(), "Testing if the mapper returns the right DataNode")
118
119 mapper = mitk::PlaneGeometryDataVtkMapper3D::New();
120 dataNode->SetMapper(1, mapper);
121 MITK_TEST_CONDITION(mapper == dataNode->GetMapper(1), "Testing if a PlaneGeometryDataVtkMapper3D was set correctly")
122 MITK_TEST_CONDITION(dataNode == mapper->GetDataNode(), "Testing if the mapper returns the right DataNode")
123
124 mapper = mitk::PointSetVtkMapper3D::New();
125 dataNode->SetMapper(1, mapper);
126 MITK_TEST_CONDITION(mapper == dataNode->GetMapper(1), "Testing if a PointSetVtkMapper3D was set correctly")
127 MITK_TEST_CONDITION(dataNode == mapper->GetDataNode(), "Testing if the mapper returns the right DataNode")
128
129 mapper = mitk::SurfaceVtkMapper3D::New();
130 dataNode->SetMapper(1, mapper);
131 MITK_TEST_CONDITION(mapper == dataNode->GetMapper(1), "Testing if a SurfaceVtkMapper3D was set correctly")
132 MITK_TEST_CONDITION(dataNode == mapper->GetDataNode(), "Testing if the mapper returns the right DataNode")
133 }
134
135 static void TestInteractorSetting(mitk::DataNode::Pointer dataNode)
136 {

Callers

nothing calls this directly

Calls 4

SetMapperMethod · 0.80
GetMapperMethod · 0.80
NewFunction · 0.50
GetDataNodeMethod · 0.45

Tested by

no test coverage detected