Fix the pdf testing in the painting baseline test

The pdf testing relies on the sips tool in macOS to render generated
pdfs into pngs. In recent macOS updates, that tool has changed
behavior, and no longer produces the desired output. Fix this by using
a custom pdf page size, instead of relying on cropping behavior in
sips.

Pick-to: 6.5
Change-Id: I9b2e947424774bb4456a6aefe04288b84401a9b7
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit ec324fd4afd1bf843ea601447f40c1e375efe659)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit ca705abe06fcaa293fa41da09218bb678e6bddea)
This commit is contained in:
Eirik Aavitsland 2024-01-04 13:55:23 +01:00 committed by Qt Cherry-pick Bot
parent f33405782b
commit 3028e67fbe

View File

@ -419,7 +419,10 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format, co
pdfFile.open();
QPdfWriter writer(&pdfFile);
writer.setPdfVersion(QPdfWriter::PdfVersion_1_6);
writer.setResolution(150);
QPageSize pageSize(QSize(800, 800), QStringLiteral("LancePage"), QPageSize::ExactMatch);
writer.setPageSize(pageSize);
writer.setPageMargins(QMarginsF());
writer.setResolution(72);
paint(&writer, engine, format, script, QFileInfo(filePath).absoluteFilePath());
pdfFile.close();
@ -428,7 +431,7 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format, co
pngFile.open(); // Just create the file name
pngFile.close();
QProcess proc;
const char *rawArgs = "-s format png --cropOffset 20 20 -c 800 800 -o";
const char *rawArgs = "-s format png -o";
QStringList argList = QString::fromLatin1(rawArgs).split(QLatin1Char(' '));
proc.start(QLatin1String("sips"), argList << pngFile.fileName() << pdfFile.fileName());
proc.waitForFinished(2 * 60 * 1000); // May need some time