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 =========================================================================*/
64 #ifndef vtkTesting_h
65 #define vtkTesting_h
66 
67 #include "vtkTestingRenderingModule.h" // For export macro
68 #include "vtkObject.h"
69 #include <vector> // STL Header used for argv
70 #include <string> // STL Header used for argv
71 
72 class vtkAlgorithm;
73 class vtkRenderWindow;
74 class vtkImageData;
75 class vtkDataArray;
76 class vtkDataSet;
78 
80 {
81 public:
82  static vtkTesting *New();
83  vtkTypeMacro(vtkTesting,vtkObject);
84  void PrintSelf(ostream& os, vtkIndent indent);
85 
86 //BTX
87  enum ReturnValue {
88  FAILED = 0,
89  PASSED = 1,
90  NOT_RUN = 2,
91  DO_INTERACTOR = 3
92  };
93 
94  static int Test(int argc, char *argv[], vtkRenderWindow *rw, double thresh);
95 
97 
124  static int InteractorEventLoop(int argc, char *argv[],
126  const char *stream = NULL);
128 
129 //ETX
130 
132 
135  vtkBooleanMacro(FrontBuffer, int);
136  vtkGetMacro(FrontBuffer, int);
137  void SetFrontBuffer(int frontBuffer);
139 
142  virtual int RegressionTest(double thresh);
143 
147  virtual int RegressionTestAndCaptureOutput(double thresh, ostream &os);
148 
153  virtual int RegressionTest(double thresh,ostream &os);
154 
156 
158  virtual int RegressionTest(const std::string &pngFileName, double thresh);
159  virtual int RegressionTest(const std::string &pngFileName,
160  double thresh, ostream& os);
162 
164 
165  virtual int RegressionTest(vtkAlgorithm* imageSource, double thresh);
166  virtual int RegressionTest(vtkAlgorithm* imageSource, double thresh,
167  ostream& os);
169 
174  int CompareAverageOfL2Norm(vtkDataSet *pdA, vtkDataSet *pdB, double tol);
175 
178  int CompareAverageOfL2Norm(vtkDataArray *daA, vtkDataArray *daB, double tol);
179 
181 
183  virtual void SetRenderWindow(vtkRenderWindow* rw);
184  vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
186 
188 
189  vtkSetStringMacro(ValidImageFileName);
190  const char *GetValidImageFileName();
192 
194 
195  vtkGetMacro(ImageDifference, double);
197 
199 
204  void AddArgument(const char *argv);
205  void AddArguments(int argc,const char **argv);
206  void AddArguments(int argc, char **argv);
208 
209  //BTX
211 
214  char *GetArgument(const char *arg);
215  //ETX
217 
220  void CleanArguments();
221 
223 
224  const char *GetDataRoot();
225  vtkSetStringMacro(DataRoot);
227 
229 
230  const char *GetTempDirectory();
231  vtkSetStringMacro(TempDirectory);
233 
235  int IsValidImageSpecified();
236 
238  int IsInteractiveModeSpecified();
239 
241  int IsFlagSpecified(const char *flag);
242 
244 
246  vtkSetMacro(BorderOffset, int);
247  vtkGetMacro(BorderOffset, int);
249 
251 
252  vtkSetMacro(Verbose, int);
253  vtkGetMacro(Verbose, int);
255 
256 protected:
257  vtkTesting();
258  ~vtkTesting();
259 
260  static char* IncrementFileName(const char* fname, int count);
261  static int LookForFile(const char* newFileName);
262 
269  int Verbose;
270 
271 //BTX
272  std::vector<std::string> Args;
273 //ETX
274  char *DataRoot;
276  double StartCPUTime;
277 
278 private:
279  vtkTesting(const vtkTesting&); // Not implemented.
280  void operator=(const vtkTesting&); // Not implemented.
281 };
282 
283 #endif
284 
285 
abstract base class for most VTK objects
Definition: vtkObject.h:61
char * DataRoot
Definition: vtkTesting.h:274
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
a unified VTK regression testing framework
Definition: vtkTesting.h:79
#define VTKTESTINGRENDERING_EXPORT
virtual void SetRenderWindow(vtkRenderWindow *renwin)
std::vector< std::string > Args
Definition: vtkTesting.h:272
double ImageDifference
Definition: vtkTesting.h:266
double StartCPUTime
Definition: vtkTesting.h:276
platform-independent render window interaction including picking and frame rate control.
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:61
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
int FrontBuffer
Definition: vtkTesting.h:263
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
char * TempDirectory
Definition: vtkTesting.h:267
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkRenderWindow * RenderWindow
Definition: vtkTesting.h:264
char * ValidImageFileName
Definition: vtkTesting.h:265
vtkWeakPointer< vtkRenderWindow > RenderWindow
create a window for renderers to draw into
double StartWallTime
Definition: vtkTesting.h:275
static vtkObject * New()
int BorderOffset
Definition: vtkTesting.h:268