vcl/qa/cppunit/pdfexport/pdfexport.cxx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
New commits: commit 914ddbb8db808185a6b9902ef34780e0ab9b031d Author: Marc Mondesir <timepilot3...@gmail.com> AuthorDate: Mon Jul 14 17:41:46 2025 -0700 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Thu Jul 17 07:04:32 2025 +0200 Update pdfexport unit test for new font version LibreOffice 25.2 (Windows 10) includes a new version of font Reem Kufi, used in testTdf66597_2. This is a "variable" font, instead of a "static" font like LO 24 installed. LO's PDF writing code stores a variable font's name under "Name", while a static font's name is under "BaseFont". Update the unit test to check "Name" field if "BaseFont" is not found, when getting the font name. Unit test functionality is unchanged. Change-Id: If87f9a03fa1b08585cfcec4a75465c84d89e5b40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187887 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 2970c828d5f6..5024de86b201 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -1715,12 +1715,24 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_2) auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { + // Static font identified under "BaseFont" auto pName = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("BaseFont"_ostr)); - CPPUNIT_ASSERT_MESSAGE("No BaseFont element found in font!", pName); - auto aName = pName->GetValue().copy(7); // skip the subset id + OString fontName; + if (pName) + { + fontName = pName->GetValue().copy(7); // skip the subset id + } + else // Variable font identified under "Name", try that + { + pName + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Name"_ostr)); + CPPUNIT_ASSERT_MESSAGE("No 'BaseFont' or 'Name' element found for font!", + pName); + fontName = pName->GetValue(); + } CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected font name", "ReemKufi-Regular"_ostr, - aName); + fontName); auto pToUnicodeRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( pObject->Lookup("ToUnicode"_ostr));