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 
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 
137  virtual int RegressionTest(vtkAlgorithm* imageSource, double thresh);
138  virtual int RegressionTest(vtkAlgorithm* imageSource, double thresh, ostream& os);
140 
145  int CompareAverageOfL2Norm(vtkDataSet *pdA, vtkDataSet *pdB, double tol);
148  int CompareAverageOfL2Norm(vtkDataArray *daA, vtkDataArray *daB, double tol);
149 
151 
153  virtual void SetRenderWindow(vtkRenderWindow* rw);
154  vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
156 
158 
159  vtkSetStringMacro(ValidImageFileName);
160  const char *GetValidImageFileName();
162 
164 
165  vtkGetMacro(ImageDifference, double);
167 
169 
174  void AddArgument(const char *argv);
175  void AddArguments(int argc,const char **argv);
177 
178  //BTX
180 
183  char *GetArgument(const char *arg);
184  //ETX
186 
189  void CleanArguments();
190 
192 
193  const char *GetDataRoot();
194  vtkSetStringMacro(DataRoot);
196 
198 
199  const char *GetTempDirectory();
200  vtkSetStringMacro(TempDirectory);
202 
204  int IsValidImageSpecified();
205 
207  int IsInteractiveModeSpecified();
208 
210  int IsFlagSpecified(const char *flag);
211 
213 
215  vtkSetMacro(BorderOffset, int);
216  vtkGetMacro(BorderOffset, int);
218 
220 
221  vtkSetMacro(Verbose, int);
222  vtkGetMacro(Verbose, int);
224 
225 protected:
226  vtkTesting();
227  ~vtkTesting();
228 
229  static char* IncrementFileName(const char* fname, int count);
230  static int LookForFile(const char* newFileName);
231 
238  int Verbose;
239 
240 //BTX
241  std::vector<std::string> Args;
242 //ETX
243  char *DataRoot;
245  double StartCPUTime;
246 
247 private:
248  vtkTesting(const vtkTesting&); // Not implemented.
249  void operator=(const vtkTesting&); // Not implemented.
250 };
251 
252 #endif
253 
254