Fix tst_QImageReader::imageFormatBeforeRead

The test was never loading images from a valid path, and thus never
had any fullfill the base option which meant nothing was tested.

Making it work revealed that the Format option on BMP formats doesn't
predict semi-transparent files.

Change-Id: I7035a0f63ebfbce940ce7a17a6142cf177480798
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2017-06-07 16:20:10 +02:00 committed by J-P Nurmi
parent f5f98da54e
commit 68bcbe2470

View File

@ -728,13 +728,15 @@ void tst_QImageReader::imageFormatBeforeRead()
SKIP_IF_UNSUPPORTED(format);
QImageReader reader(fileName);
QImageReader reader(prefix + fileName);
QVERIFY(reader.canRead());
if (reader.supportsOption(QImageIOHandler::ImageFormat)) {
QImage::Format fileFormat = reader.imageFormat();
QCOMPARE(fileFormat, imageFormat);
QSize size = reader.size();
QImage image(size, fileFormat);
QVERIFY(reader.read(&image));
QEXPECT_FAIL("bmp-3", "Semi-transparent BMPs not predicted", Continue);
QCOMPARE(image.format(), fileFormat);
}
}