diff --git a/Modules/Overlays/test/files.cmake b/Modules/Overlays/test/files.cmake index 1ed23e2999..6e5e67975e 100644 --- a/Modules/Overlays/test/files.cmake +++ b/Modules/Overlays/test/files.cmake @@ -1,9 +1,12 @@ set(MODULE_CUSTOM_TESTS mitkLabelOverlay3DRendering2DTest.cpp mitkLabelOverlay3DRendering3DTest.cpp mitkTextOverlay2DRenderingTest.cpp mitkTextOverlay2DLayouterRenderingTest.cpp mitkTextOverlay3DRendering2DTest.cpp mitkTextOverlay3DRendering3DTest.cpp mitkTextOverlay3DColorRenderingTest.cpp ) +set(MODULE_TESTS + mitkOverlaysTest.cpp +) diff --git a/Modules/Overlays/test/mitkOverlaysTest.cpp b/Modules/Overlays/test/mitkOverlaysTest.cpp new file mode 100644 index 0000000000..8de2211c62 --- /dev/null +++ b/Modules/Overlays/test/mitkOverlaysTest.cpp @@ -0,0 +1,68 @@ +/*=================================================================== + +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 +#include +#include +#include +#include +#include +#include + +#include "mitkAnnotationPlacer.h" +#include "mitkOverlayLayouter2D.h" + + +class mitkOverlaysTestSuite : public mitk::TestFixture +{ + CPPUNIT_TEST_SUITE(mitkOverlaysTestSuite); + MITK_TEST(AnnotationServiceTest); + CPPUNIT_TEST_SUITE_END(); + +private: + +public: + + void setUp() override + { + } + + void AnnotationServiceTest() + { + mitk::AnnotationPlacer* ap1_test1 = mitk::AnnotationPlacer::GetAnnotationRenderer("test1"); + CPPUNIT_ASSERT_MESSAGE("Testing availability of AnnotationPlacer service", ap1_test1); + mitk::AnnotationPlacer* ap2_test1 = mitk::AnnotationPlacer::GetAnnotationRenderer("test1"); + CPPUNIT_ASSERT_MESSAGE("Testing if AnnotationPlacer of same kind stays avaliable", ap1_test1 == ap2_test1); + mitk::AnnotationPlacer* ap1_test2 = mitk::AnnotationPlacer::GetAnnotationRenderer("test2"); + CPPUNIT_ASSERT_MESSAGE("Testing if new instance can be created by using different ID", ap1_test2 != ap1_test1); + + mitk::OverlayLayouter2D* ol1_test1 = mitk::OverlayLayouter2D::GetAnnotationRenderer("test1"); + CPPUNIT_ASSERT_MESSAGE("Testing availability of OverlayLayouter2D service", ol1_test1); + mitk::OverlayLayouter2D* ol2_test1 = mitk::OverlayLayouter2D::GetAnnotationRenderer("test1"); + CPPUNIT_ASSERT_MESSAGE("Testing if OverlayLayouter2D of same kind stays avaliable", ol2_test1 == ol1_test1); + mitk::OverlayLayouter2D* ol1_test2 = mitk::OverlayLayouter2D::GetAnnotationRenderer("test2"); + CPPUNIT_ASSERT_MESSAGE("Testing if new instance can be created by using different ID", ol1_test2 != ol1_test1); + + CPPUNIT_ASSERT_MESSAGE("Testing if OverlayLayouter2D and AnnotationPlacer services are different", + (mitk::AbstractAnnotationRenderer*)ol1_test1 != (mitk::AbstractAnnotationRenderer*)ap1_test1); + + } + + void OverlayTest() + { + + } +}; +MITK_TEST_SUITE_REGISTRATION(mitkOverlays)