summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2021-06-26 07:41:53 +0200
committerJustin Luth <justin_luth@sil.org>2021-06-26 09:16:53 +0200
commit79bd4eb98535197d3177f262bce94d35badab4f4 (patch)
tree476ec6c860477db0d6744abbbc7da8f676579c6a /sw
parent1db375e06516d0532f01f9585986617aa3079866 (diff)
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@sil.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ww8export/data/tdf104239_chapterNumbering.docbin0 -> 10240 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export3.cxx16
2 files changed, 16 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf104239_chapterNumbering.doc
Binary files 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.