VTK
|
a unified VTK regression testing framework More...
#include <vtkTesting.h>
Public Types | |
enum | ReturnValue { FAILED = 0, PASSED = 1, NOT_RUN = 2, DO_INTERACTOR = 3 } |
typedef vtkObject | Superclass |
Public Types inherited from vtkObject | |
typedef vtkObjectBase | Superclass |
Public Member Functions | |
virtual int | IsA (const char *type) |
vtkTesting * | NewInstance () const |
void | PrintSelf (ostream &os, vtkIndent indent) |
virtual int | RegressionTest (double thresh) |
virtual int | RegressionTestAndCaptureOutput (double thresh, ostream &os) |
virtual int | RegressionTest (double thresh, ostream &os) |
int | CompareAverageOfL2Norm (vtkDataSet *pdA, vtkDataSet *pdB, double tol) |
int | CompareAverageOfL2Norm (vtkDataArray *daA, vtkDataArray *daB, double tol) |
void | CleanArguments () |
int | IsValidImageSpecified () |
int | IsInteractiveModeSpecified () |
int | IsFlagSpecified (const char *flag) |
virtual void | FrontBufferOn () |
virtual void | FrontBufferOff () |
virtual int | GetFrontBuffer () |
void | SetFrontBuffer (int frontBuffer) |
virtual int | RegressionTest (const std::string &pngFileName, double thresh) |
virtual int | RegressionTest (const std::string &pngFileName, double thresh, ostream &os) |
virtual int | RegressionTest (vtkAlgorithm *imageSource, double thresh) |
virtual int | RegressionTest (vtkAlgorithm *imageSource, double thresh, ostream &os) |
virtual void | SetRenderWindow (vtkRenderWindow *rw) |
virtual vtkRenderWindow * | GetRenderWindow () |
virtual void | SetValidImageFileName (const char *) |
const char * | GetValidImageFileName () |
virtual double | GetImageDifference () |
void | AddArgument (const char *argv) |
void | AddArguments (int argc, const char **argv) |
void | AddArguments (int argc, char **argv) |
char * | GetArgument (const char *arg) |
const char * | GetDataRoot () |
virtual void | SetDataRoot (const char *) |
const char * | GetTempDirectory () |
virtual void | SetTempDirectory (const char *) |
virtual void | SetBorderOffset (int) |
virtual int | GetBorderOffset () |
virtual void | SetVerbose (int) |
virtual int | GetVerbose () |
Public Member Functions inherited from vtkObject | |
vtkObject * | NewInstance () const |
virtual void | DebugOn () |
virtual void | DebugOff () |
bool | GetDebug () |
void | SetDebug (bool debugFlag) |
virtual void | Modified () |
virtual unsigned long | GetMTime () |
unsigned long | AddObserver (unsigned long event, vtkCommand *, float priority=0.0f) |
unsigned long | AddObserver (const char *event, vtkCommand *, float priority=0.0f) |
vtkCommand * | GetCommand (unsigned long tag) |
void | RemoveObserver (vtkCommand *) |
void | RemoveObservers (unsigned long event, vtkCommand *) |
void | RemoveObservers (const char *event, vtkCommand *) |
int | HasObserver (unsigned long event, vtkCommand *) |
int | HasObserver (const char *event, vtkCommand *) |
void | RemoveObserver (unsigned long tag) |
void | RemoveObservers (unsigned long event) |
void | RemoveObservers (const char *event) |
void | RemoveAllObservers () |
int | HasObserver (unsigned long event) |
int | HasObserver (const char *event) |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f) |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
int | InvokeEvent (unsigned long event, void *callData) |
int | InvokeEvent (const char *event, void *callData) |
int | InvokeEvent (unsigned long event) |
int | InvokeEvent (const char *event) |
Public Member Functions inherited from vtkObjectBase | |
const char * | GetClassName () const |
virtual void | Delete () |
virtual void | FastDelete () |
void | Print (ostream &os) |
virtual void | Register (vtkObjectBase *o) |
virtual void | UnRegister (vtkObjectBase *o) |
void | SetReferenceCount (int) |
void | PrintRevisions (ostream &) |
virtual void | PrintHeader (ostream &os, vtkIndent indent) |
virtual void | PrintTrailer (ostream &os, vtkIndent indent) |
int | GetReferenceCount () |
Static Public Member Functions | |
static vtkTesting * | New () |
static int | IsTypeOf (const char *type) |
static vtkTesting * | SafeDownCast (vtkObjectBase *o) |
static int | Test (int argc, char *argv[], vtkRenderWindow *rw, double thresh) |
static int | InteractorEventLoop (int argc, char *argv[], vtkRenderWindowInteractor *iren, const char *stream=NULL) |
Static Public Member Functions inherited from vtkObject | |
static int | IsTypeOf (const char *type) |
static vtkObject * | SafeDownCast (vtkObjectBase *o) |
static vtkObject * | New () |
static void | BreakOnError () |
static void | SetGlobalWarningDisplay (int val) |
static void | GlobalWarningDisplayOn () |
static void | GlobalWarningDisplayOff () |
static int | GetGlobalWarningDisplay () |
Static Public Member Functions inherited from vtkObjectBase | |
static int | IsTypeOf (const char *name) |
static vtkObjectBase * | New () |
Protected Member Functions | |
virtual vtkObjectBase * | NewInstanceInternal () const |
vtkTesting () | |
~vtkTesting () | |
Protected Member Functions inherited from vtkObject | |
vtkObject () | |
virtual | ~vtkObject () |
virtual void | RegisterInternal (vtkObjectBase *, int check) |
virtual void | UnRegisterInternal (vtkObjectBase *, int check) |
void | InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL) |
void | InternalReleaseFocus () |
Protected Member Functions inherited from vtkObjectBase | |
vtkObjectBase () | |
virtual | ~vtkObjectBase () |
virtual void | CollectRevisions (ostream &) |
virtual void | ReportReferences (vtkGarbageCollector *) |
vtkObjectBase (const vtkObjectBase &) | |
void | operator= (const vtkObjectBase &) |
Static Protected Member Functions | |
static char * | IncrementFileName (const char *fname, int count) |
static int | LookForFile (const char *newFileName) |
Protected Attributes | |
int | FrontBuffer |
vtkRenderWindow * | RenderWindow |
char * | ValidImageFileName |
double | ImageDifference |
char * | TempDirectory |
int | BorderOffset |
int | Verbose |
std::vector< std::string > | Args |
char * | DataRoot |
double | StartWallTime |
double | StartCPUTime |
Protected Attributes inherited from vtkObject | |
bool | Debug |
vtkTimeStamp | MTime |
vtkSubjectHelper * | SubjectHelper |
Protected Attributes inherited from vtkObjectBase | |
vtkAtomicInt32 | ReferenceCount |
vtkWeakPointerBase ** | WeakPointers |
a unified VTK regression testing framework
This is a VTK regression testing framework. Looks like this:
vtkTesting* t = vtkTesting::New();
Two options for setting arguments
Option 1: for ( cc = 1; cc < argc; cc ++ ) { t->AddArgument(argv[cc]); }
Option 2: t->AddArgument("-D"); t->AddArgument(my_data_dir); t->AddArgument("-V"); t->AddArgument(my_valid_image);
...
Two options of doing testing:
Option 1: t->SetRenderWindow(renWin); int res = t->RegressionTest(threshold);
Option 2: int res = t->RegressionTest(test_image, threshold);
...
if (res == vtkTesting::PASSED) { Test passed } else { Test failed }
Definition at line 79 of file vtkTesting.h.
typedef vtkObject vtkTesting::Superclass |
Definition at line 83 of file vtkTesting.h.
Enumerator | |
---|---|
FAILED | |
PASSED | |
NOT_RUN | |
DO_INTERACTOR |
Definition at line 87 of file vtkTesting.h.
|
protected |
|
protected |
|
static |
|
static |
|
virtual |
Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
|
static |
|
protectedvirtual |
Reimplemented from vtkObject.
vtkTesting* vtkTesting::NewInstance | ( | ) | const |
|
virtual |
|
static |
|
static |
This method is intended to be a comprehensive, one line replacement for vtkRegressionTest and for the replay based testing using vtkInteractorEventRecorder, greatly simplifying API and code bloat. It scans the command line specified for the following : - If a "--DisableReplay" is specified, it disables the testing replay. This is particularly useful in enabling the user to exercise the widgets. Typically the widgets are defined by the testing replay, so the user misses out on playing around with the widget definition behaviour. - If a "--Record" is specified, it records the interactions into a "vtkInteractorEventRecorder.log" file. This is useful when creating the playback stream that is plugged into tests. The file can be used to create a const char * variable for playback or can copied into a location as a playback file. - If a "–PlaybackFile filename is specified,the provided file contains the events and is passed to the event recorder. Typical usage in a test for a VTK widget that needs playback testing / recording is : const char TestFooWidgetLog[] = { .... }; int TestFooWidget( int argc, char *argv[] ) { ... return vtkTesting::InteractorEventLoop( argc, argv, iren, TestFooWidgetLog ); } In tests that playback events from a file: TestFooEventLog.txt stored in ../Data/Input/TestFooEventLog.txt The CMakeLists.txt file should contain: set(TestFoo_ARGS "--PlaybackFile" "DATA{../Data/Input/TestFooEventLog.txt}") and the API is int TestFoo( int argc, char *argv[] ) { ... return vtkTesting::InteractorEventLoop( argc, argv, iren ); } In tests where no playback is exercised, the API is simply int TestFoo( int argc, char *argv[] ) { ... return vtkTesting::InteractorEventLoop( argc, argv, iren ); }
|
virtual |
Use the front buffer first for regression test comparisons. By default use back buffer first, then try the front buffer if the test fails when comparing to the back buffer.
|
virtual |
Use the front buffer first for regression test comparisons. By default use back buffer first, then try the front buffer if the test fails when comparing to the back buffer.
|
virtual |
Use the front buffer first for regression test comparisons. By default use back buffer first, then try the front buffer if the test fails when comparing to the back buffer.
void vtkTesting::SetFrontBuffer | ( | int | frontBuffer | ) |
Use the front buffer first for regression test comparisons. By default use back buffer first, then try the front buffer if the test fails when comparing to the back buffer.
Perform the test and return the result. Delegates to RegressionTestAndCaptureOutput, sending the output to cout.
Perform the test and return the result. At the same time, write the output to the output stream os. Includes timing information in the output.
Perform the test and return the result. At the same time, write the output to the output stream os. This method is nearly the same as RegressionTestAndCaptureOutput, but does not include timing information in the output.
Perform the test and return result. The test image will be read from the png file at pngFileName.
|
virtual |
Perform the test and return result. The test image will be read from the png file at pngFileName.
|
virtual |
Compare the image with the valid image.
|
virtual |
Compare the image with the valid image.
int vtkTesting::CompareAverageOfL2Norm | ( | vtkDataSet * | pdA, |
vtkDataSet * | pdB, | ||
double | tol | ||
) |
Compute the average L2 norm between all point data data arrays of types float and double present in the data sets "dsA" and "dsB" (this includes instances of vtkPoints) Compare the result of each L2 comutation to "tol".
int vtkTesting::CompareAverageOfL2Norm | ( | vtkDataArray * | daA, |
vtkDataArray * | daB, | ||
double | tol | ||
) |
Compute the average L2 norm between two data arrays "daA" and "daB" and compare against "tol".
|
virtual |
Set and get the render window that will be used for regression testing.
|
virtual |
Set and get the render window that will be used for regression testing.
|
virtual |
Set/Get the name of the valid image file
const char* vtkTesting::GetValidImageFileName | ( | ) |
Set/Get the name of the valid image file
|
virtual |
Get the image difference.
void vtkTesting::AddArgument | ( | const char * | argv | ) |
Pass the command line arguments into this class to be processed. Many of the Get methods such as GetValidImage and GetBaselineRoot rely on the arguments to be passed in prior to retrieving these values. Just call AddArgument for each argument that was passed into the command line
void vtkTesting::AddArguments | ( | int | argc, |
const char ** | argv | ||
) |
Pass the command line arguments into this class to be processed. Many of the Get methods such as GetValidImage and GetBaselineRoot rely on the arguments to be passed in prior to retrieving these values. Just call AddArgument for each argument that was passed into the command line
void vtkTesting::AddArguments | ( | int | argc, |
char ** | argv | ||
) |
Pass the command line arguments into this class to be processed. Many of the Get methods such as GetValidImage and GetBaselineRoot rely on the arguments to be passed in prior to retrieving these values. Just call AddArgument for each argument that was passed into the command line
char* vtkTesting::GetArgument | ( | const char * | arg | ) |
Search for a specific argument by name and return its value (assumed to be the next on the command tail). Up to caller to delete the returned string.
void vtkTesting::CleanArguments | ( | ) |
This method delete all arguments in vtkTesting, this way you can reuse it in a loop where you would have multiple testing.
const char* vtkTesting::GetDataRoot | ( | ) |
Get some parameters from the command line arguments, env, or defaults
|
virtual |
Get some parameters from the command line arguments, env, or defaults
const char* vtkTesting::GetTempDirectory | ( | ) |
Get some parameters from the command line arguments, env, or defaults
|
virtual |
Get some parameters from the command line arguments, env, or defaults
int vtkTesting::IsValidImageSpecified | ( | ) |
Is a valid image specified on the command line areguments?
int vtkTesting::IsInteractiveModeSpecified | ( | ) |
Is the interactive mode specified?
int vtkTesting::IsFlagSpecified | ( | const char * | flag | ) |
Is some arbitrary user flag ("-X", "-Z" etc) specified
|
virtual |
Number of pixels added as borders to avoid problems with window decorations added by some window managers.
|
virtual |
Number of pixels added as borders to avoid problems with window decorations added by some window managers.
|
virtual |
Get/Set verbosity level. A level of 0 is quiet.
|
virtual |
Get/Set verbosity level. A level of 0 is quiet.
|
staticprotected |
|
staticprotected |
|
protected |
Definition at line 263 of file vtkTesting.h.
|
protected |
Definition at line 264 of file vtkTesting.h.
|
protected |
Definition at line 265 of file vtkTesting.h.
|
protected |
Definition at line 266 of file vtkTesting.h.
|
protected |
Definition at line 267 of file vtkTesting.h.
|
protected |
Definition at line 268 of file vtkTesting.h.
|
protected |
Definition at line 269 of file vtkTesting.h.
|
protected |
Definition at line 272 of file vtkTesting.h.
|
protected |
Definition at line 274 of file vtkTesting.h.
|
protected |
Definition at line 275 of file vtkTesting.h.
|
protected |
Definition at line 276 of file vtkTesting.h.