vcl/qa/cppunit/pdfexport/pdfexport.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
New commits: commit 9f682acf75d56c82b40114bb9fceb29d837de2dd Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Sep 8 12:39:14 2022 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Thu Sep 8 13:08:14 2022 +0200 Related: tdf#150786 workaround unit test failure The test detects a different problem, so this issue is unrelated to the detection. Indeed, after this issue is fixed, the test could be restored to test it all, complementing the test coverage. Change-Id: Ie3c8621d76bf1ccb58ffbdde875a7adb7bceb76a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139639 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 0168c157b0c2..840dae3ac561 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -2648,12 +2648,17 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testFormFontName) CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFObjectType::String, pAnnot->getValueType("DA")); OUString aDA = pAnnot->getString("DA"); + // Workaround tdf#150786: skip color. It may be either "0 0 0 rg /TiRo 12 Tf" on light mode, + // or "1 1 1 rg /TiRo 12 Tf" on dark mode. + sal_Int32 rgPos = aDA.indexOf(u"rg"); + CPPUNIT_ASSERT(rgPos >= 0); + // Without the accompanying fix in place, this test would have failed with: - // - Expected: 0 0 0 rg /TiRo 12 Tf - // - Actual : 0 0 0 rg /F2 12 Tf + // - Expected: rg /TiRo 12 Tf + // - Actual : rg /F2 12 Tf // i.e. Liberation Serif was exposed as a form font as-is, without picking the closest built-in // font. - CPPUNIT_ASSERT_EQUAL(OUString("0 0 0 rg /TiRo 12 Tf"), aDA); + CPPUNIT_ASSERT_EQUAL(OUString("rg /TiRo 12 Tf"), aDA.copy(rgPos)); } // Check we don't have duplicated objects when we reexport the PDF multiple