23 #include <vtkDebugLeaks.h> 27 CPPUNIT_TEST_SUITE(mitkPropertyDescriptionsTestSuite);
28 MITK_TEST(GetPropertyDescriptionService_Success);
29 MITK_TEST(GetPropertyDescription_Success);
30 MITK_TEST(GetOverwrittenDescription_Success);
31 MITK_TEST(GetPropertyDescriptionRestricted_Success);
32 CPPUNIT_TEST_SUITE_END();
36 std::string m_Description1;
42 m_PropertyDescriptions->
AddDescription(
"propertyName1",
"description1a");
43 m_PropertyDescriptions->
AddDescription(
"propertyName1",
"description1b");
48 m_PropertyDescriptions =
nullptr;
51 void GetPropertyDescriptionService_Success()
53 CPPUNIT_ASSERT_MESSAGE(
"Get property descriptions service", m_PropertyDescriptions !=
nullptr);
56 void GetPropertyDescription_Success()
58 m_Description1 = m_PropertyDescriptions->
GetDescription(
"propertyName1");
59 CPPUNIT_ASSERT_MESSAGE(
"Get description of \"propertyName1\"", m_Description1 ==
"description1a");
62 void GetOverwrittenDescription_Success()
64 m_PropertyDescriptions->
AddDescription(
"propertyName1",
"description1b",
"",
true);
65 m_Description1 = m_PropertyDescriptions->
GetDescription(
"propertyName1");
66 CPPUNIT_ASSERT_MESSAGE(
"Get overwritten description of \"propertyName1\"", m_Description1 ==
"description1b");
69 void GetPropertyDescriptionRestricted_Success()
71 m_PropertyDescriptions->
AddDescription(
"propertyName1",
"description1c",
"className");
72 std::string description2 = m_PropertyDescriptions->
GetDescription(
"propertyName1",
"className");
73 m_Description1 = m_PropertyDescriptions->
GetDescription(
"propertyName1");
75 CPPUNIT_ASSERT_MESSAGE(
"Get description of \"propertyName1\" restricted to \"className\"",
76 m_Description1 ==
"description1b" && description2 ==
"description1c");
virtual bool AddDescription(const std::string &propertyName, const std::string &description, const std::string &className="", bool overwrite=false)=0
Add a description for a specific property.
MITK_TEST_SUITE_REGISTRATION(mitkImageToItk)
#define MITK_TEST(TESTMETHOD)
Adds a test to the current test suite.
static IPropertyDescriptions * GetPropertyDescriptions(us::ModuleContext *context=us::GetModuleContext())
Get an IPropertyDescriptions instance.
Interface of property descriptions service.
Test fixture for parameterized tests.
virtual std::string GetDescription(const std::string &propertyName, const std::string &className="", bool allowNameRegEx=true) const =0
Get the description for a specific property.