summaryrefslogtreecommitdiff
path: root/sw/qa/extras/odfexport
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-09-28 09:37:10 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-09-28 10:27:20 +0200
commit05f863844d9a5613250e8d787e32752b270ec4d3 (patch)
tree8c8c0d5db30d3390346b586dd6ac4a91e3a34058 /sw/qa/extras/odfexport
parent4dd6af856d574ad66ebb4b822a36ba70af9945e2 (diff)
sw: paragraph styles: add ODT filter for a linked character style
And the same in the other direction: link a para style from a char style. With this, the ODT filter is on par with the DOCX one for this feature. Change-Id: Idd994b933672ab47a5f87a75c92abc137d3c73b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122753 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/qa/extras/odfexport')
-rw-r--r--sw/qa/extras/odfexport/data/style-link.fodt15
-rw-r--r--sw/qa/extras/odfexport/odfexport2.cxx21
2 files changed, 36 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/data/style-link.fodt b/sw/qa/extras/odfexport/data/style-link.fodt
new file mode 100644
index 000000000000..76c36c698845
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/style-link.fodt
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:styles>
+ <style:style style:name="List_20_Paragraph" style:display-name="List Paragraph" style:family="paragraph" loext:linked-style-name="List_20_Paragraph_20_Char"/>
+ <style:style style:name="List_20_Paragraph_20_Char" style:display-name="List Paragraph Char" style:family="text" loext:linked-style-name="List_20_Paragraph"/>
+ </office:styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard"/>
+ </office:master-styles>
+ <office:body>
+ <office:text>
+ <text:p/>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx
index bb05521f08fc..c73dc611db04 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -184,6 +184,27 @@ DECLARE_ODFEXPORT_TEST(testListFormatOdt, "listformat.odt")
}
}
+CPPUNIT_TEST_FIXTURE(Test, testStyleLink)
+{
+ // Given a document with a para and a char style that links each other, when loading that
+ // document:
+ load(mpTestDocumentPath, "style-link.fodt");
+
+ // Then make sure the char style links the para one:
+ uno::Any aCharStyle = getStyles("CharacterStyles")->getByName("List Paragraph Char");
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: List Paragraph
+ // - Actual :
+ // i.e. the linked style was lost on import.
+ CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph"), getProperty<OUString>(aCharStyle, "LinkStyle"));
+ uno::Any aParaStyle = getStyles("ParagraphStyles")->getByName("List Paragraph");
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: List Paragraph Char
+ // - Actual :
+ // i.e. the linked style was lost on import.
+ CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph Char"), getProperty<OUString>(aParaStyle, "LinkStyle"));
+}
+
// This test started in LO 7.2. Use the odfexport.cxx if you intend to backport to 7.1.
CPPUNIT_PLUGIN_IMPLEMENT();