VTK
dox/Rendering/vtkTesting.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkTesting.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00067 #ifndef __vtkTesting_h
00068 #define __vtkTesting_h
00069 
00070 #include "vtkObject.h"
00071 #include <vector> // STL Header used for argv
00072 #include <string> // STL Header used for argv
00073 
00074 class vtkRenderWindow;
00075 class vtkImageData;
00076 class vtkDataArray;
00077 class vtkDataSet;
00078 class vtkRenderWindowInteractor;
00079 
00080 class VTK_RENDERING_EXPORT vtkTesting : public vtkObject
00081 {
00082 public:
00083   static vtkTesting *New();
00084   vtkTypeMacro(vtkTesting,vtkObject);
00085   void PrintSelf(ostream& os, vtkIndent indent);
00086 
00087 //BTX
00088   enum ReturnValue {
00089     FAILED = 0,
00090     PASSED = 1,
00091     NOT_RUN = 2,
00092     DO_INTERACTOR = 3
00093   };
00094 
00095   static int Test(int argc, char *argv[], vtkRenderWindow *rw, double thresh);
00096 
00098 
00116   static int InteractorEventLoop( int argc, char *argv[], 
00117       vtkRenderWindowInteractor *iren, const char *stream = NULL );
00119   
00120 //ETX
00121   
00123 
00124   vtkSetClampMacro(FrontBuffer, int, 0, 1);
00125   vtkBooleanMacro(FrontBuffer, int);
00126   vtkGetMacro(FrontBuffer, int);
00128 
00130 
00132   virtual int RegressionTest(double thresh);
00133   virtual int RegressionTest(double thresh,ostream &os);
00135 
00137 
00138   virtual int RegressionTest(vtkImageData* image, double thresh);
00139   virtual int RegressionTest(vtkImageData* image, double thresh, ostream& os);
00141 
00146   int CompareAverageOfL2Norm(vtkDataSet *pdA, vtkDataSet *pdB, double tol);
00149   int CompareAverageOfL2Norm(vtkDataArray *daA, vtkDataArray *daB, double tol);
00150 
00152 
00154   virtual void SetRenderWindow(vtkRenderWindow* rw);
00155   vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
00157 
00159 
00160   vtkSetStringMacro(ValidImageFileName);
00161   const char *GetValidImageFileName();
00163 
00165 
00166   vtkGetMacro(ImageDifference, double);
00168 
00170 
00175   void AddArgument(const char *argv);
00176   void AddArguments(int argc,const char **argv);
00178 
00179   //BTX
00181 
00184   char *GetArgument(const char *arg);
00185   //ETX 
00187 
00190   void CleanArguments();
00191   
00193 
00194   const char *GetDataRoot();
00195   vtkSetStringMacro(DataRoot);
00197 
00199 
00200   const char *GetTempDirectory();
00201   vtkSetStringMacro(TempDirectory);
00203 
00205   int IsValidImageSpecified();
00206 
00208   int IsInteractiveModeSpecified();
00209 
00211   int IsFlagSpecified(const char *flag);
00212 
00214 
00216   vtkSetMacro(BorderOffset, int);
00217   vtkGetMacro(BorderOffset, int);
00219 
00221 
00222   vtkSetMacro(Verbose, int);
00223   vtkGetMacro(Verbose, int);  
00225 
00226 protected:
00227   vtkTesting();
00228   ~vtkTesting();
00229 
00230   static char* IncrementFileName(const char* fname, int count);
00231   static int LookForFile(const char* newFileName);
00232 
00233   int FrontBuffer;
00234   vtkRenderWindow* RenderWindow;
00235   char* ValidImageFileName;
00236   double ImageDifference;
00237   char *TempDirectory;
00238   int BorderOffset;
00239   int Verbose;
00240   
00241 //BTX
00242   std::vector<std::string> Args;
00243 //ETX
00244   char *DataRoot;
00245   double StartWallTime;
00246   double StartCPUTime;
00247   
00248 private:
00249   vtkTesting(const vtkTesting&);  // Not implemented.
00250   void operator=(const vtkTesting&);  // Not implemented.
00251 };
00252 
00253 #endif
00254 
00255