VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
115  static int InteractorEventLoop(int argc, char *argv[],
117  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 
139  virtual int RegressionTest(const std::string &pngFileName, double thresh);
140  virtual int RegressionTest(const std::string &pngFileName,
141  double thresh, ostream& os);
143 
145 
146  virtual int RegressionTest(vtkAlgorithm* imageSource, double thresh);
147  virtual int RegressionTest(vtkAlgorithm* imageSource, double thresh,
148  ostream& os);
150 
155  int CompareAverageOfL2Norm(vtkDataSet *pdA, vtkDataSet *pdB, double tol);
156 
159  int CompareAverageOfL2Norm(vtkDataArray *daA, vtkDataArray *daB, double tol);
160 
162 
164  virtual void SetRenderWindow(vtkRenderWindow* rw);
165  vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
167 
169 
170  vtkSetStringMacro(ValidImageFileName);
171  const char *GetValidImageFileName();
173 
175 
176  vtkGetMacro(ImageDifference, double);
178 
180 
185  void AddArgument(const char *argv);
186  void AddArguments(int argc,const char **argv);
188 
189  //BTX
191 
194  char *GetArgument(const char *arg);
195  //ETX
197 
200  void CleanArguments();
201 
203 
204  const char *GetDataRoot();
205  vtkSetStringMacro(DataRoot);
207 
209 
210  const char *GetTempDirectory();
211  vtkSetStringMacro(TempDirectory);
213 
215  int IsValidImageSpecified();
216 
218  int IsInteractiveModeSpecified();
219 
221  int IsFlagSpecified(const char *flag);
222 
224 
226  vtkSetMacro(BorderOffset, int);
227  vtkGetMacro(BorderOffset, int);
229 
231 
232  vtkSetMacro(Verbose, int);
233  vtkGetMacro(Verbose, int);
235 
236 protected:
237  vtkTesting();
238  ~vtkTesting();
239 
240  static char* IncrementFileName(const char* fname, int count);
241  static int LookForFile(const char* newFileName);
242 
249  int Verbose;
250 
251 //BTX
252  std::vector<std::string> Args;
253 //ETX
254  char *DataRoot;
256  double StartCPUTime;
257 
258 private:
259  vtkTesting(const vtkTesting&); // Not implemented.
260  void operator=(const vtkTesting&); // Not implemented.
261 };
262 
263 #endif
264 
265 
abstract base class for most VTK objects
Definition: vtkObject.h:61
char * DataRoot
Definition: vtkTesting.h:254
abstract class to specify dataset behavior
Definition: vtkDataSet.h:60
a unified VTK regression testing framework
Definition: vtkTesting.h:79
#define VTKTESTINGRENDERING_EXPORT
virtual void SetRenderWindow(vtkRenderWindow *renwin)
GLuint GLuint GLsizei count
Definition: vtkgl.h:11315
std::vector< std::string > Args
Definition: vtkTesting.h:252
double ImageDifference
Definition: vtkTesting.h:246
double StartCPUTime
Definition: vtkTesting.h:256
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:243
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
char * TempDirectory
Definition: vtkTesting.h:247
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:53
vtkRenderWindow * RenderWindow
Definition: vtkTesting.h:244
char * ValidImageFileName
Definition: vtkTesting.h:245
GLuint GLuint stream
Definition: vtkgl.h:14154
vtkWeakPointer< vtkRenderWindow > RenderWindow
create a window for renderers to draw into
double StartWallTime
Definition: vtkTesting.h:255
static vtkObject * New()
GLsizei const GLchar ** string
Definition: vtkgl.h:12011
int BorderOffset
Definition: vtkTesting.h:248