Skip to content

Commit

Permalink
Fix the pdf testing in the painting baseline test
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
aavit committed Jan 8, 2024
1 parent 6b0a5fe commit ec324fd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/baseline/painting/tst_baseline_painting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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
Expand Down

0 comments on commit ec324fd

Please sign in to comment.