Skip to content

Commit cafeaa6

Browse files
author
Sandro Santilli
committed
Give a better error message when expected image is missing
Avoids the confusing "pre-set DPI not equal to painter's DPI" message
1 parent e38b13c commit cafeaa6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/core/qgsrenderchecker.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,15 @@ bool QgsRenderChecker::runTest( QString theTestName,
177177
// Load the expected result pixmap
178178
//
179179
QImage myExpectedImage( mExpectedImageFile );
180+
if ( myExpectedImage.isNull() )
181+
{
182+
qDebug() << "QgsRenderChecker::runTest failed - Could not load expected image from " << mExpectedImageFile;
183+
mReport = "<table>"
184+
"<tr><td>Test Result:</td><td>Expected Result:</td></tr>\n"
185+
"<tr><td>Nothing rendered</td>\n<td>Failed because Expected "
186+
"Image File could not be loaded.</td></tr></table>\n";
187+
return false;
188+
}
180189
mMatchTarget = myExpectedImage.width() * myExpectedImage.height();
181190
//
182191
// Now render our layers onto a pixmap

0 commit comments

Comments
 (0)