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;
77 class vtkRenderWindowInteractor;
78 
79 class VTKTESTINGRENDERING_EXPORT vtkTesting : public vtkObject
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[],
116  vtkRenderWindowInteractor *iren, const char *stream = NULL );
118 
119 //ETX
120 
122 
123  vtkSetClampMacro(FrontBuffer, int, 0, 1);
124  vtkBooleanMacro(FrontBuffer, int);
125  vtkGetMacro(FrontBuffer, int);
127 
129 
131  virtual int RegressionTest(double thresh);
132  virtual int RegressionTest(double thresh,ostream &os);
134 
136 
138  virtual int RegressionTest(const std::string &pngFileName, double thresh);
139  virtual int RegressionTest(const std::string &pngFileName,
140  double thresh, ostream& os);
142 
144 
145  virtual int RegressionTest(vtkAlgorithm* imageSource, double thresh);
146  virtual int RegressionTest(vtkAlgorithm* imageSource, double thresh, ostream& os);
148 
153  int CompareAverageOfL2Norm(vtkDataSet *pdA, vtkDataSet *pdB, double tol);
156  int CompareAverageOfL2Norm(vtkDataArray *daA, vtkDataArray *daB, double tol);
157 
159 
161  virtual void SetRenderWindow(vtkRenderWindow* rw);
162  vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
164 
166 
167  vtkSetStringMacro(ValidImageFileName);
168  const char *GetValidImageFileName();
170 
172 
173  vtkGetMacro(ImageDifference, double);
175 
177 
182  void AddArgument(const char *argv);
183  void AddArguments(int argc,const char **argv);
185 
186  //BTX
188 
191  char *GetArgument(const char *arg);
192  //ETX
194 
197  void CleanArguments();
198 
200 
201  const char *GetDataRoot();
202  vtkSetStringMacro(DataRoot);
204 
206 
207  const char *GetTempDirectory();
208  vtkSetStringMacro(TempDirectory);
210 
212  int IsValidImageSpecified();
213 
215  int IsInteractiveModeSpecified();
216 
218  int IsFlagSpecified(const char *flag);
219 
221 
223  vtkSetMacro(BorderOffset, int);
224  vtkGetMacro(BorderOffset, int);
226 
228 
229  vtkSetMacro(Verbose, int);
230  vtkGetMacro(Verbose, int);
232 
233 protected:
234  vtkTesting();
235  ~vtkTesting();
236 
237  static char* IncrementFileName(const char* fname, int count);
238  static int LookForFile(const char* newFileName);
239 
241  vtkRenderWindow* RenderWindow;
246  int Verbose;
247 
248 //BTX
249  std::vector<std::string> Args;
250 //ETX
251  char *DataRoot;
253  double StartCPUTime;
254 
255 private:
256  vtkTesting(const vtkTesting&); // Not implemented.
257  void operator=(const vtkTesting&); // Not implemented.
258 };
259 
260 #endif
261 
262 
char * DataRoot
Definition: vtkTesting.h:251
a unified VTK regression testing framework
Definition: vtkTesting.h:79
std::vector< std::string > Args
Definition: vtkTesting.h:249
double ImageDifference
Definition: vtkTesting.h:243
double StartCPUTime
Definition: vtkTesting.h:253
int FrontBuffer
Definition: vtkTesting.h:240
char * TempDirectory
Definition: vtkTesting.h:244
vtkRenderWindow * RenderWindow
Definition: vtkTesting.h:241
char * ValidImageFileName
Definition: vtkTesting.h:242
double StartWallTime
Definition: vtkTesting.h:252
int BorderOffset
Definition: vtkTesting.h:245