summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-11-18 17:47:23 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-11-18 17:49:49 +0100
commit347566d6b6ae12c86aa2eb787cd97f2dcfe8ea2d (patch)
tree3639002edc4de3e6a78b7269aa7784c6d962427a /sw/qa
parent56020e09569ce078c108576b24efb66735cfc7c4 (diff)
DOCX export: put either hints or the para attr set into the para marker props
Commit d72237741ed1d8f976032ff2ee5d2a8702d3380e (abi#9930 DocxAttributeOutput::AddToAttrList: avoid duplicated attributes, 2014-11-02) added a quick fix to avoid writing duplicated attributes, but the validation problem of duplicated elements remained. Make sure that when writing paragraph marker properties, then we write either the hints at the end of the paragraph or the character attributes range of the paragraph properties, but not both. The only exception is the character style that's always set as a hint, as explained in commit 4bb872b1924453f22e90bdd14e2898a3e66d5551 (DOCX export: fix handling of paragraph mark on empty paragraphs, 2014-10-17). Change-Id: I494e5bb9871aa535532fef32bd344d8093e9f762
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ooxmlexport/data/paragraph-mark-nonempty.odtbin0 -> 8769 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx20
2 files changed, 20 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/paragraph-mark-nonempty.odt b/sw/qa/extras/ooxmlexport/data/paragraph-mark-nonempty.odt
new file mode 100644
index 000000000000..b12cbf607d67
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/paragraph-mark-nonempty.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 39c559aac378..964ec96c656a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -41,6 +41,19 @@ protected:
// If the testcase is stored in some other format, it's pointless to test.
return (OString(filename).endsWith(".docx") && std::find(vBlacklist.begin(), vBlacklist.end(), filename) == vBlacklist.end());
}
+
+ /**
+ * Validation handling
+ */
+ bool mustValidate(const char* filename) const SAL_OVERRIDE
+ {
+ const char* aWhitelist[] = {
+ "paragraph-mark-nonempty.odt"
+ };
+ std::vector<const char*> vWhitelist(aWhitelist, aWhitelist + SAL_N_ELEMENTS(aWhitelist));
+
+ return std::find(vWhitelist.begin(), vWhitelist.end(), filename) != vWhitelist.end();
+ }
protected:
bool CjkNumberedListTestHelper(sal_Int16 &nValue)
{
@@ -522,6 +535,13 @@ DECLARE_OOXMLEXPORT_TEST(testParagraphMark, "paragraph-mark.docx")
CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), getProperty<OUString>(getRun(getParagraph(1), 1), "CharStyleName"));
}
+DECLARE_OOXMLEXPORT_TEST(testParagraphMarkNonempty, "paragraph-mark-nonempty.odt")
+{
+ if (xmlDocPtr pXmlDoc = parseExport())
+ // There were two <w:sz> elements, make sure the 40 one is is dropped and the 20 one is kept.
+ assertXPath(pXmlDoc, "//w:p/w:pPr/w:rPr/w:sz", "val", "20");
+}
+
DECLARE_OOXMLEXPORT_TEST(testPageBreakBefore, "page-break-before.docx")
{
// This was style::BreakType_PAGE_BEFORE, i.e. page break wasn't ignored, as it should have been.