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

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Sat Jun 26 07:17:34 UTC 2021


 sw/qa/extras/ww8export/data/tdf104239_chapterNumbering.doc |binary
 sw/qa/extras/ww8export/ww8export3.cxx                      |   16 +++++++++++++
 2 files changed, 16 insertions(+)

New commits:
commit 79bd4eb98535197d3177f262bce94d35badab4f4
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Sat Jun 26 07:41:53 2021 +0200
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Sat Jun 26 09:16:53 2021 +0200

    tdf#104329 doc import pre-emptive unit test: ensure ChapterNumbering
    
    So chapter numbering is a complete scourge for importing numbering,
    but after many unit tests proving my attempted solutions were
    incompletely, I finally found one that worked great.
    
    Unfortunately, I made a major coding blunder, and effectively
    killed chapter numbering unconditionally. But it fixed every
    unit test problem!!
    
    So that pretty much proves that chapter numbering is trash,
    but for LO it still has some important functions,
    so ensure that at least on a clean, nice, LO-authored document
    chapter numbering still round-trips nicely.
    
    Change-Id: I37491ecb638aa79fd7c7621e9cf0ea6282397b83
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117919
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ww8export/data/tdf104239_chapterNumbering.doc b/sw/qa/extras/ww8export/data/tdf104239_chapterNumbering.doc
new file mode 100644
index 000000000000..2e237b2e33c6
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf104239_chapterNumbering.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 087d66a6573c..b9a2a847c986 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -790,6 +790,22 @@ DECLARE_WW8EXPORT_TEST(testTdf106541_cancelOutline, "tdf106541_cancelOutline.doc
     CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString"));
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf104239_chapterNumbering, "tdf104239_chapterNumbering.doc")
+{
+    uno::Reference<text::XChapterNumberingSupplier> xNumberingSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xNumberingRules = xNumberingSupplier->getChapterNumberingRules();
+
+    comphelper::SequenceAsHashMap hashMap(xNumberingRules->getByIndex(0));
+    CPPUNIT_ASSERT(hashMap["HeadingStyleName"].get<OUString>().match("Heading 1"));
+    sal_uInt16 nNumberingType = style::NumberingType::CHARS_UPPER_LETTER_N;
+    CPPUNIT_ASSERT_EQUAL(nNumberingType, hashMap["NumberingType"].get<sal_uInt16>());
+
+    hashMap = xNumberingRules->getByIndex(5);
+    CPPUNIT_ASSERT(hashMap["HeadingStyleName"].get<OUString>().match("Heading 6"));
+    nNumberingType = style::NumberingType::ARABIC;
+    CPPUNIT_ASSERT_EQUAL(nNumberingType, hashMap["NumberingType"].get<sal_uInt16>());
+}
+
 DECLARE_WW8EXPORT_TEST(testTdf106541_inheritChapterNumbering, "tdf106541_inheritChapterNumbering.doc")
 {
     // The level and numbering are inherited from Heading 1.


More information about the Libreoffice-commits mailing list