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();
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);
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 
221 
223 
224  const char *GetDataRoot();
225  vtkSetStringMacro(DataRoot);
227 
229 
230  const char *GetTempDirectory();
231  vtkSetStringMacro(TempDirectory);
233 
236 
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:
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 
vtkTesting::~vtkTesting
~vtkTesting()
vtkTesting::IsValidImageSpecified
int IsValidImageSpecified()
vtkTesting::StartCPUTime
double StartCPUTime
Definition: vtkTesting.h:276
vtkGetObjectMacro
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:232
VTKTESTINGRENDERING_EXPORT
#define VTKTESTINGRENDERING_EXPORT
Definition: vtkTestingRenderingModule.h:15
vtkTesting::TempDirectory
char * TempDirectory
Definition: vtkTesting.h:267
vtkgl::count
GLuint GLuint GLsizei count
Definition: vtkgl.h:11315
vtkTesting::LookForFile
static int LookForFile(const char *newFileName)
vtkTesting::GetArgument
char * GetArgument(const char *arg)
vtkTesting::InteractorEventLoop
static int InteractorEventLoop(int argc, char *argv[], vtkRenderWindowInteractor *iren, const char *stream=NULL)
vtkAlgorithm
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:62
vtkTesting::RegressionTest
virtual int RegressionTest(const std::string &pngFileName, double thresh, ostream &os)
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkgl::stream
GLuint GLuint stream
Definition: vtkgl.h:14154
vtkTesting::RenderWindow
vtkRenderWindow * RenderWindow
Definition: vtkTesting.h:264
vtkTesting::IsInteractiveModeSpecified
int IsInteractiveModeSpecified()
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkTesting::ReturnValue
ReturnValue
Definition: vtkTesting.h:87
vtkTesting::RegressionTestAndCaptureOutput
virtual int RegressionTestAndCaptureOutput(double thresh, ostream &os)
vtkTesting::Test
static int Test(int argc, char *argv[], vtkRenderWindow *rw, double thresh)
vtkTesting::vtkTesting
vtkTesting()
vtkTesting::CleanArguments
void CleanArguments()
vtkTesting::RegressionTest
virtual int RegressionTest(double thresh)
vtkTesting::CompareAverageOfL2Norm
int CompareAverageOfL2Norm(vtkDataArray *daA, vtkDataArray *daB, double tol)
vtkTesting::RegressionTest
virtual int RegressionTest(vtkAlgorithm *imageSource, double thresh)
vtkTesting::StartWallTime
double StartWallTime
Definition: vtkTesting.h:275
vtkTesting::AddArguments
void AddArguments(int argc, const char **argv)
vtkTesting::GetValidImageFileName
const char * GetValidImageFileName()
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkSetStringMacro
#define vtkSetStringMacro(name)
Definition: vtkSetGet.h:104
vtkTesting::RegressionTest
virtual int RegressionTest(vtkAlgorithm *imageSource, double thresh, ostream &os)
vtkTesting::GetTempDirectory
const char * GetTempDirectory()
vtkTesting::AddArguments
void AddArguments(int argc, char **argv)
vtkTesting::SetRenderWindow
virtual void SetRenderWindow(vtkRenderWindow *rw)
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkTesting::AddArgument
void AddArgument(const char *argv)
vtkTesting::BorderOffset
int BorderOffset
Definition: vtkTesting.h:268
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:80
vtkTesting::CompareAverageOfL2Norm
int CompareAverageOfL2Norm(vtkDataSet *pdA, vtkDataSet *pdB, double tol)
vtkObject.h
vtkTesting::DataRoot
char * DataRoot
Definition: vtkTesting.h:274
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkTesting
a unified VTK regression testing framework
Definition: vtkTesting.h:80
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkTesting::FrontBuffer
int FrontBuffer
Definition: vtkTesting.h:263
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkTesting::New
static vtkTesting * New()
vtkTesting::IsFlagSpecified
int IsFlagSpecified(const char *flag)
vtkTesting::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkTesting::IncrementFileName
static char * IncrementFileName(const char *fname, int count)
vtkTesting::RegressionTest
virtual int RegressionTest(const std::string &pngFileName, double thresh)
vtkTesting::SetFrontBuffer
void SetFrontBuffer(int frontBuffer)
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:89
vtkTesting::Args
std::vector< std::string > Args
Definition: vtkTesting.h:272
vtkTesting::GetDataRoot
const char * GetDataRoot()
vtkTesting::RegressionTest
virtual int RegressionTest(double thresh, ostream &os)
vtkgl::string
GLsizei const GLchar ** string
Definition: vtkgl.h:12011
vtkTesting::ValidImageFileName
char * ValidImageFileName
Definition: vtkTesting.h:265
vtkTestingRenderingModule.h
vtkTesting::Verbose
int Verbose
Definition: vtkTesting.h:269
vtkTesting::ImageDifference
double ImageDifference
Definition: vtkTesting.h:266