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

Method TestPropertyList

Modules/Core/test/mitkDataNodeTest.cpp:156–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154 "Testing if a PointSetDataInteractor was set correctly")
155 }
156 static void TestPropertyList(mitk::DataNode::Pointer dataNode)
157 {
158 mitk::PropertyList::Pointer propertyList = dataNode->GetPropertyList();
159
160 MITK_TEST_CONDITION(dataNode->GetPropertyList() != nullptr, "Testing if the constructor set the propertylist")
161
162 dataNode->SetIntProperty("int", -31337);
163 int x;
164 dataNode->GetIntProperty("int", x);
165 MITK_TEST_CONDITION(x == -31337, "Testing Set/GetIntProperty");
166
167 dataNode->SetBoolProperty("bool", true);
168 bool b;
169 dataNode->GetBoolProperty("bool", b);
170 MITK_TEST_CONDITION(b == true, "Testing Set/GetBoolProperty");
171 dataNode->SetFloatProperty("float", -31.337);
172 float y;
173 dataNode->GetFloatProperty("float", y);
174 MITK_TEST_CONDITION(y - -31.337 < 0.01, "Testing Set/GetFloatProperty");
175 double yd = 0;
176 dataNode->GetDoubleProperty("float", yd);
177 MITK_TEST_CONDITION(mitk::Equal(yd, static_cast<double>(y)), "Testing GetDoubleProperty");
178
179 double d = sqrt(2.0);
180 dataNode->SetDoubleProperty("double", d);
181 double read_d;
182 MITK_TEST_CONDITION(dataNode->GetDoubleProperty("double", read_d), "Testing GetDoubleProperty");
183 MITK_TEST_CONDITION(d == read_d, "Testing Set/GetDoubleProperty"); // Equal does not the same thing
184 dataNode->SetStringProperty("string", "MITK");
185 std::string s = "GANZVIELPLATZ";
186 dataNode->GetStringProperty("string", s);
187 MITK_TEST_CONDITION(s == "MITK", "Testing Set/GetStringProperty");
188
189 std::string name = "MyTestName";
190 dataNode->SetName(name.c_str());
191 MITK_TEST_CONDITION(dataNode->GetName() == name, "Testing Set/GetName");
192 name = "MySecondTestName";
193 dataNode->SetName(name);
194 MITK_TEST_CONDITION(dataNode->GetName() == name, "Testing Set/GetName(std::string)");
195
196 MITK_TEST_CONDITION(propertyList == dataNode->GetPropertyList(),
197 "Testing if the propertylist has changed during the last tests")
198 }
199
200 static void TestDataPropertiesFallback(mitk::DataNode::Pointer dataNode)
201 {

Callers

nothing calls this directly

Calls 14

EqualFunction · 0.50
GetPropertyListMethod · 0.45
SetIntPropertyMethod · 0.45
GetIntPropertyMethod · 0.45
SetBoolPropertyMethod · 0.45
GetBoolPropertyMethod · 0.45
SetFloatPropertyMethod · 0.45
GetFloatPropertyMethod · 0.45
GetDoublePropertyMethod · 0.45
SetDoublePropertyMethod · 0.45
SetStringPropertyMethod · 0.45
GetStringPropertyMethod · 0.45

Tested by

no test coverage detected