diff options
author | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2020-06-14 14:47:57 +0300 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2020-06-16 12:12:34 +0200 |
commit | 408f2a1c09a6563caf193384df8e1cac6e153fbb (patch) | |
tree | 5259590226c469f6ed107429e6303565511e0d9c /sw/qa | |
parent | 2293aa3a15a0fc0566c0e15872fdc215d0ab2fe6 (diff) |
tdf#133605: docx import: use ilvl value for list level import
Previous implementation was not aware about ilvl value which
declares a level number it is defining. So LO was able correctly
handle only lists were levels are defined in increasing order
starting from zero. Same problem was also with override lists: if
we just override only one some random level (for example ilvl=2
in bugdoc) it was applied to level 0.
Change-Id: If1f466fcbae0c82a8601e5b638e541d75aab665c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96268
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf133605.docx | bin | 0 -> 21862 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf133605_2.docx | bin | 0 -> 21978 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 51 |
3 files changed, 51 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf133605.docx b/sw/qa/extras/ooxmlexport/data/tdf133605.docx Binary files differnew file mode 100644 index 000000000000..d248d5e1a93b --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf133605.docx diff --git a/sw/qa/extras/ooxmlexport/data/tdf133605_2.docx b/sw/qa/extras/ooxmlexport/data/tdf133605_2.docx Binary files differnew file mode 100644 index 000000000000..8d3c5acba609 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf133605_2.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index e2c5f0dbf9b6..99e1d29c93d8 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -954,6 +954,57 @@ DECLARE_OOXMLEXPORT_TEST(testTdf120394, "tdf120394.docx") } } +DECLARE_OOXMLEXPORT_TEST(testTdf133605, "tdf133605.docx") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(3), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(0), getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT_EQUAL(OUString(CHAR_ZWSP), getProperty<OUString>(xPara, "ListLabelString")); + } + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(4), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1), getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty<OUString>(xPara, "ListLabelString")); + } + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(5), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2), getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT_EQUAL(OUString("1.1"), getProperty<OUString>(xPara, "ListLabelString")); + } + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(6), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(3), getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT_EQUAL(OUString("(a)"), getProperty<OUString>(xPara, "ListLabelString")); + } +} + +DECLARE_OOXMLEXPORT_TEST(testTdf133605_2, "tdf133605_2.docx") +{ + // About the same document as tdf133605.docx, but number definition has level definitions in random order + CPPUNIT_ASSERT_EQUAL(1, getPages()); + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(3), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(0), getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT_EQUAL(OUString(CHAR_ZWSP), getProperty<OUString>(xPara, "ListLabelString")); + } + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(4), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1), getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty<OUString>(xPara, "ListLabelString")); + } + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(5), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2), getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT_EQUAL(OUString("1.1"), getProperty<OUString>(xPara, "ListLabelString")); + } + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(6), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(3), getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT_EQUAL(OUString("(a)"), getProperty<OUString>(xPara, "ListLabelString")); + } +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf123757, "tdf123757.docx") { xmlDocUniquePtr pXml = parseExport("word/document.xml"); |