diff --git a/Core/Code/Testing/mitkPicFileWriterTest.cpp b/Core/Code/Testing/mitkPicFileWriterTest.cpp index 8fc6244a9c..c526be2809 100644 --- a/Core/Code/Testing/mitkPicFileWriterTest.cpp +++ b/Core/Code/Testing/mitkPicFileWriterTest.cpp @@ -1,113 +1,113 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision: 7837 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "mitkPicFileWriter.h" #include "mitkDataNodeFactory.h" #include "mitkTestingMacros.h" /** * Simple example for a test for the (non-existent) class "PicFileWriter". * * argc and argv are the command line parameters which were passed to * the ADD_TEST command in the CMakeLists.txt file. For the automatic * tests, argv is either empty for the simple tests or contains the filename * of a test image for the image tests (see CMakeLists.txt). */ int mitkPicFileWriterTest(int argc , char* argv[]) { // always start with this! MITK_TEST_BEGIN("PicFileWriter") // let's create an object of our class mitk::PicFileWriter::Pointer myPicFileWriter = mitk::PicFileWriter::New(); // first test: did this work? // using MITK_TEST_CONDITION_REQUIRED makes the test stop after failure, since // it makes no sense to continue without an object. MITK_TEST_CONDITION_REQUIRED(myPicFileWriter.IsNotNull(),"Testing instantiation") // load image std::cout << "Loading file: " << std::flush; if(argc==0) { std::cout<<"no file specified [FAILED]"<SetInput(image); + myPicFileWriter->SetInputImage(image); myPicFileWriter->SetFileName("/usr/bin"); myPicFileWriter->Update(); MITK_TEST_FOR_EXCEPTION_END(itk::ExceptionObject) } catch(...) { std::cout << "Success: Writer warns on NULL image." << std::endl; } mitk::DataNodeFactory::Pointer factory = mitk::DataNodeFactory::New(); try { std::cout<SetFileName( argv[1] ); factory->Update(); if(factory->GetNumberOfOutputs()<1) { std::cout<<"file could not be loaded [FAILED]"<GetOutput( 0 ); image = dynamic_cast(node->GetData()); if(image.IsNull()) { std::cout<<"file "<< argv[1]<< "is not an image - test will not be applied [PASSED]"<SetInput(image); + myPicFileWriter->SetInputImage(image); myPicFileWriter->SetFileName("/usr/bin"); myPicFileWriter->Update(); MITK_TEST_FOR_EXCEPTION_END(itk::ExceptionObject) } catch(...) { //this means that a wrong exception (i.e. no itk:Exception) has been thrown std::cout << "Wrong exception (i.e. no itk:Exception) caught during write [FAILED]" << std::endl; return EXIT_FAILURE; } // always end with this! MITK_TEST_END() }