00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00064 #ifndef __vtkTesting_h
00065 #define __vtkTesting_h
00066
00067 #include "vtkObject.h"
00068 #include <vtkstd/vector>
00069 #include <vtkstd/string>
00070
00071 class vtkRenderWindow;
00072 class vtkImageData;
00073 class vtkDataArray;
00074 class vtkDataSet;
00075 class vtkRenderWindowInteractor;
00076
00077 class VTK_RENDERING_EXPORT vtkTesting : public vtkObject
00078 {
00079 public:
00080 static vtkTesting *New();
00081 vtkTypeRevisionMacro(vtkTesting,vtkObject);
00082 void PrintSelf(ostream& os, vtkIndent indent);
00083
00084
00085 enum ReturnValue {
00086 FAILED = 0,
00087 PASSED = 1,
00088 NOT_RUN = 2,
00089 DO_INTERACTOR = 3
00090 };
00091
00092 static int Test(int argc, char *argv[], vtkRenderWindow *rw, double thresh);
00093
00095
00113 static int InteractorEventLoop( int argc, char *argv[],
00114 vtkRenderWindowInteractor *iren, const char *stream = NULL );
00116
00117
00118
00120
00121 vtkSetClampMacro(FrontBuffer, int, 0, 1);
00122 vtkBooleanMacro(FrontBuffer, int);
00123 vtkGetMacro(FrontBuffer, int);
00125
00127
00129 virtual int RegressionTest(double thresh);
00130 virtual int RegressionTest(double thresh,ostream &os);
00132
00134
00135 virtual int RegressionTest(vtkImageData* image, double thresh);
00136 virtual int RegressionTest(vtkImageData* image, double thresh, ostream& os);
00138
00140
00144 int CompareAverageOfL2Norm(vtkDataSet *pdA, vtkDataSet *pdB, double tol);
00145
00146
00147
00148 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
00181
00184 char *GetArgument(const char *arg);
00185
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
00242 vtkstd::vector<vtkstd::string> Args;
00243
00244 char *DataRoot;
00245 double StartWallTime;
00246 double StartCPUTime;
00247
00248 private:
00249 vtkTesting(const vtkTesting&);
00250 void operator=(const vtkTesting&);
00251 };
00252
00253 #endif
00254
00255