diff --git a/Core/Code/Testing/files.cmake b/Core/Code/Testing/files.cmake index 890cad1254..2b853ec20e 100644 --- a/Core/Code/Testing/files.cmake +++ b/Core/Code/Testing/files.cmake @@ -1,158 +1,158 @@ # tests with no extra command line parameter set(MODULE_TESTS mitkAccessByItkTest.cpp mitkCoreObjectFactoryTest.cpp mitkMaterialTest.cpp mitkActionTest.cpp mitkDispatcherTest.cpp mitkEnumerationPropertyTest.cpp mitkEventTest.cpp mitkFocusManagerTest.cpp mitkGenericPropertyTest.cpp mitkGeometry3DTest.cpp mitkGeometry3DEqualTest.cpp mitkGeometryDataToSurfaceFilterTest.cpp mitkGlobalInteractionTest.cpp - mitkImageAreEqualTest.cpp + mitkImageEqualTest.cpp mitkImageDataItemTest.cpp #mitkImageMapper2DTest.cpp mitkImageGeneratorTest.cpp mitkBaseDataTest.cpp #mitkImageToItkTest.cpp mitkImportItkImageTest.cpp mitkGrabItkImageMemoryTest.cpp mitkInstantiateAccessFunctionTest.cpp mitkInteractorTest.cpp #mitkITKThreadingTest.cpp mitkLevelWindowTest.cpp mitkMessageTest.cpp #mitkPipelineSmartPointerCorrectnessTest.cpp mitkPixelTypeTest.cpp mitkPlaneGeometryTest.cpp mitkPointSetFileIOTest.cpp mitkPointSetTest.cpp mitkPointSetWriterTest.cpp mitkPointSetReaderTest.cpp mitkPointSetInteractorTest.cpp mitkPropertyTest.cpp mitkPropertyListTest.cpp #mitkRegistrationBaseTest.cpp #mitkSegmentationInterpolationTest.cpp mitkSlicedGeometry3DTest.cpp mitkSliceNavigationControllerTest.cpp mitkStateMachineTest.cpp ##mitkStateMachineContainerTest.cpp ## rewrite test, indirect since no longer exported Bug 14529 mitkStateTest.cpp mitkSurfaceTest.cpp mitkSurfaceToSurfaceFilterTest.cpp mitkTimeSlicedGeometryTest.cpp mitkTransitionTest.cpp mitkUndoControllerTest.cpp mitkVtkWidgetRenderingTest.cpp mitkVerboseLimitedLinearUndoTest.cpp mitkWeakPointerTest.cpp mitkTransferFunctionTest.cpp #mitkAbstractTransformGeometryTest.cpp mitkStepperTest.cpp itkTotalVariationDenoisingImageFilterTest.cpp mitkRenderingManagerTest.cpp vtkMitkThickSlicesFilterTest.cpp mitkNodePredicateSourceTest.cpp mitkVectorTest.cpp mitkClippedSurfaceBoundsCalculatorTest.cpp mitkExceptionTest.cpp mitkExtractSliceFilterTest.cpp mitkLogTest.cpp mitkImageDimensionConverterTest.cpp mitkLoggingAdapterTest.cpp mitkUIDGeneratorTest.cpp mitkShaderRepositoryTest.cpp mitkPlanePositionManagerTest.cpp mitkAffineTransformBaseTest.cpp mitkPropertyAliasesTest.cpp mitkPropertyDescriptionsTest.cpp mitkPropertyExtensionsTest.cpp mitkPropertyFiltersTest.cpp ) # 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 mitkDataNodeFactoryTest.cpp #runs on all types of data ) set(MODULE_SURFACE_TESTS mitkSurfaceVtkWriterTest.cpp #only runs on surfaces mitkDataNodeFactoryTest.cpp #runs on all types of data ) # list of images for which the tests are run set(MODULE_TESTIMAGES US4DCyl.nrrd Pic3D.nrrd Pic2DplusT.nrrd BallBinary30x30x30.nrrd Png2D-bw.png ) set(MODULE_TESTSURFACES binary.stl ball.stl ) set(MODULE_CUSTOM_TESTS #mitkLabeledImageToSurfaceFilterTest.cpp #mitkExternalToolsTest.cpp mitkDataStorageTest.cpp mitkDataNodeTest.cpp mitkDicomSeriesReaderTest.cpp mitkDICOMLocaleTest.cpp mitkEventMapperTest.cpp mitkEventConfigTest.cpp mitkNodeDependentPointSetInteractorTest.cpp mitkStateMachineFactoryTest.cpp mitkPointSetLocaleTest.cpp mitkImageTest.cpp mitkImageWriterTest.cpp mitkImageVtkMapper2DTest.cpp mitkImageVtkMapper2DLevelWindowTest.cpp mitkImageVtkMapper2DOpacityTest.cpp mitkImageVtkMapper2DResliceInterpolationPropertyTest.cpp mitkImageVtkMapper2DColorTest.cpp mitkImageVtkMapper2DSwivelTest.cpp mitkImageVtkMapper2DTransferFunctionTest.cpp mitkIOUtilTest.cpp mitkSurfaceVtkMapper3DTest mitkSurfaceVtkMapper3DTexturedSphereTest.cpp mitkSurfaceGLMapper2DColorTest.cpp mitkSurfaceGLMapper2DOpacityTest.cpp mitkVolumeCalculatorTest.cpp mitkLevelWindowManagerTest.cpp mitkPointSetVtkMapper2DTest.cpp mitkPointSetVtkMapper2DImageTest.cpp mitkPointSetVtkMapper2DGlyphTypeTest.cpp ) set(MODULE_RESOURCE_FILES Interactions/AddAndRemovePoints.xml Interactions/globalConfig.xml Interactions/StatemachineTest.xml Interactions/StatemachineConfigTest.xml ) # Create an artificial module initializing class for # the usServiceListenerTest.cpp usFunctionGenerateExecutableInit(testdriver_init_file IDENTIFIER ${MODULE_NAME}TestDriver ) # Embed the resources set(testdriver_resources ) usFunctionEmbedResources(testdriver_resources EXECUTABLE_NAME ${MODULE_NAME}TestDriver ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Resources FILES ${MODULE_RESOURCE_FILES} ) set(TEST_CPP_FILES ${testdriver_init_file} ${testdriver_resources}) diff --git a/Core/Code/Testing/mitkImageAreEqualTest.cpp b/Core/Code/Testing/mitkImageEqualTest.cpp similarity index 65% rename from Core/Code/Testing/mitkImageAreEqualTest.cpp rename to Core/Code/Testing/mitkImageEqualTest.cpp index b844aaf6ef..0da9291dc6 100644 --- a/Core/Code/Testing/mitkImageAreEqualTest.cpp +++ b/Core/Code/Testing/mitkImageEqualTest.cpp @@ -1,123 +1,123 @@ /*=================================================================== 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 "mitkImage.h" #include "mitkImageGenerator.h" #include "mitkTestingMacros.h" #include mitk::Image::Pointer m_Image; mitk::Image::Pointer m_AnotherImage; /** * @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the two used members for a new test case. */ static void Setup() { //generate a gradient test image m_Image = mitk::ImageGenerator::GenerateGradientImage(3u, 3u, 1u); m_AnotherImage = m_Image->Clone(); } static void AreEqual_CloneAndOriginal_ReturnsTrue() { Setup(); - MITK_TEST_CONDITION_REQUIRED( mitk::Image::AreEqual( m_Image, m_AnotherImage), "A clone should be equal to its original."); + MITK_TEST_CONDITION_REQUIRED( mitk::Equal( m_Image, m_AnotherImage), "A clone should be equal to its original."); } static void AreEqual_InputIsNull_ReturnsFalse() { Setup(); m_Image = NULL; m_AnotherImage = NULL; - MITK_TEST_CONDITION_REQUIRED( !mitk::Image::AreEqual( m_Image, m_AnotherImage), "Input is NULL. Result should be false."); + MITK_TEST_CONDITION_REQUIRED( !mitk::Equal( m_Image, m_AnotherImage), "Input is NULL. Result should be false."); } static void AreEqual_DifferentImageGeometry_ReturnsFalse() { Setup(); mitk::Point3D origin; origin[0] = 0.0; origin[1] = 0.0; origin[2] = mitk::eps * 1.01; m_AnotherImage->GetGeometry()->SetOrigin(origin); - MITK_TEST_CONDITION_REQUIRED( !mitk::Image::AreEqual( m_Image, m_AnotherImage), "One origin was modified. Result should be false."); + MITK_TEST_CONDITION_REQUIRED( !mitk::Equal( m_Image, m_AnotherImage), "One origin was modified. Result should be false."); } static void AreEqual_DifferentPixelTypes_ReturnsFalse() { Setup(); m_AnotherImage = mitk::ImageGenerator::GenerateGradientImage(3u, 3u, 1u); - MITK_TEST_CONDITION_REQUIRED( !mitk::Image::AreEqual( m_Image, m_AnotherImage), "One pixel type is float, the other unsigned char. Result should be false."); + MITK_TEST_CONDITION_REQUIRED( !mitk::Equal( m_Image, m_AnotherImage), "One pixel type is float, the other unsigned char. Result should be false."); } static void AreEqual_DifferentDimensions_ReturnsFalse() { Setup(); m_AnotherImage = mitk::ImageGenerator::GenerateGradientImage(5u, 7u, 3u); - MITK_TEST_CONDITION_REQUIRED( !mitk::Image::AreEqual( m_Image, m_AnotherImage), "Dimensions of first image are: (3, 3, 1). Dimensions of second image are: (5, 7, 3). Result should be false."); + MITK_TEST_CONDITION_REQUIRED( !mitk::Equal( m_Image, m_AnotherImage), "Dimensions of first image are: (3, 3, 1). Dimensions of second image are: (5, 7, 3). Result should be false."); } static void AreEqual_DifferentDimensionalities_ReturnsFalse() { Setup(); //Select the first slice of a 2D image and compare it to the 3D original mitk::ImageSliceSelector::Pointer sliceSelector = mitk::ImageSliceSelector::New(); sliceSelector->SetInput( m_Image ); sliceSelector->SetSliceNr( 0 ); sliceSelector->Update(); m_AnotherImage = sliceSelector->GetOutput(); - MITK_TEST_CONDITION_REQUIRED( !mitk::Image::AreEqual( m_Image, m_AnotherImage), "First image is 3D. Second image is 2D. Result should be false."); + MITK_TEST_CONDITION_REQUIRED( !mitk::Equal( m_Image, m_AnotherImage), "First image is 3D. Second image is 2D. Result should be false."); } static void AreEqual_DifferentPixelValues_ReturnsFalse() { m_Image = mitk::ImageGenerator::GenerateRandomImage(3u, 3u); m_AnotherImage = mitk::ImageGenerator::GenerateRandomImage(3u, 3u); - MITK_TEST_CONDITION_REQUIRED( !mitk::Image::AreEqual( m_Image, m_AnotherImage), "We compare two random images. Result should be false."); + MITK_TEST_CONDITION_REQUIRED( !mitk::Equal( m_Image, m_AnotherImage), "We compare two random images. Result should be false."); } /** * @brief mitkImageAreEqualTest A test class for AreEqual methods in mitk::Image. */ -int mitkImageAreEqualTest(int /*argc*/, char* /*argv*/[]) +int mitkImageEqualTest(int /*argc*/, char* /*argv*/[]) { MITK_TEST_BEGIN(mitkImageAreEqualTest); -// AreEqual_CloneAndOriginal_ReturnsTrue(); -// AreEqual_InputIsNull_ReturnsFalse(); -// AreEqual_DifferentImageGeometry_ReturnsFalse(); -// AreEqual_DifferentPixelTypes_ReturnsFalse(); -// AreEqual_DifferentDimensions_ReturnsFalse(); -// AreEqual_DifferentDimensionalities_ReturnsFalse(); + AreEqual_CloneAndOriginal_ReturnsTrue(); + AreEqual_InputIsNull_ReturnsFalse(); + AreEqual_DifferentImageGeometry_ReturnsFalse(); + AreEqual_DifferentPixelTypes_ReturnsFalse(); + AreEqual_DifferentDimensions_ReturnsFalse(); + AreEqual_DifferentDimensionalities_ReturnsFalse(); AreEqual_DifferentPixelValues_ReturnsFalse(); MITK_TEST_END(); return EXIT_SUCCESS; }