summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2021-08-19 15:06:35 +0200
committerJustin Luth <justin_luth@sil.org>2021-08-23 06:30:53 +0200
commit2aca75ef2ac84360d13e9000ba3063a7a42b6f6f (patch)
treef7d3995ac4f8d4629b9ad44967e5a9eb8bb70e94 /sw/qa/extras
parent50f0e8c7880122a05585a2233f6f35d0dfee0385 (diff)
tdf#143692 writerfilter: fix outlineLevel import x3
First, illegal values don't mean "use body level". It means "inherit the value value from the style". So just ignore illegal values. Secondly, styles without any explicit setting (a -1) where being incorrectly specified as "-1 + 1", i.e. body level(0) - meaning that inheritance was always lost. Thirdly, the body level value is necessary in order to cancel inheritance from a style. So the style must be able to set a value of 9. Change-Id: I2161085181527fb321dbcc00636513330dd8ca1a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120756 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf143692_outlineLevelTortureTest.docxbin0 -> 20964 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport16.cxx34
2 files changed, 34 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf143692_outlineLevelTortureTest.docx b/sw/qa/extras/ooxmlexport/data/tdf143692_outlineLevelTortureTest.docx
new file mode 100644
index 000000000000..7072b47218d6
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf143692_outlineLevelTortureTest.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index d1f0603ec884..10cb7f1126ed 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -329,6 +329,40 @@ DECLARE_OOXMLEXPORT_TEST(testTdf141966_chapterNumberTortureTest, "tdf141966_chap
CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString"));
}
+DECLARE_OOXMLEXPORT_TEST(testTdf143692_outlineLevelTortureTest, "tdf143692_outlineLevelTortureTest.docx")
+{
+ uno::Reference<beans::XPropertySet> xPara(getParagraph(1, "Head non Toc style"), uno::UNO_QUERY);
+ // fixed missing inherit from Heading 1
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty<sal_Int16>(xPara, "OutlineLevel"));
+
+ xPara.set(getParagraph(2, "noInheritHeading1"), uno::UNO_QUERY);
+ // fixed body level not cancelling inherited level
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xPara, "OutlineLevel"));
+
+ xPara.set(getParagraph(4, "illegal -3"), uno::UNO_QUERY);
+ // illegal value is ignored, so inherit from Heading 1
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty<sal_Int16>(xPara, "OutlineLevel"));
+
+ xPara.set(getParagraph(5, "Heading 1 with invalid direct -2"), uno::UNO_QUERY);
+ // fixed illegal does not mean body level, it means inherit from style.
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty<sal_Int16>(xPara, "OutlineLevel"));
+
+ xPara.set(getParagraph(7, "InheritCN3"), uno::UNO_QUERY);
+ // fixed Chapter Numbering cancelling inheritance
+ //CPPUNIT_ASSERT_EQUAL(sal_Int16(3), getProperty<sal_Int16>(xPara, "OutlineLevel"));
+
+ xPara.set(getParagraph(8, "noInheritCN3"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xPara, "OutlineLevel"));
+
+ xPara.set(getParagraph(9, "override6CN3"), uno::UNO_QUERY);
+ // fixed body level not cancelling inherited level
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(6), getProperty<sal_Int16>(xPara, "OutlineLevel"));
+
+ xPara.set(getParagraph(10, "illegal 25"), uno::UNO_QUERY);
+ // fixed illegal value is ignored, so inherit from List Level (Chapter Numbering)
+ //CPPUNIT_ASSERT_EQUAL(sal_Int16(3), getProperty<sal_Int16>(xPara, "OutlineLevel"));
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf132752, "tdf132752.docx")
{
CPPUNIT_ASSERT_EQUAL(sal_Int32(1801), getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin"));