text: /*=========================================================================
  
   Program: MAF2
   Module: mafPipeVolumeProjectedTest
   Authors: Roberto Mucci
   
   Copyright (c) B3C
   All rights reserved. See Copyright.txt or
   http://www.scsitaly.com/Copyright.htm 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 notice for more information.
  
  =========================================================================*/
  
  #ifndef __CPP_UNIT_mafPipeVolumeProjectedTest_H__
  #define __CPP_UNIT_mafPipeVolumeProjectedTest_H__
  
  #include <cppunit/extensions/HelperMacros.h>
  #include <cppunit/BriefTestProgressListener.h>
  #include <cppunit/CompilerOutputter.h>
  #include <cppunit/extensions/TestFactoryRegistry.h>
  #include <cppunit/TestResult.h>
  #include <cppunit/TestResultCollector.h>
  #include <cppunit/TestRunner.h>
  
  class vtkPolyData;
  class vtkRenderer;
  class vtkRenderWindow;
  class vtkRenderWindowInteractor;
  class vtkProp;
  class vtkPropCollection;
  
  class mafPipeVolumeProjectedTest : public CPPUNIT_NS::TestFixture
  {
  public: 
    // CPPUNIT fixture: executed before each test
    void setUp();
  
    // CPPUNIT fixture: executed after each test
    void tearDown();
  
    CPPUNIT_TEST_SUITE( mafPipeVolumeProjectedTest );
    CPPUNIT_TEST( TestFixture ); // just to test that the fixture has no leaks
    CPPUNIT_TEST( TestPipeExecution );
    CPPUNIT_TEST_SUITE_END();
  
  protected:
    void TestFixture();
    void TestPipeExecution();
  
    vtkRenderer *m_Renderer;
    vtkRenderWindow *m_RenderWindow;
    vtkRenderWindowInteractor *m_RenderWindowInteractor;
  
    /**Compare a list of already saved images (control images) with renderized image from render window
    @imageIndex: index X of the image. Original Image is imageX.jpg, created imaged is compX.jpg
    */
    void CompareImages(int imageIndex);
  
    /** Select The Actor that will be controlled*/
    vtkProp *SelectActorToControl(vtkPropCollection* propList, int index);
  };
  
  
  int
  main( int argc, char* argv[] )
  {
    // Create the event manager and test controller
    CPPUNIT_NS::TestResult controller;
  
    // Add a listener that colllects test result
    CPPUNIT_NS::TestResultCollector result;
    controller.addListener( &result );        
  
    // Add a listener that print dots as test run.
    CPPUNIT_NS::BriefTestProgressListener progress;
    controller.addListener( &progress );      
  
    // Add the top suite to the test runner
    CPPUNIT_NS::TestRunner runner;
    runner.addTest( mafPipeVolumeProjectedTest::suite());
    runner.run( controller );
  
    // Print test in a compiler compatible format.
    CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
    outputter.write(); 
  
    return result.wasSuccessful() ? 0 : 1;
  }
  
  #endif
  