diff --git a/autotests/read/jxr/testcard_cmyk8.jxr b/autotests/read/jxr/testcard_cmyk8.jxr new file mode 100644 index 0000000..60bbc9c Binary files /dev/null and b/autotests/read/jxr/testcard_cmyk8.jxr differ diff --git a/autotests/read/jxr/testcard_cmyk8.jxr.json b/autotests/read/jxr/testcard_cmyk8.jxr.json new file mode 100644 index 0000000..6bfdf15 --- /dev/null +++ b/autotests/read/jxr/testcard_cmyk8.jxr.json @@ -0,0 +1,11 @@ +[ + { + "minQtVersion" : "6.8.0", + "fileName" : "testcard_cmyk8.tif" + }, + { + "maxQtVersion" : "6.7.99", + "unsupportedFormat" : true, + "comment" : "Qt versions lower than 6.8 do not support CMYK format so this test should be skipped." + } +] diff --git a/autotests/read/jxr/testcard_cmyk8.tif b/autotests/read/jxr/testcard_cmyk8.tif new file mode 100644 index 0000000..4930a2d Binary files /dev/null and b/autotests/read/jxr/testcard_cmyk8.tif differ diff --git a/autotests/readtest.cpp b/autotests/readtest.cpp index eed3852..2685c58 100644 --- a/autotests/readtest.cpp +++ b/autotests/readtest.cpp @@ -165,7 +165,13 @@ int main(int argc, char **argv) continue; } - QFileInfo expFileInfo = timg.compareImage(); + bool skipTest = false; + QFileInfo expFileInfo = timg.compareImage(skipTest); + if (skipTest) { + QTextStream(stdout) << "SKIP : " << fi.fileName() << ": image format not supported by current Qt version!\n"; + ++skipped; + continue; + } if (!formatStrings.contains(expFileInfo.suffix(), Qt::CaseInsensitive)) { // Work Around for CCBUG: 468288 QTextStream(stdout) << "SKIP : " << fi.fileName() << ": comparison image " << expFileInfo.fileName() << " cannot be loaded due to the lack of " diff --git a/autotests/templateimage.cpp b/autotests/templateimage.cpp index 7b8bed9..4aef330 100644 --- a/autotests/templateimage.cpp +++ b/autotests/templateimage.cpp @@ -28,9 +28,12 @@ bool TemplateImage::isTemplate() const return false; } -QFileInfo TemplateImage::compareImage() const +QFileInfo TemplateImage::compareImage(bool &skipTest) const { - auto fi = jsonImage(); + auto fi = jsonImage(skipTest); + if (skipTest) { + return {}; + } if (fi.exists()) { return fi; } @@ -55,7 +58,7 @@ QFileInfo TemplateImage::legacyImage() const return {}; } -QFileInfo TemplateImage::jsonImage() const +QFileInfo TemplateImage::jsonImage(bool &skipTest) const { auto fi = QFileInfo(QStringLiteral("%1.json").arg(m_fi.filePath())); if (!fi.exists()) { @@ -82,14 +85,19 @@ QFileInfo TemplateImage::jsonImage() const auto minQt = QVersionNumber::fromString(obj.value("minQtVersion").toString()); auto maxQt = QVersionNumber::fromString(obj.value("maxQtVersion").toString()); auto name = obj.value("fileName").toString(); + auto unsupportedFormat = obj.value("unsupportedFormat").toBool(); // filter - if (name.isEmpty()) + if (name.isEmpty() && !unsupportedFormat) continue; if (!minQt.isNull() && currentQt < minQt) continue; if (!maxQt.isNull() && currentQt > maxQt) continue; + if (unsupportedFormat) { + skipTest = true; + break; + } return QFileInfo(QStringLiteral("%1/%2").arg(fi.path(), name)); } diff --git a/autotests/templateimage.h b/autotests/templateimage.h index dd41645..b6bf350 100644 --- a/autotests/templateimage.h +++ b/autotests/templateimage.h @@ -42,9 +42,10 @@ public: /*! * \brief compareImage + * \param skipTest True if the test should be skipped (e.g. image format not supported by current Qt version). * \return The template image to use for the comparison. */ - QFileInfo compareImage() const; + QFileInfo compareImage(bool &skipTest) const; /*! * \brief suffixes @@ -61,9 +62,10 @@ private: /*! * \brief jsonImage + * \param skipTest True if the test should be skipped (not supported). * \return The template image read from the corresponding JSON. */ - QFileInfo jsonImage() const; + QFileInfo jsonImage(bool &skipTest) const; private: QFileInfo m_fi;