summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2023-06-05 12:35:22 -0400
committerJustin Luth <jluth@mail.com>2023-06-06 01:17:25 +0200
commit026924b192031769449814b9166a7b8d37c869f8 (patch)
treeb010d4d09b4f2d353342090fec892fe378958c2f /sw
parenta6041b49b9ced911682973be5522df3190f6baa7 (diff)
tdf#153040: unit test
make CppunitTest_sw_core_text \ CPPUNIT_TEST_NAME=testDropdownContentControlPDF2 Still wrong/poor with this unit test: -wrong font for rich/plain text content -slightly offset (shifted right/shifted down) placement (tested in Linux Evince anyway). Change-Id: I586d46eaf5cdf9fbf44a6913f295c440240d180a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152634 Reviewed-by: Justin Luth <jluth@mail.com> Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/core/text/data/tdf153040.docxbin0 -> 16322 bytes
-rw-r--r--sw/qa/core/text/text.cxx24
2 files changed, 24 insertions, 0 deletions
diff --git a/sw/qa/core/text/data/tdf153040.docx b/sw/qa/core/text/data/tdf153040.docx
new file mode 100644
index 000000000000..27dc07601ab0
--- /dev/null
+++ b/sw/qa/core/text/data/tdf153040.docx
Binary files differ
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 36332102e3b0..f321a01c3aa5 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -1016,6 +1016,30 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testDropdownContentControlPDF)
pAnnotation->getFormFieldType(pPdfDocument.get()));
}
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testDropdownContentControlPDF2)
+{
+ std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
+ if (!pPDFium)
+ return;
+
+ createSwDoc("tdf153040.docx");
+
+ save("writer_pdf_Export");
+
+ // Make sure that a dropdown form widget is emitted:
+ std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport();
+ std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
+
+ CPPUNIT_ASSERT_EQUAL(4, pPage->getAnnotationCount());
+ std::unique_ptr<vcl::pdf::PDFiumAnnotation> pAnnotation = pPage->getAnnotation(0);
+ CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Widget, pAnnotation->getSubType());
+ // Also check the form widget type (our dropdown is called combo in PDF terms):
+ CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFFormFieldType::ComboBox,
+ pAnnotation->getFormFieldType(pPdfDocument.get()));
+ // Without tdf#153040's fix, this would have been the empty OUString()
+ CPPUNIT_ASSERT_EQUAL(OUString("Apfel"), pAnnotation->getFormFieldValue(pPdfDocument.get()));
+}
+
CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testDateContentControlPDF)
{
std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();