From 3028e67fbee0a6c99a8e260129a0c62062589d22 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Thu, 4 Jan 2024 13:55:23 +0100 Subject: [PATCH] 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 (cherry picked from commit ec324fd4afd1bf843ea601447f40c1e375efe659) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit ca705abe06fcaa293fa41da09218bb678e6bddea) --- tests/baseline/painting/tst_baseline_painting.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/baseline/painting/tst_baseline_painting.cpp b/tests/baseline/painting/tst_baseline_painting.cpp index f9738b61e8d..475f0d89742 100644 --- a/tests/baseline/painting/tst_baseline_painting.cpp +++ b/tests/baseline/painting/tst_baseline_painting.cpp @@ -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