Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkPropertyDescriptionsTest.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include <mitkCoreServices.h>
19 #include <mitkTestingMacros.h>
20 
21 int mitkPropertyDescriptionsTest(int, char *[])
22 {
23  MITK_TEST_BEGIN("mitkPropertyDescriptionsTest");
24 
26  MITK_TEST_CONDITION_REQUIRED(propertyDescriptions != NULL, "Get property descriptions service");
27 
28  propertyDescriptions->AddDescription("propertyName1", "description1a");
29  propertyDescriptions->AddDescription("propertyName1", "description1b");
30  std::string description1 = propertyDescriptions->GetDescription("propertyName1");
31 
32  MITK_TEST_CONDITION(description1 == "description1a", "Get description of \"propertyName1\"");
33 
34  propertyDescriptions->AddDescription("propertyName1", "description1b", "", true);
35  description1 = propertyDescriptions->GetDescription("propertyName1");
36 
37  MITK_TEST_CONDITION(description1 == "description1b", "Get overwritten description of \"propertyName1\"");
38 
39  propertyDescriptions->AddDescription("propertyName1", "description1c", "className");
40  std::string description2 = propertyDescriptions->GetDescription("propertyName1", "className");
41  description1 = propertyDescriptions->GetDescription("propertyName1");
42 
43  MITK_TEST_CONDITION(description1 == "description1b" && description2 == "description1c",
44  "Get description of \"propertyName1\" restricted to \"className\"");
45 
46  MITK_TEST_END();
47 }
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.
#define MITK_TEST_CONDITION_REQUIRED(COND, MSG)
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
static IPropertyDescriptions * GetPropertyDescriptions(us::ModuleContext *context=us::GetModuleContext())
Get an IPropertyDescriptions instance.
Interface of property descriptions service.
int mitkPropertyDescriptionsTest(int, char *[])
#define MITK_TEST_CONDITION(COND, MSG)
virtual std::string GetDescription(const std::string &propertyName, const std::string &className="", bool allowNameRegEx=true) const =0
Get the description for a specific property.
and MITK_TEST_END()