VTK
|
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 00115 static int InteractorEventLoop( int argc, char *argv[], 00116 vtkRenderWindowInteractor *iren, const char *stream = NULL ); 00118 00119 //ETX 00120 00122 00123 vtkSetClampMacro(FrontBuffer, int, 0, 1); 00124 vtkBooleanMacro(FrontBuffer, int); 00125 vtkGetMacro(FrontBuffer, int); 00127 00129 00131 virtual int RegressionTest(double thresh); 00132 virtual int RegressionTest(double thresh,ostream &os); 00134 00136 00138 virtual int RegressionTest(const std::string &pngFileName, double thresh); 00139 virtual int RegressionTest(const std::string &pngFileName, 00140 double thresh, ostream& os); 00142 00144 00145 virtual int RegressionTest(vtkAlgorithm* imageSource, double thresh); 00146 virtual int RegressionTest(vtkAlgorithm* imageSource, double thresh, ostream& os); 00148 00153 int CompareAverageOfL2Norm(vtkDataSet *pdA, vtkDataSet *pdB, double tol); 00156 int CompareAverageOfL2Norm(vtkDataArray *daA, vtkDataArray *daB, double tol); 00157 00159 00161 virtual void SetRenderWindow(vtkRenderWindow* rw); 00162 vtkGetObjectMacro(RenderWindow, vtkRenderWindow); 00164 00166 00167 vtkSetStringMacro(ValidImageFileName); 00168 const char *GetValidImageFileName(); 00170 00172 00173 vtkGetMacro(ImageDifference, double); 00175 00177 00182 void AddArgument(const char *argv); 00183 void AddArguments(int argc,const char **argv); 00185 00186 //BTX 00188 00191 char *GetArgument(const char *arg); 00192 //ETX 00194 00197 void CleanArguments(); 00198 00200 00201 const char *GetDataRoot(); 00202 vtkSetStringMacro(DataRoot); 00204 00206 00207 const char *GetTempDirectory(); 00208 vtkSetStringMacro(TempDirectory); 00210 00212 int IsValidImageSpecified(); 00213 00215 int IsInteractiveModeSpecified(); 00216 00218 int IsFlagSpecified(const char *flag); 00219 00221 00223 vtkSetMacro(BorderOffset, int); 00224 vtkGetMacro(BorderOffset, int); 00226 00228 00229 vtkSetMacro(Verbose, int); 00230 vtkGetMacro(Verbose, int); 00232 00233 protected: 00234 vtkTesting(); 00235 ~vtkTesting(); 00236 00237 static char* IncrementFileName(const char* fname, int count); 00238 static int LookForFile(const char* newFileName); 00239 00240 int FrontBuffer; 00241 vtkRenderWindow* RenderWindow; 00242 char* ValidImageFileName; 00243 double ImageDifference; 00244 char *TempDirectory; 00245 int BorderOffset; 00246 int Verbose; 00247 00248 //BTX 00249 std::vector<std::string> Args; 00250 //ETX 00251 char *DataRoot; 00252 double StartWallTime; 00253 double StartCPUTime; 00254 00255 private: 00256 vtkTesting(const vtkTesting&); // Not implemented. 00257 void operator=(const vtkTesting&); // Not implemented. 00258 }; 00259 00260 #endif 00261 00262