summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2023-06-14 15:35:24 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2023-06-14 17:02:26 +0200
commitfb3948cc559528013e77549f3502c8c1c954b7f6 (patch)
treec90ea1d40884ec2aaf0652924198e6883d5464a5 /sw/qa
parent2b317048d72d39a9d64b2eb8055eef7045ad449a (diff)
tdf#155690 writerfilter: fix import of bookmark in table...
... at start of section. (regression from commit 2e8aad6d45c53d554ccaf26de998ede708cfc289) Change-Id: I1e0e720758b607b69645b29c46f4092264289f9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153053 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 142aa77265361492e74707b08c5bcd366e7205ad)
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf155690.docxbin0 -> 17677 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport13.cxx47
2 files changed, 47 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf155690.docx b/sw/qa/extras/ooxmlexport/data/tdf155690.docx
new file mode 100644
index 000000000000..1839862688ee
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf155690.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 62ad331a8c64..aa6d6e557e79 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -61,6 +61,53 @@ DECLARE_OOXMLEXPORT_TEST(testTdf126994_lostPageBreak, "tdf126994_lostPageBreak.d
CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 3, getPages() );
}
+DECLARE_OOXMLEXPORT_TEST(testTdf155690, "tdf155690.docx")
+{
+ uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xBookmarks = xBookmarksSupplier->getBookmarks();
+ {
+ uno::Reference<text::XTextContent> xMark(xBookmarks->getByName("row1_1"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xMark.is());
+ // the problem was that the start was after the H
+ CPPUNIT_ASSERT_EQUAL(OUString("Hello world"), xMark->getAnchor()->getString());
+ }
+ {
+ uno::Reference<text::XTextContent> xMark(xBookmarks->getByName("row1_2"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xMark.is());
+ CPPUNIT_ASSERT_EQUAL(OUString("Hello world"), xMark->getAnchor()->getString());
+ }
+ {
+ uno::Reference<text::XTextContent> xMark(xBookmarks->getByName("row1_3"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xMark.is());
+ CPPUNIT_ASSERT_EQUAL(OUString("ello world"), xMark->getAnchor()->getString());
+ }
+ {
+ uno::Reference<text::XTextContent> xMark(xBookmarks->getByName("row1_4"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xMark.is());
+ CPPUNIT_ASSERT_EQUAL(OUString("Hello world"), xMark->getAnchor()->getString());
+ }
+ {
+ uno::Reference<text::XTextContent> xMark(xBookmarks->getByName("row2_1"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xMark.is());
+ CPPUNIT_ASSERT_EQUAL(OUString("Hello world"), xMark->getAnchor()->getString());
+ }
+ {
+ uno::Reference<text::XTextContent> xMark(xBookmarks->getByName("row2_1"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xMark.is());
+ CPPUNIT_ASSERT_EQUAL(OUString("Hello world"), xMark->getAnchor()->getString());
+ }
+ {
+ uno::Reference<text::XTextContent> xMark(xBookmarks->getByName("row2_3"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xMark.is());
+ CPPUNIT_ASSERT_EQUAL(OUString("ello world"), xMark->getAnchor()->getString());
+ }
+ {
+ uno::Reference<text::XTextContent> xMark(xBookmarks->getByName("row2_4"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xMark.is());
+ CPPUNIT_ASSERT_EQUAL(OUString("Hello world"), xMark->getAnchor()->getString());
+ }
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf121374_sectionHF, "tdf121374_sectionHF.odt")
{
uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);