[vtkusers] regression testing
Miroslav Drahos
mdrahos at thinksurgical.com
Fri Jan 16 21:18:01 EST 2015
I see it now. The ImageError is the value of the error metric, and indeed it is zero. The test was failing because I was returning the retval variable:
retval = vtkRegressionTestImage(rw);
if (retval == vtkRegressionTester::DO_INTERACTOR)
iren->Start();
return retval; // Should be return !retval;
where I should have been returning !retval... Duh...
Thank you tons!!
________________________________________
From: Bill Lorensen [bill.lorensen at gmail.com]
Sent: Friday, January 16, 2015 5:29 PM
To: Miroslav Drahos
Cc: VTK Users
Subject: Re: [vtkusers] regression testing
The reported image error is zero. The test passed.
On Jan 16, 2015 7:51 PM, "Miroslav Drahos" <mdrahos at thinksurgical.com<mailto:mdrahos at thinksurgical.com>> wrote:
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
_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Search the list archives at: http://markmail.org/search/?q=vtkusers
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list