summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2023-06-14 15:35:24 +0200
committerAndras Timar <andras.timar@collabora.com>2023-06-18 11:55:02 +0200
commitd75896d3838bd4dd1bf009c16b35231273c91acc (patch)
tree0e5121bb6d151bcc4772155952681ba7f8263424 /sw
parent3780f966d01f7e7dd6c0e5eb807837bdbb695a75 (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) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153072 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-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 a1610c35dbbb..37ffaa0b2979 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -58,6 +58,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());
+ }
+}
+
CPPUNIT_TEST_FIXTURE(Test, testTdf121374_sectionHF)
{
loadAndReload("tdf121374_sectionHF.odt");