[vtkusers] regression testing
Miroslav Drahos
mdrahos at thinksurgical.com
Fri Jan 16 19:42:37 EST 2015
Hi vtk folk,
I have set up ctest/cdash testing framework (using vtk 5.10 as model), but one piece of puzzle I cannot figure out -- regression testing. If anyone could point me what I am missing, I would greatly appreciate it!
I write the test, e.g. testMyWidget.cpp, containing the "main" function just as vtk tests do:
int testMyWidget (int argc, char ** argv)
{
int retval = 0;
// do stuff here, create rendering pipeline and draw into vtkRenderWindow
retval = vtkRegressionTestImage(rw);
if (retval == vtkRegressionTester::DO_INTERACTOR)
iren->Start();
return retval;
}
I have a baseline image saved as ../../data/Baseline/testMyWidget.png.
To run the test manually, I invoke:
make && ./myCppTests testMyWidget -V Baseline/testMyWidget.png -T Temporary -D ../../data/
And always keep getting ImageError, although I just took a screenshot of the renderwindow (.png format -- see below) so it is current. Error is set to default 10.
<DartMeasurement name="ImageError" type="numeric/double">0</DartMeasurement><DartMeasurement name="BaselineImage" type="text/string">Standard</DartMeasurement><DartMeasurement name="WallTime" type="numeric/double">0.0631258</DartMeasurement>
My baseline screenshot was created like this:
void ODVtkIO::screenshot(vtkRenderWindow * rw, const std::string& fname)
{
if (rw == NULL)
return;
VTK_CREATE(vtkWindowToImageFilter, w2i);
w2i->SetInput(rw);
w2i->ReadFrontBufferOff(); // added to match vtkTesting::RegressionTest(double thresh, ostream &os)
rw->Render();
w2i->Modified(); // See doc http://www.vtk.org/doc/nightly/html/classvtkWindowToImageFilter.html#details
VTK_CREATE(vtkPNGWriter, writer);
writer->SetFileName(fname.c_str());
writer->SetInputConnection(w2i->GetOutputPort());
writer->Write();
}
vtkTesting::RegressionTest(double, ostream&) takes screenshots same way. Yet, I am getting ImageError. Why?
Cheers,
Miro
More information about the vtkusers
mailing list