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.7 6.6 6.5
Change-Id: I9b2e947424774bb4456a6aefe04288b84401a9b7
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
bb10
Eirik Aavitsland 2024-01-04 13:55:23 +01:00
parent 6b0a5fe93b
commit ec324fd4af
1 changed files with 5 additions and 2 deletions

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