diff options
Diffstat (limited to 'sw/qa/extras/odfexport/odfexport2.cxx')
-rw-r--r-- | sw/qa/extras/odfexport/odfexport2.cxx | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index b58e9e9a1d1a..bbe5d7f193e7 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -50,6 +50,72 @@ DECLARE_ODFEXPORT_TEST(testTdf137199, "tdf137199.docx") CPPUNIT_ASSERT_EQUAL(OUString("HELLO2WORLD!"), getProperty<OUString>(getParagraph(4), "ListLabelString")); } +DECLARE_ODFEXPORT_TEST(testListFormatDocx, "listformat.docx") +{ + // Ensure in resulting ODT we also have not just prefix/suffux, but custom delimiters + CPPUNIT_ASSERT_EQUAL(OUString(">1<"), getProperty<OUString>(getParagraph(1), "ListLabelString")); + CPPUNIT_ASSERT_EQUAL(OUString(">>1/1<<"), getProperty<OUString>(getParagraph(2), "ListLabelString")); + CPPUNIT_ASSERT_EQUAL(OUString(">>1/1/1<<"), getProperty<OUString>(getParagraph(3), "ListLabelString")); + CPPUNIT_ASSERT_EQUAL(OUString(">>1/1/2<<"), getProperty<OUString>(getParagraph(4), "ListLabelString")); + + // Check also that in numbering styles we have num-list-format defined + xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='1']", "num-list-format", ">%1%<"); + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='2']", "num-list-format", ">>%1%/%2%<<"); + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='3']", "num-list-format", ">>%1%/%2%/%3%<<"); + + // But for compatibility there are still prefix/suffix + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='1']", "num-prefix", ">"); + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='1']", "num-suffix", "<"); + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='2']", "num-prefix", ">>"); + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='2']", "num-suffix", "<<"); + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='3']", "num-prefix", ">>"); + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='3']", "num-suffix", "<<"); +} + +DECLARE_ODFEXPORT_TEST(testListFormatOdt, "listformat.odt") +{ + // Ensure in resulting ODT we also have not just prefix/suffux, but custom delimiters + CPPUNIT_ASSERT_EQUAL(OUString(">1<"), getProperty<OUString>(getParagraph(1), "ListLabelString")); + CPPUNIT_ASSERT_EQUAL(OUString(">>1.1<<"), getProperty<OUString>(getParagraph(2), "ListLabelString")); + CPPUNIT_ASSERT_EQUAL(OUString(">>1.1.1<<"), getProperty<OUString>(getParagraph(3), "ListLabelString")); + CPPUNIT_ASSERT_EQUAL(OUString(">>1.1.2<<"), getProperty<OUString>(getParagraph(4), "ListLabelString")); + + if (xmlDocUniquePtr pXmlDoc = parseExport("content.xml")) + { + // Check how conversion from prefix/suffix to list format did work + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='1']", "num-list-format", ">%1%<"); + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='2']", "num-list-format", ">>%1%.%2%<<"); + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='3']", "num-list-format", ">>%1%.%2%.%3%<<"); + + // But for compatibility there are still prefix/suffix as they were before + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='1']", "num-prefix", ">"); + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='1']", "num-suffix", "<"); + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='2']", "num-prefix", ">>"); + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='2']", "num-suffix", "<<"); + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='3']", "num-prefix", ">>"); + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='3']", "num-suffix", "<<"); + } +} + // This test started in LO 7.2. Use the odfexport.cxx if you intend to backport to 7.1. CPPUNIT_PLUGIN_IMPLEMENT(); |