25 #include <vtkDebugLeaks.h> 29 CPPUNIT_TEST_SUITE(mitkPropertyFiltersTestSuite);
30 MITK_TEST(GetPropertyFiltersService_Success);
31 MITK_TEST(ApplyGlobalPropertyFilter_Success);
32 MITK_TEST(ApplyRestrictedPropertyFilter_Success);
33 CPPUNIT_TEST_SUITE_END();
37 typedef std::map<std::string, mitk::BaseProperty::Pointer> PropertyMap;
38 typedef PropertyMap::const_iterator PropertyMapConstIterator;
39 PropertyMap m_PropertyMap;
42 PropertyMap m_FilteredPropertyMap;
43 PropertyMapConstIterator m_It1;
44 PropertyMapConstIterator m_It2;
45 PropertyMapConstIterator m_It3;
62 m_PropertyFilters->
AddFilter(m_RestrictedFilter,
"className");
66 m_PropertyFilters =
nullptr;
69 void GetPropertyFiltersService_Success()
71 CPPUNIT_ASSERT_MESSAGE(
"Get property filters service", m_PropertyFilters !=
nullptr);
74 void ApplyGlobalPropertyFilter_Success()
76 m_FilteredPropertyMap = m_PropertyFilters->
ApplyFilter(m_PropertyMap);
77 m_It1 = m_FilteredPropertyMap.find(
"propertyName1");
78 m_It2 = m_FilteredPropertyMap.find(
"propertyName2");
79 m_It3 = m_FilteredPropertyMap.find(
"propertyName3");
81 CPPUNIT_ASSERT_MESSAGE(
"Apply global property filter",
82 m_It1 != m_FilteredPropertyMap.end() && m_It2 != m_FilteredPropertyMap.end() && m_It3 == m_FilteredPropertyMap.end());
85 void ApplyRestrictedPropertyFilter_Success()
87 m_FilteredPropertyMap = m_PropertyFilters->
ApplyFilter(m_PropertyMap,
"className");
88 m_It1 = m_FilteredPropertyMap.find(
"propertyName1");
89 m_It2 = m_FilteredPropertyMap.find(
"propertyName2");
90 m_It3 = m_FilteredPropertyMap.find(
"propertyName3");
92 CPPUNIT_ASSERT_MESSAGE(
"Apply restricted property filter (also respects global filter)",
93 m_It1 != m_FilteredPropertyMap.end() && m_It2 == m_FilteredPropertyMap.end() && m_It3 == m_FilteredPropertyMap.end());
MITK_TEST_SUITE_REGISTRATION(mitkImageToItk)
void AddEntry(const std::string &propertyName, List list)
Add a filter entry for a specific property.
virtual bool AddFilter(const PropertyFilter &filter, const std::string &className="", bool overwrite=false)=0
Add a property filter.
#define MITK_TEST(TESTMETHOD)
Adds a test to the current test suite.
virtual std::map< std::string, BaseProperty::Pointer > ApplyFilter(const std::map< std::string, BaseProperty::Pointer > &propertyMap, const std::string &className="") const =0
Apply property filter to property list.
Test fixture for parameterized tests.
Interface of property filters service.
static IPropertyFilters * GetPropertyFilters(us::ModuleContext *context=us::GetModuleContext())
Get an IPropertyFilters instance.
Consists of blacklist and whitelist entries.