00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00067 #ifndef __vtkTesting_h
00068 #define __vtkTesting_h
00069
00070 #include "vtkObject.h"
00071 #include <vtkstd/vector>
00072 #include <vtkstd/string>
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
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
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
00143
00147 int CompareAverageOfL2Norm(vtkDataSet *pdA, vtkDataSet *pdB, double tol);
00148
00149
00150
00151 int CompareAverageOfL2Norm(vtkDataArray *daA, vtkDataArray *daB, double tol);
00153
00155
00157 virtual void SetRenderWindow(vtkRenderWindow* rw);
00158 vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
00160
00162
00163 vtkSetStringMacro(ValidImageFileName);
00164 const char *GetValidImageFileName();
00166
00168
00169 vtkGetMacro(ImageDifference, double);
00171
00173
00178 void AddArgument(const char *argv);
00179 void AddArguments(int argc,const char **argv);
00181
00182
00184
00187 char *GetArgument(const char *arg);
00188
00190
00193 void CleanArguments();
00194
00196
00197 const char *GetDataRoot();
00198 vtkSetStringMacro(DataRoot);
00200
00202
00203 const char *GetTempDirectory();
00204 vtkSetStringMacro(TempDirectory);
00206
00208 int IsValidImageSpecified();
00209
00211 int IsInteractiveModeSpecified();
00212
00214 int IsFlagSpecified(const char *flag);
00215
00217
00219 vtkSetMacro(BorderOffset, int);
00220 vtkGetMacro(BorderOffset, int);
00222
00224
00225 vtkSetMacro(Verbose, int);
00226 vtkGetMacro(Verbose, int);
00228
00229 protected:
00230 vtkTesting();
00231 ~vtkTesting();
00232
00233 static char* IncrementFileName(const char* fname, int count);
00234 static int LookForFile(const char* newFileName);
00235
00236 int FrontBuffer;
00237 vtkRenderWindow* RenderWindow;
00238 char* ValidImageFileName;
00239 double ImageDifference;
00240 char *TempDirectory;
00241 int BorderOffset;
00242 int Verbose;
00243
00244
00245 vtkstd::vector<vtkstd::string> Args;
00246
00247 char *DataRoot;
00248 double StartWallTime;
00249 double StartCPUTime;
00250
00251 private:
00252 vtkTesting(const vtkTesting&);
00253 void operator=(const vtkTesting&);
00254 };
00255
00256 #endif
00257
00258