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.6 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>
This commit is contained in:
Eirik Aavitsland 2024-01-04 13:55:23 +01:00 committed by Qt Cherry-pick Bot
parent 2634ad2e6c
commit ca705abe06

View File

@ -421,7 +421,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();
@ -430,7 +433,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