diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-09-20 08:30:53 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-09-20 09:22:28 +0200 |
commit | addfb3cce0f7ce8fbd0b169d467b6956ed95dbb5 (patch) | |
tree | 44ad218bf4ee32be4b77003c0deea853ad60e41e /sw/qa/core/text/text.cxx | |
parent | 6754b647c145cded1f54b49d53d37ad35ace211c (diff) |
sw content controls: add a11y description for PDF export
Acrobat Reader shows these descriptions on mouse hovering on a form
widget.
Change-Id: I8614222e46c992baca8a57b13a948f88973e8911
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140215
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/qa/core/text/text.cxx')
-rw-r--r-- | sw/qa/core/text/text.cxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index 12dc50884f23..245f8c230ca6 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -35,6 +35,7 @@ #include <fmtfsize.hxx> #include <IDocumentRedlineAccess.hxx> #include <formatcontentcontrol.hxx> +#include <strings.hrc> constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/text/data/"; @@ -623,6 +624,12 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testContentControlPDF) SwDoc* pDoc = createSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::RICH_TEXT); + pWrtShell->SttEndDoc(/*bStt=*/true); + pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); + sal_Int32 nPlaceHolderLen = SwResId(STR_CONTENT_CONTROL_PLACEHOLDER).getLength(); + pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, nPlaceHolderLen, + /*bBasicCall=*/false); + pWrtShell->Insert("mydesc"); // When exporting to PDF: StoreToTempFile("writer_pdf_Export"); @@ -635,6 +642,12 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testContentControlPDF) // - Actual : 0 // i.e. the content control was just exported as normal text. CPPUNIT_ASSERT_EQUAL(1, pPage->getAnnotationCount()); + std::unique_ptr<vcl::pdf::PDFiumAnnotation> pAnnotation = pPage->getAnnotation(0); + CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Widget, pAnnotation->getSubType()); + + // Also verify that the widget description is correct, it was empty: + CPPUNIT_ASSERT_EQUAL(OUString("mydesc"), + pAnnotation->getFormFieldAlternateName(pPdfDocument.get())); } CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testCheckboxContentControlPDF) |