summaryrefslogtreecommitdiff
path: root/sw/qa/core/text/text.cxx
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2024-01-23 15:28:26 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2024-01-24 15:40:25 +0100
commit863a4cde77a5045d44b1da583f00c0a72762f19a (patch)
tree6fcc6bbd3bd757582e03c572df4f6ed01196cee9 /sw/qa/core/text/text.cxx
parentfd156c9c2ff1b10e1f3d72c0001f36676e412e5b (diff)
tdf#159336: export EditWidget with multiline enabled
How to reproduce it from scratch: 1. Open writer 2. Form - Content Controls - Rich Text/Plain Text 3. Split the control intro different lines 4. Export to PDF -> The content control is displayed in one line Change-Id: Ia8666c8a6520e94ae06693ea8767c1d79aa5d3a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162446 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
Diffstat (limited to 'sw/qa/core/text/text.cxx')
-rw-r--r--sw/qa/core/text/text.cxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index d61492d43d61..690fc333afb5 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -20,6 +20,7 @@
#include <vcl/gdimtf.hxx>
#include <vcl/metaact.hxx>
#include <vcl/filter/PDFiumLibrary.hxx>
+#include <vcl/filter/pdfdocument.hxx>
#include <comphelper/propertyvalue.hxx>
#include <editeng/fhgtitem.hxx>
#include <editeng/wghtitem.hxx>
@@ -115,6 +116,40 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testLastBibliographyPdfExport)
CPPUNIT_ASSERT(true);
}
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf159336)
+{
+ createSwDoc("tdf159336.odt");
+ save("writer_pdf_Export");
+
+ vcl::filter::PDFDocument aDocument;
+ SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+ CPPUNIT_ASSERT(aDocument.Read(aStream));
+
+ // The document has one page.
+ std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size());
+
+ auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots"_ostr));
+ CPPUNIT_ASSERT(pAnnots);
+
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pAnnots->GetElements().size());
+ auto pAnnotReference
+ = dynamic_cast<vcl::filter::PDFReferenceElement*>(pAnnots->GetElements()[0]);
+ CPPUNIT_ASSERT(pAnnotReference);
+ vcl::filter::PDFObjectElement* pAnnot = pAnnotReference->LookupObject();
+ CPPUNIT_ASSERT(pAnnot);
+ CPPUNIT_ASSERT_EQUAL(
+ "Annot"_ostr,
+ static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr))->GetValue());
+ CPPUNIT_ASSERT_EQUAL(
+ "Widget"_ostr,
+ static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr))->GetValue());
+ // Ff = multiline
+ auto pFf = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("Ff"_ostr));
+ CPPUNIT_ASSERT(pFf);
+ CPPUNIT_ASSERT_EQUAL(4096.0, pFf->GetValue());
+}
+
CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testBibliographyUrlPdfExport)
{
// Given a document with a bibliography entry field: