[Libreoffice-commits] core.git: sw/qa

Justin Luth justin_luth at sil.org
Tue Feb 13 04:34:24 UTC 2018


 sw/qa/extras/ooxmlexport/data/tdf106541_noinheritChapterNumbering.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                              |   17 ++++++++++
 2 files changed, 17 insertions(+)

New commits:
commit ed8221aa0b1550834f8ca18ca3af21f2a41e678d
Author: Justin Luth <justin_luth at sil.org>
Date:   Sat Feb 10 13:38:34 2018 +0300

    tdf#106541 preventative unit test: don't force inheritance
    
    In LO, it appears to be impossible for a style based on a
    Chapter Numbering List style to inherit the numbering and outline
    level. Ensure that any fix for Word-authored documents that DO
    inherit this don't break round-tripping natively created docx files.
    
    Change-Id: I0cd4c25fbc7cd60346fcd949d5a3b89c2b311dbd
    Reviewed-on: https://gerrit.libreoffice.org/49544
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf106541_noinheritChapterNumbering.odt b/sw/qa/extras/ooxmlexport/data/tdf106541_noinheritChapterNumbering.odt
new file mode 100644
index 000000000000..2408ecf550e0
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf106541_noinheritChapterNumbering.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 00448c979dbe..b7acdffbdc16 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -346,6 +346,23 @@ DECLARE_OOXMLEXPORT_TEST(testNumberingFont, "numbering-font.docx")
     CPPUNIT_ASSERT_EQUAL(OUString("Verdana"), getProperty<OUString>(xStyle, "CharFontName"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf106541_noinheritChapterNumbering, "tdf106541_noinheritChapterNumbering.odt")
+{
+    // in LO, it appears that styles based on the Chapter Numbering style explicitly sets the
+    // numbering style/outline level to 0 by default, and prevents inheriting directly from "Outline" style.
+    // Adding this preventative unit test to ensure that any fix for tdf106541 doesn't make incorrect assumptions.
+    CPPUNIT_ASSERT_EQUAL(OUString("Outline"), getProperty<OUString>(getParagraph(1), "NumberingStyleName"));
+    OUString sPara3NumberingStyle = getProperty<OUString>(getParagraph(3), "NumberingStyleName");
+    CPPUNIT_ASSERT_EQUAL(sPara3NumberingStyle, getProperty<OUString>(getParagraph(4), "NumberingStyleName"));
+
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+    assertXPath(pXmlDoc, "//body/txt/Special", 3);  //three of the four paragraphs have numbering
+    assertXPath(pXmlDoc, "//body/txt[1]/Special", "rText", "1");
+    assertXPath(pXmlDoc, "//body/txt[2]/Special", 0); //second paragraph style disables numbering
+    assertXPath(pXmlDoc, "//body/txt[3]/Special", "rText", "I.");
+    assertXPath(pXmlDoc, "//body/txt[4]/Special", "rText", "II.");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf53856_conflictingStyle, "tdf53856_conflictingStyle.docx")
 {
     // The "Text" style conflicted with builtin paragraph style Caption -> Text


More information about the Libreoffice-commits mailing list