Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkTesting.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkTesting.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00075 #ifndef __vtkTesting_h
00076 #define __vtkTesting_h
00077 
00078 #include "vtkObject.h"
00079 #include <vtkstd/vector> // used for argv
00080 #include <vtkstd/string> // used for argv
00081 
00082 class vtkRenderWindow;
00083 class vtkImageData;
00084 
00085 //BTX
00086 struct VTK_RENDERING_EXPORT vtkTestUtilities
00087 {
00089 
00095   static char* ExpandDataFileName(int argc, char* argv[], 
00096                                   const char* fname,
00097                                   int slash = 0);
00099 };
00100 //ETX
00101 
00102 class VTK_RENDERING_EXPORT vtkTesting : public vtkObject
00103 {
00104 public:
00105   static vtkTesting *New();
00106   vtkTypeRevisionMacro(vtkTesting,vtkObject);
00107   void PrintSelf(ostream& os, vtkIndent indent);
00108 
00109 //BTX
00110   enum ReturnValue {
00111     FAILED = 0,
00112     PASSED = 1,
00113     NOT_RUN = 2,
00114     DO_INTERACTOR = 3
00115   };
00116 
00117   static int Test(int argc, char *argv[], vtkRenderWindow *rw, double thresh);
00118 //ETX
00119   
00121 
00122   vtkSetClampMacro(FrontBuffer, int, 0, 1);
00123   vtkBooleanMacro(FrontBuffer, int);
00124   vtkGetMacro(FrontBuffer, int);
00126 
00128 
00130   virtual int RegressionTest(double thresh);
00131   virtual int RegressionTest(double thresh,ostream &os);
00133 
00135 
00136   virtual int RegressionTest(vtkImageData* image, double thresh);
00137   virtual int RegressionTest(vtkImageData* image, double thresh, ostream& os);
00139 
00141 
00143   virtual void SetRenderWindow(vtkRenderWindow* rw);
00144   vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
00146 
00148 
00149   vtkSetStringMacro(ValidImageFileName);
00150   const char *GetValidImageFileName();
00152 
00154 
00155   vtkGetMacro(ImageDifference, double);
00157 
00163   void AddArgument(const char *argv);
00164   
00167   void CleanArguments();
00168   
00170 
00171   const char *GetDataRoot();
00172   vtkSetStringMacro(DataRoot);
00174 
00176 
00177   const char *GetTempDirectory();
00178   vtkSetStringMacro(TempDirectory);
00180 
00182   int IsValidImageSpecified();
00183 
00185   int IsInteractiveModeSpecified();
00186 
00188 
00190   vtkSetMacro(BorderOffset, int);
00191   vtkGetMacro(BorderOffset, int);
00193 
00194 protected:
00195   vtkTesting();
00196   ~vtkTesting();
00197 
00198   static char* IncrementFileName(const char* fname, int count);
00199   static int LookForFile(const char* newFileName);
00200 
00201   int FrontBuffer;
00202   vtkRenderWindow* RenderWindow;
00203   char* ValidImageFileName;
00204   double ImageDifference;
00205   char *TempDirectory;
00206   int BorderOffset;
00207   
00208 //BTX
00209   vtkstd::vector<vtkstd::string> Args;
00210 //ETX
00211   char *DataRoot;
00212   double StartWallTime;
00213   double StartCPUTime;
00214   
00215 private:
00216   vtkTesting(const vtkTesting&);  // Not implemented.
00217   void operator=(const vtkTesting&);  // Not implemented.
00218 };
00219 
00220 #endif
00221 
00222