diff --git a/Modules/Core/src/DataManagement/mitkGenericIDRelationRule.cpp b/Modules/Core/src/DataManagement/mitkGenericIDRelationRule.cpp index 7e59adff41..85f88a2004 100644 --- a/Modules/Core/src/DataManagement/mitkGenericIDRelationRule.cpp +++ b/Modules/Core/src/DataManagement/mitkGenericIDRelationRule.cpp @@ -1,74 +1,81 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkGenericIDRelationRule.h" mitk::GenericIDRelationRule::RuleIDType mitk::GenericIDRelationRule::GetRuleID() const { return "IDRelation_" + m_RuleIDTag; }; std::string mitk::GenericIDRelationRule::GetDisplayName() const { return m_DisplayName; }; std::string mitk::GenericIDRelationRule::GetSourceRoleName() const { return m_SourceRole; }; std::string mitk::GenericIDRelationRule::GetDestinationRoleName() const { return m_DestinationRole; }; mitk::GenericIDRelationRule::GenericIDRelationRule(const RuleIDType &ruleIDTag) : GenericIDRelationRule(ruleIDTag, ruleIDTag + " relation"){}; mitk::GenericIDRelationRule::GenericIDRelationRule(const RuleIDType &ruleIDTag, const std::string &displayName) : GenericIDRelationRule( ruleIDTag, displayName, "source of " + ruleIDTag + " relation", "destination of " + ruleIDTag + " relation"){}; mitk::GenericIDRelationRule::GenericIDRelationRule(const RuleIDType &ruleIDTag, const std::string &displayName, const std::string &sourceRole, const std::string &destinationRole) : m_RuleIDTag(ruleIDTag), m_DisplayName(displayName), m_SourceRole(sourceRole), m_DestinationRole(destinationRole){}; mitk::GenericIDRelationRule::InstanceIDVectorType mitk::GenericIDRelationRule::GetInstanceID_datalayer( const IPropertyProvider *source, const IPropertyProvider *destination) const { // Data layer is not supported by the class. Therefor return empty vector. return InstanceIDVectorType(); }; bool mitk::GenericIDRelationRule::HasImplicitDataRelation(const IPropertyProvider *source, const IPropertyProvider *destination) const { // Data layer is not supported by the class. return false; }; void mitk::GenericIDRelationRule::Connect_datalayer(IPropertyOwner *source, const IPropertyProvider *destination, const InstanceIDType &instanceID) const { // Data layer is not supported by the class. => Do nothing }; void mitk::GenericIDRelationRule::Disconnect_datalayer(IPropertyOwner *source, const InstanceIDType &instanceID) const { // Data layer is not supported by the class. => Do nothing }; + +itk::LightObject::Pointer mitk::GenericIDRelationRule::InternalClone() const +{ + itk::LightObject::Pointer result = Self::New(this->m_RuleIDTag, this->m_DisplayName, this->m_SourceRole, this->m_DestinationRole); + + return result; +}; \ No newline at end of file diff --git a/Modules/Core/test/files.cmake b/Modules/Core/test/files.cmake index a66d2421b6..258a1d2183 100644 --- a/Modules/Core/test/files.cmake +++ b/Modules/Core/test/files.cmake @@ -1,202 +1,203 @@ # tests with no extra command line parameter set(MODULE_TESTS # IMPORTANT: If you plan to deactivate / comment out a test please write a bug number to the commented out line of code. # # Example: #mitkMyTest #this test is commented out because of bug 12345 # # It is important that the bug is open and that the test will be activated again before the bug is closed. This assures that # no test is forgotten after it was commented out. If there is no bug for your current problem, please add a new one and # mark it as critical. ################## DISABLED TESTS ################################################# #mitkAbstractTransformGeometryTest.cpp #seems as tested class mitkExternAbstractTransformGeometry doesnt exist any more #mitkStateMachineContainerTest.cpp #rewrite test, indirect since no longer exported Bug 14529 #mitkRegistrationBaseTest.cpp #tested class mitkRegistrationBase doesn't exist any more #mitkSegmentationInterpolationTest.cpp #file doesn't exist! #mitkPipelineSmartPointerCorrectnessTest.cpp #file doesn't exist! #mitkITKThreadingTest.cpp #test outdated because itk::Semaphore was removed from ITK #mitkAbstractTransformPlaneGeometryTest.cpp #mitkVtkAbstractTransformPlaneGeometry doesn't exist any more #mitkTestUtilSharedLibrary.cpp #Linker problem with this test... #mitkTextOverlay2DSymbolsRenderingTest.cpp #Implementation of the tested feature is not finished yet. Ask Christoph or see bug 15104 for details. ################# RUNNING TESTS ################################################### mitkAccessByItkTest.cpp mitkCoreObjectFactoryTest.cpp mitkDataNodeTest.cpp mitkMaterialTest.cpp mitkActionTest.cpp mitkDispatcherTest.cpp mitkEnumerationPropertyTest.cpp mitkFileReaderRegistryTest.cpp #mitkFileWriterRegistryTest.cpp mitkFloatToStringTest.cpp mitkGenericPropertyTest.cpp mitkGeometry3DTest.cpp mitkGeometry3DEqualTest.cpp mitkGeometryDataIOTest.cpp mitkGeometryDataToSurfaceFilterTest.cpp mitkImageCastTest.cpp mitkImageEqualTest.cpp mitkImageDataItemTest.cpp mitkImageGeneratorTest.cpp mitkIOUtilTest.cpp mitkBaseDataTest.cpp mitkImportItkImageTest.cpp mitkGrabItkImageMemoryTest.cpp mitkInstantiateAccessFunctionTest.cpp mitkLevelWindowTest.cpp mitkMessageTest.cpp mitkPixelTypeTest.cpp mitkPlaneGeometryTest.cpp mitkPointSetTest.cpp mitkPointSetEqualTest.cpp mitkPointSetFileIOTest.cpp mitkPointSetOnEmptyTest.cpp mitkPointSetLocaleTest.cpp mitkPointSetWriterTest.cpp mitkPointSetReaderTest.cpp mitkPointSetPointOperationsTest.cpp mitkProgressBarTest.cpp mitkPropertyTest.cpp mitkPropertyListTest.cpp mitkPropertyPersistenceTest.cpp mitkPropertyPersistenceInfoTest.cpp mitkPropertyRelationRuleBaseTest.cpp mitkSlicedGeometry3DTest.cpp mitkSliceNavigationControllerTest.cpp mitkSurfaceTest.cpp mitkSurfaceEqualTest.cpp mitkSurfaceToSurfaceFilterTest.cpp mitkTimeGeometryTest.cpp mitkProportionalTimeGeometryTest.cpp mitkUndoControllerTest.cpp mitkVtkWidgetRenderingTest.cpp mitkVerboseLimitedLinearUndoTest.cpp mitkWeakPointerTest.cpp mitkTransferFunctionTest.cpp mitkStepperTest.cpp mitkRenderingManagerTest.cpp mitkCompositePixelValueToStringTest.cpp vtkMitkThickSlicesFilterTest.cpp mitkNodePredicateSourceTest.cpp mitkNodePredicateDataPropertyTest.cpp mitkNodePredicateFunctionTest.cpp mitkVectorTest.cpp mitkClippedSurfaceBoundsCalculatorTest.cpp mitkExceptionTest.cpp mitkExtractSliceFilterTest.cpp mitkLogTest.cpp mitkImageDimensionConverterTest.cpp mitkLoggingAdapterTest.cpp mitkUIDGeneratorTest.cpp mitkPlanePositionManagerTest.cpp mitkAffineTransformBaseTest.cpp mitkPropertyAliasesTest.cpp mitkPropertyDescriptionsTest.cpp mitkPropertyExtensionsTest.cpp mitkPropertyFiltersTest.cpp mitkPropertyKeyPathTest.cpp mitkTinyXMLTest.cpp mitkRawImageFileReaderTest.cpp mitkInteractionEventTest.cpp mitkLookupTableTest.cpp mitkSTLFileReaderTest.cpp mitkPointTypeConversionTest.cpp mitkVectorTypeConversionTest.cpp mitkMatrixTypeConversionTest.cpp mitkArrayTypeConversionTest.cpp mitkSurfaceToImageFilterTest.cpp mitkBaseGeometryTest.cpp mitkImageToSurfaceFilterTest.cpp mitkEqualTest.cpp mitkLineTest.cpp mitkArbitraryTimeGeometryTest mitkItkImageIOTest.cpp mitkRotatedSlice4DTest.cpp mitkLevelWindowManagerCppUnitTest.cpp mitkVectorPropertyTest.cpp mitkTemporoSpatialStringPropertyTest.cpp mitkPropertyNameHelperTest.cpp mitkNodePredicateGeometryTest.cpp mitkPreferenceListReaderOptionsFunctorTest.cpp + mitkGenericIDRelationRuleTest.cpp ) if(MITK_ENABLE_RENDERING_TESTING) set(MODULE_TESTS ${MODULE_TESTS} mitkPlaneGeometryDataMapper2DTest.cpp mitkPointSetDataInteractorTest.cpp #since mitkInteractionTestHelper is currently creating a vtkRenderWindow mitkSurfaceVtkMapper2DTest.cpp #new rendering test in CppUnit style mitkSurfaceVtkMapper2D3DTest.cpp # comparisons/consistency 2D/3D ) endif() # test with image filename as an extra command line parameter set(MODULE_IMAGE_TESTS mitkImageTimeSelectorTest.cpp #only runs on images mitkImageAccessorTest.cpp #only runs on images ) set(MODULE_SURFACE_TESTS mitkSurfaceVtkWriterTest.cpp #only runs on surfaces ) # list of images for which the tests are run set(MODULE_TESTIMAGE US4DCyl.nrrd Pic3D.nrrd Pic2DplusT.nrrd BallBinary30x30x30.nrrd Png2D-bw.png ) set(MODULE_TESTSURFACE binary.stl ball.stl ) set(MODULE_CUSTOM_TESTS mitkDataStorageTest.cpp mitkDicomSeriesReaderTest.cpp mitkDICOMLocaleTest.cpp mitkDataNodeTest.cpp mitkEventConfigTest.cpp mitkPointSetLocaleTest.cpp mitkImageTest.cpp mitkImageVtkMapper2DTest.cpp mitkImageVtkMapper2DLevelWindowTest.cpp mitkImageVtkMapper2DOpacityTest.cpp mitkImageVtkMapper2DResliceInterpolationPropertyTest.cpp mitkImageVtkMapper2DColorTest.cpp mitkImageVtkMapper2DSwivelTest.cpp mitkImageVtkMapper2DTransferFunctionTest.cpp mitkImageVtkMapper2DOpacityTransferFunctionTest.cpp mitkImageVtkMapper2DLookupTableTest.cpp mitkSurfaceVtkMapper3DTest mitkSurfaceVtkMapper3DTexturedSphereTest.cpp mitkVolumeCalculatorTest.cpp mitkLevelWindowManagerTest.cpp mitkPointSetVtkMapper2DTest.cpp mitkPointSetVtkMapper2DImageTest.cpp mitkPointSetVtkMapper2DGlyphTypeTest.cpp mitkPointSetVtkMapper2DTransformedPointsTest.cpp mitkVTKRenderWindowSizeTest.cpp mitkMultiComponentImageDataComparisonFilterTest.cpp mitkImageToItkTest.cpp mitkImageSliceSelectorTest.cpp mitkSurfaceDepthPeelingTest.cpp ) # Currently not working on windows because of a rendering timing issue # see bug 18083 for details if(NOT WIN32) set(MODULE_CUSTOM_TESTS ${MODULE_CUSTOM_TESTS} mitkSurfaceDepthSortingTest.cpp) endif() set(RESOURCE_FILES Interactions/AddAndRemovePoints.xml Interactions/globalConfig.xml Interactions/StatemachineTest.xml Interactions/StatemachineConfigTest.xml ) diff --git a/Modules/Core/test/mitkGenericIDRelationRuleTest.cpp b/Modules/Core/test/mitkGenericIDRelationRuleTest.cpp new file mode 100644 index 0000000000..88da5c31f2 --- /dev/null +++ b/Modules/Core/test/mitkGenericIDRelationRuleTest.cpp @@ -0,0 +1,92 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ + +#include "mitkGenericIDRelationRule.h" + +#include "mitkDataNode.h" +#include "mitkStringProperty.h" + +#include "mitkTestFixture.h" +#include "mitkTestingMacros.h" + +class mitkGenericIDRelationRuleTestSuite : public mitk::TestFixture +{ + CPPUNIT_TEST_SUITE(mitkGenericIDRelationRuleTestSuite); + + MITK_TEST(GetRuleID); + MITK_TEST(GetDisplayName); + MITK_TEST(GetSourceRoleName); + MITK_TEST(GetDestinationRoleName); + MITK_TEST(Clone); + + CPPUNIT_TEST_SUITE_END(); + +private: + mitk::GenericIDRelationRule::Pointer rule_new1; + mitk::GenericIDRelationRule::Pointer rule_new2; + mitk::GenericIDRelationRule::Pointer rule_new4; + +public: + void setUp() override + { + rule_new1 = mitk::GenericIDRelationRule::New("TestID"); + rule_new2 = mitk::GenericIDRelationRule::New("TestID2", "display name"); + rule_new4 = mitk::GenericIDRelationRule::New("TestID4", "display name 4", "srole", "drole"); + } + + void tearDown() override {} + + void GetRuleID() + { + CPPUNIT_ASSERT(rule_new1->GetRuleID() == "IDRelation_TestID"); + CPPUNIT_ASSERT(rule_new2->GetRuleID() == "IDRelation_TestID2"); + CPPUNIT_ASSERT(rule_new4->GetRuleID() == "IDRelation_TestID4"); + } + + void GetDisplayName() + { + CPPUNIT_ASSERT(rule_new1->GetDisplayName() == "TestID relation"); + CPPUNIT_ASSERT(rule_new2->GetDisplayName() == "display name"); + CPPUNIT_ASSERT(rule_new4->GetDisplayName() == "display name 4"); + } + + void GetSourceRoleName() + { + CPPUNIT_ASSERT(rule_new1->GetSourceRoleName() == "source of TestID relation"); + CPPUNIT_ASSERT(rule_new2->GetSourceRoleName() == "source of TestID2 relation"); + CPPUNIT_ASSERT(rule_new4->GetSourceRoleName() == "srole"); + } + + void GetDestinationRoleName() + { + CPPUNIT_ASSERT(rule_new1->GetDestinationRoleName() == "destination of TestID relation"); + CPPUNIT_ASSERT(rule_new2->GetDestinationRoleName() == "destination of TestID2 relation"); + CPPUNIT_ASSERT(rule_new4->GetDestinationRoleName() == "drole"); + } + + void Clone() + { + auto clone = rule_new4->Clone(); + + CPPUNIT_ASSERT(clone->GetRuleID() == "IDRelation_TestID4"); + CPPUNIT_ASSERT(clone->GetDisplayName() == "display name 4"); + CPPUNIT_ASSERT(clone->GetSourceRoleName() == "srole"); + CPPUNIT_ASSERT(clone->GetDestinationRoleName() == "drole"); + } + +}; + +MITK_TEST_SUITE_REGISTRATION(mitkGenericIDRelationRule)