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 <vtkstd/vector> // STL Header used for argv
72 #include <vtkstd/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 
143 
147  int CompareAverageOfL2Norm(vtkDataSet *pdA, vtkDataSet *pdB, double tol);
148  // Description:
149  // Compute the average L2 norm between two data arrays "daA" and "daB"
150  // and compare against "tol".
151  int CompareAverageOfL2Norm(vtkDataArray *daA, vtkDataArray *daB, double tol);
153 
155 
157  virtual void SetRenderWindow(vtkRenderWindow* rw);
158  vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
160 
162 
163  vtkSetStringMacro(ValidImageFileName);
164  const char *GetValidImageFileName();
166 
168 
169  vtkGetMacro(ImageDifference, double);
171 
173 
178  void AddArgument(const char *argv);
179  void AddArguments(int argc,const char **argv);
181 
182  //BTX
184 
187  char *GetArgument(const char *arg);
188  //ETX
190 
193  void CleanArguments();
194 
196 
197  const char *GetDataRoot();
198  vtkSetStringMacro(DataRoot);
200 
202 
203  const char *GetTempDirectory();
204  vtkSetStringMacro(TempDirectory);
206 
208  int IsValidImageSpecified();
209 
211  int IsInteractiveModeSpecified();
212 
214  int IsFlagSpecified(const char *flag);
215 
217 
219  vtkSetMacro(BorderOffset, int);
220  vtkGetMacro(BorderOffset, int);
222 
224 
225  vtkSetMacro(Verbose, int);
226  vtkGetMacro(Verbose, int);
228 
229 protected:
230  vtkTesting();
231  ~vtkTesting();
232 
233  static char* IncrementFileName(const char* fname, int count);
234  static int LookForFile(const char* newFileName);
235 
242  int Verbose;
243 
244 //BTX
245  vtkstd::vector<vtkstd::string> Args;
246 //ETX
247  char *DataRoot;
249  double StartCPUTime;
250 
251 private:
252  vtkTesting(const vtkTesting&); // Not implemented.
253  void operator=(const vtkTesting&); // Not implemented.
254 };
255 
256 #endif
257 
258 
abstract base class for most VTK objects
Definition: vtkObject.h:60
char * DataRoot
Definition: vtkTesting.h:247
abstract class to specify dataset behavior
Definition: vtkDataSet.h:58
a unified VTK regression testing framework
Definition: vtkTesting.h:80
double ImageDifference
Definition: vtkTesting.h:239
double StartCPUTime
Definition: vtkTesting.h:249
platform-independent render window interaction including picking and frame rate control.
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:37
int FrontBuffer
Definition: vtkTesting.h:236
topologically and geometrically regular array of data
Definition: vtkImageData.h:43
char * TempDirectory
Definition: vtkTesting.h:240
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:53
vtkRenderWindow * RenderWindow
Definition: vtkTesting.h:237
char * ValidImageFileName
Definition: vtkTesting.h:238
#define VTK_RENDERING_EXPORT
create a window for renderers to draw into
double StartWallTime
Definition: vtkTesting.h:248
vtkstd::vector< vtkstd::string > Args
Definition: vtkTesting.h:245
static vtkObject * New()
int BorderOffset
Definition: vtkTesting.h:241