VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkTesting.h,v $ 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 "vtkObject.h" 00068 #include <vtkstd/vector> // used for argv 00069 #include <vtkstd/string> // used for argv 00070 00071 class vtkRenderWindow; 00072 class vtkImageData; 00073 class vtkDataArray; 00074 class vtkDataSet; 00075 00076 class VTK_RENDERING_EXPORT vtkTesting : public vtkObject 00077 { 00078 public: 00079 static vtkTesting *New(); 00080 vtkTypeRevisionMacro(vtkTesting,vtkObject); 00081 void PrintSelf(ostream& os, vtkIndent indent); 00082 00083 //BTX 00084 enum ReturnValue { 00085 FAILED = 0, 00086 PASSED = 1, 00087 NOT_RUN = 2, 00088 DO_INTERACTOR = 3 00089 }; 00090 00091 static int Test(int argc, char *argv[], vtkRenderWindow *rw, double thresh); 00092 //ETX 00093 00095 00096 vtkSetClampMacro(FrontBuffer, int, 0, 1); 00097 vtkBooleanMacro(FrontBuffer, int); 00098 vtkGetMacro(FrontBuffer, int); 00100 00102 00104 virtual int RegressionTest(double thresh); 00105 virtual int RegressionTest(double thresh,ostream &os); 00107 00109 00110 virtual int RegressionTest(vtkImageData* image, double thresh); 00111 virtual int RegressionTest(vtkImageData* image, double thresh, ostream& os); 00113 00115 00119 int CompareAverageOfL2Norm(vtkDataSet *pdA, vtkDataSet *pdB, double tol); 00120 // Description: 00121 // Compute the average L2 norm between two data arrays "daA" and "daB" 00122 // and compare against "tol". 00123 int CompareAverageOfL2Norm(vtkDataArray *daA, vtkDataArray *daB, double tol); 00125 00127 00129 virtual void SetRenderWindow(vtkRenderWindow* rw); 00130 vtkGetObjectMacro(RenderWindow, vtkRenderWindow); 00132 00134 00135 vtkSetStringMacro(ValidImageFileName); 00136 const char *GetValidImageFileName(); 00138 00140 00141 vtkGetMacro(ImageDifference, double); 00143 00145 00150 void AddArgument(const char *argv); 00151 void AddArguments(int argc,const char **argv); 00153 00154 //BTX 00156 00159 char *GetArgument(const char *arg); 00160 //ETX 00162 00165 void CleanArguments(); 00166 00168 00169 const char *GetDataRoot(); 00170 vtkSetStringMacro(DataRoot); 00172 00174 00175 const char *GetTempDirectory(); 00176 vtkSetStringMacro(TempDirectory); 00178 00180 int IsValidImageSpecified(); 00181 00183 int IsInteractiveModeSpecified(); 00184 00186 int IsFlagSpecified(const char *flag); 00187 00189 00191 vtkSetMacro(BorderOffset, int); 00192 vtkGetMacro(BorderOffset, int); 00194 00196 00197 vtkSetMacro(Verbose, int); 00198 vtkGetMacro(Verbose, int); 00200 00201 protected: 00202 vtkTesting(); 00203 ~vtkTesting(); 00204 00205 static char* IncrementFileName(const char* fname, int count); 00206 static int LookForFile(const char* newFileName); 00207 00208 int FrontBuffer; 00209 vtkRenderWindow* RenderWindow; 00210 char* ValidImageFileName; 00211 double ImageDifference; 00212 char *TempDirectory; 00213 int BorderOffset; 00214 int Verbose; 00215 00216 //BTX 00217 vtkstd::vector<vtkstd::string> Args; 00218 //ETX 00219 char *DataRoot; 00220 double StartWallTime; 00221 double StartCPUTime; 00222 00223 private: 00224 vtkTesting(const vtkTesting&); // Not implemented. 00225 void operator=(const vtkTesting&); // Not implemented. 00226 }; 00227 00228 #endif 00229 00230