Skip to content
Permalink
Browse files

Handle save and load error for rendered image

  • Loading branch information
Sandro Santilli
Sandro Santilli committed Feb 19, 2015
1 parent 5357263 commit cda4df417742daf76ea5f84fb1b12c997ae052f2
Showing with 18 additions and 1 deletion.
  1. +18 −1 src/core/qgsrenderchecker.cpp
@@ -214,7 +214,15 @@ bool QgsRenderChecker::runTest( QString theTestName,

myImage.setDotsPerMeterX( myExpectedImage.dotsPerMeterX() );
myImage.setDotsPerMeterY( myExpectedImage.dotsPerMeterY() );
myImage.save( mRenderedImageFile, "PNG", 100 );
if ( ! myImage.save( mRenderedImageFile, "PNG", 100 ) )
{
qDebug() << "QgsRenderChecker::runTest failed - Could not save rendered image to " << mRenderedImageFile;
mReport = "<table>"
"<tr><td>Test Result:</td><td>Expected Result:</td></tr>\n"
"<tr><td>Nothing rendered</td>\n<td>Failed because Rendered "
"Image File could not be saved.</td></tr></table>\n";
return false;
}

//create a world file to go with the image...

@@ -266,6 +274,15 @@ bool QgsRenderChecker::compareImages( QString theTestName,
//
QImage myExpectedImage( mExpectedImageFile );
QImage myResultImage( mRenderedImageFile );
if ( myResultImage.isNull() )
{
qDebug() << "QgsRenderChecker::runTest failed - Could not load rendered image from " << mRenderedImageFile;
mReport = "<table>"
"<tr><td>Test Result:</td><td>Expected Result:</td></tr>\n"
"<tr><td>Nothing rendered</td>\n<td>Failed because Rendered "
"Image File could not be loaded.</td></tr></table>\n";
return false;
}
QImage myDifferenceImage( myExpectedImage.width(),
myExpectedImage.height(),
QImage::Format_RGB32 );

0 comments on commit cda4df4

Please sign in to comment.
You can’t perform that action at this time.