29 propertyAliases->
AddAlias(
"propertyName1",
"alias1a");
30 propertyAliases->
AddAlias(
"propertyName1",
"alias1b");
31 propertyAliases->
AddAlias(
"propertyName2",
"alias2a");
32 propertyAliases->
AddAlias(
"propertyName2",
"alias2b",
"className");
34 typedef std::vector<std::string> Aliases;
35 typedef Aliases::iterator AliasesIterator;
37 Aliases aliases = propertyAliases->
GetAliases(
"propertyName1");
38 AliasesIterator it1 = std::find(aliases.begin(), aliases.end(),
"alias1a");
39 AliasesIterator it2 = std::find(aliases.begin(), aliases.end(),
"alias1b");
42 "Get aliases of \"propertyName1\"");
44 aliases = propertyAliases->
GetAliases(
"propertyName2");
45 it1 = std::find(aliases.begin(), aliases.end(),
"alias2a");
47 MITK_TEST_CONDITION(aliases.size() == 1 && it1 != aliases.end(),
"Get aliases of \"propertyName2\"");
49 aliases = propertyAliases->
GetAliases(
"propertyName2",
"className");
50 it1 = std::find(aliases.begin(), aliases.end(),
"alias2b");
53 "Get aliases of \"propertyName2\" restricted to \"className\"");
61 MITK_TEST_CONDITION(propertyName.empty(),
"Get property name of non-existing unrestricted \"alias2b\"");
63 propertyName = propertyAliases->
GetPropertyName(
"alias2b",
"className");
65 MITK_TEST_CONDITION(propertyName ==
"propertyName2",
"Get property name of restricted \"alias2b\"");
virtual std::string GetPropertyName(const std::string &alias, const std::string &className="")=0
Get property name that is associated to specific alias.
Interface of property aliases service.
#define MITK_TEST_CONDITION_REQUIRED(COND, MSG)
virtual bool AddAlias(const std::string &propertyName, const std::string &alias, const std::string &className="")=0
Add an alias for a specific property.
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
virtual std::vector< std::string > GetAliases(const std::string &propertyName, const std::string &className="")=0
Get aliases for a specific property.
#define MITK_TEST_CONDITION(COND, MSG)
int mitkPropertyAliasesTest(int, char *[])
static IPropertyAliases * GetPropertyAliases(us::ModuleContext *context=us::GetModuleContext())
Get an IPropertyAliases instance.