VTK
vtkTesting.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTesting.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
67 #ifndef __vtkTesting_h
68 #define __vtkTesting_h
69 
70 #include "vtkObject.h"
71 #include <vector> // STL Header used for argv
72 #include <string> // STL Header used for argv
73 
74 class vtkRenderWindow;
75 class vtkImageData;
76 class vtkDataArray;
77 class vtkDataSet;
79 
81 {
82 public:
83  static vtkTesting *New();
84  vtkTypeMacro(vtkTesting,vtkObject);
85  void PrintSelf(ostream& os, vtkIndent indent);
86 
87 //BTX
88  enum ReturnValue {
89  FAILED = 0,
90  PASSED = 1,
91  NOT_RUN = 2,
92  DO_INTERACTOR = 3
93  };
94 
95  static int Test(int argc, char *argv[], vtkRenderWindow *rw, double thresh);
96 
98 
116  static int InteractorEventLoop( int argc, char *argv[],
117  vtkRenderWindowInteractor *iren, const char *stream = NULL );
119 
120 //ETX
121 
123 
124  vtkSetClampMacro(FrontBuffer, int, 0, 1);
125  vtkBooleanMacro(FrontBuffer, int);
126  vtkGetMacro(FrontBuffer, int);
128 
130 
132  virtual int RegressionTest(double thresh);
133  virtual int RegressionTest(double thresh,ostream &os);
135 
137 
138  virtual int RegressionTest(vtkImageData* image, double thresh);
139  virtual int RegressionTest(vtkImageData* image, double thresh, ostream& os);
141 
146  int CompareAverageOfL2Norm(vtkDataSet *pdA, vtkDataSet *pdB, double tol);
149  int CompareAverageOfL2Norm(vtkDataArray *daA, vtkDataArray *daB, double tol);
150 
152 
154  virtual void SetRenderWindow(vtkRenderWindow* rw);
155  vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
157 
159 
160  vtkSetStringMacro(ValidImageFileName);
161  const char *GetValidImageFileName();
163 
165 
166  vtkGetMacro(ImageDifference, double);
168 
170 
175  void AddArgument(const char *argv);
176  void AddArguments(int argc,const char **argv);
178 
179  //BTX
181 
184  char *GetArgument(const char *arg);
185  //ETX
187 
190  void CleanArguments();
191 
193 
194  const char *GetDataRoot();
195  vtkSetStringMacro(DataRoot);
197 
199 
200  const char *GetTempDirectory();
201  vtkSetStringMacro(TempDirectory);
203 
205  int IsValidImageSpecified();
206 
208  int IsInteractiveModeSpecified();
209 
211  int IsFlagSpecified(const char *flag);
212 
214 
216  vtkSetMacro(BorderOffset, int);
217  vtkGetMacro(BorderOffset, int);
219 
221 
222  vtkSetMacro(Verbose, int);
223  vtkGetMacro(Verbose, int);
225 
226 protected:
227  vtkTesting();
228  ~vtkTesting();
229 
230  static char* IncrementFileName(const char* fname, int count);
231  static int LookForFile(const char* newFileName);
232 
239  int Verbose;
240 
241 //BTX
242  std::vector<std::string> Args;
243 //ETX
244  char *DataRoot;
246  double StartCPUTime;
247 
248 private:
249  vtkTesting(const vtkTesting&); // Not implemented.
250  void operator=(const vtkTesting&); // Not implemented.
251 };
252 
253 #endif
254 
255