VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Testing/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 =========================================================================*/
00064 #ifndef vtkTesting_h
00065 #define vtkTesting_h
00066 
00067 #include "vtkTestingRenderingModule.h" // For export macro
00068 #include "vtkObject.h"
00069 #include <vector> // STL Header used for argv
00070 #include <string> // STL Header used for argv
00071 
00072 class vtkAlgorithm;
00073 class vtkRenderWindow;
00074 class vtkImageData;
00075 class vtkDataArray;
00076 class vtkDataSet;
00077 class vtkRenderWindowInteractor;
00078 
00079 class VTKTESTINGRENDERING_EXPORT vtkTesting : public vtkObject
00080 {
00081 public:
00082   static vtkTesting *New();
00083   vtkTypeMacro(vtkTesting,vtkObject);
00084   void PrintSelf(ostream& os, vtkIndent indent);
00085 
00086 //BTX
00087   enum ReturnValue {
00088     FAILED = 0,
00089     PASSED = 1,
00090     NOT_RUN = 2,
00091     DO_INTERACTOR = 3
00092   };
00093 
00094   static int Test(int argc, char *argv[], vtkRenderWindow *rw, double thresh);
00095 
00097 
00124   static int InteractorEventLoop(int argc, char *argv[],
00125                                  vtkRenderWindowInteractor *iren,
00126                                  const char *stream = NULL);
00128 
00129 //ETX
00130 
00132 
00135   vtkSetClampMacro(FrontBuffer, int, 0, 1);
00136   vtkBooleanMacro(FrontBuffer, int);
00137   vtkGetMacro(FrontBuffer, int);
00139 
00142   virtual int RegressionTest(double thresh);
00143 
00147   virtual int RegressionTestAndCaptureOutput(double thresh, ostream &os);
00148 
00153   virtual int RegressionTest(double thresh,ostream &os);
00154 
00156 
00158   virtual int RegressionTest(const std::string &pngFileName, double thresh);
00159   virtual int RegressionTest(const std::string &pngFileName,
00160                              double thresh, ostream& os);
00162 
00164 
00165   virtual int RegressionTest(vtkAlgorithm* imageSource, double thresh);
00166   virtual int RegressionTest(vtkAlgorithm* imageSource, double thresh,
00167                              ostream& os);
00169 
00174   int CompareAverageOfL2Norm(vtkDataSet *pdA, vtkDataSet *pdB, double tol);
00175 
00178   int CompareAverageOfL2Norm(vtkDataArray *daA, vtkDataArray *daB, double tol);
00179 
00181 
00183   virtual void SetRenderWindow(vtkRenderWindow* rw);
00184   vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
00186 
00188 
00189   vtkSetStringMacro(ValidImageFileName);
00190   const char *GetValidImageFileName();
00192 
00194 
00195   vtkGetMacro(ImageDifference, double);
00197 
00199 
00204   void AddArgument(const char *argv);
00205   void AddArguments(int argc,const char **argv);
00206   void AddArguments(int argc, char **argv);
00208 
00209   //BTX
00211 
00214   char *GetArgument(const char *arg);
00215   //ETX
00217 
00220   void CleanArguments();
00221 
00223 
00224   const char *GetDataRoot();
00225   vtkSetStringMacro(DataRoot);
00227 
00229 
00230   const char *GetTempDirectory();
00231   vtkSetStringMacro(TempDirectory);
00233 
00235   int IsValidImageSpecified();
00236 
00238   int IsInteractiveModeSpecified();
00239 
00241   int IsFlagSpecified(const char *flag);
00242 
00244 
00246   vtkSetMacro(BorderOffset, int);
00247   vtkGetMacro(BorderOffset, int);
00249 
00251 
00252   vtkSetMacro(Verbose, int);
00253   vtkGetMacro(Verbose, int);
00255 
00256 protected:
00257   vtkTesting();
00258   ~vtkTesting();
00259 
00260   static char* IncrementFileName(const char* fname, int count);
00261   static int LookForFile(const char* newFileName);
00262 
00263   int FrontBuffer;
00264   vtkRenderWindow* RenderWindow;
00265   char* ValidImageFileName;
00266   double ImageDifference;
00267   char *TempDirectory;
00268   int BorderOffset;
00269   int Verbose;
00270 
00271 //BTX
00272   std::vector<std::string> Args;
00273 //ETX
00274   char *DataRoot;
00275   double StartWallTime;
00276   double StartCPUTime;
00277 
00278 private:
00279   vtkTesting(const vtkTesting&);  // Not implemented.
00280   void operator=(const vtkTesting&);  // Not implemented.
00281 };
00282 
00283 #endif
00284 
00285