From 1a0f494be698dbb20ff7c7eb66fc84db498cfa45 Mon Sep 17 00:00:00 2001 From: Mark Hung Date: Sat, 8 Nov 2014 07:45:16 -0800 Subject: CJK Numbered list test cases for ooxmlimport and ww8import. Reviewed on: https://gerrit.libreoffice.org/12319 Change-Id: I8c23aa97a16feae32071cb2f71f1b63d771c467c --- sw/qa/extras/ooxmlexport/data/cjklist30.docx | Bin 0 -> 13395 bytes sw/qa/extras/ooxmlexport/data/cjklist31.docx | Bin 0 -> 13406 bytes sw/qa/extras/ooxmlexport/data/cjklist34.docx | Bin 0 -> 13414 bytes sw/qa/extras/ooxmlexport/data/cjklist35.docx | Bin 0 -> 13394 bytes sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 52 +++++++++++++++++++++++++++ sw/qa/extras/ww8export/data/cjklist30.doc | Bin 0 -> 27648 bytes sw/qa/extras/ww8export/data/cjklist31.doc | Bin 0 -> 27648 bytes sw/qa/extras/ww8export/data/cjklist34.doc | Bin 0 -> 27648 bytes sw/qa/extras/ww8export/data/cjklist35.doc | Bin 0 -> 23552 bytes sw/qa/extras/ww8export/ww8export.cxx | 52 +++++++++++++++++++++++++++ 10 files changed, 104 insertions(+) create mode 100644 sw/qa/extras/ooxmlexport/data/cjklist30.docx create mode 100644 sw/qa/extras/ooxmlexport/data/cjklist31.docx create mode 100644 sw/qa/extras/ooxmlexport/data/cjklist34.docx create mode 100644 sw/qa/extras/ooxmlexport/data/cjklist35.docx create mode 100644 sw/qa/extras/ww8export/data/cjklist30.doc create mode 100644 sw/qa/extras/ww8export/data/cjklist31.doc create mode 100644 sw/qa/extras/ww8export/data/cjklist34.doc create mode 100644 sw/qa/extras/ww8export/data/cjklist35.doc diff --git a/sw/qa/extras/ooxmlexport/data/cjklist30.docx b/sw/qa/extras/ooxmlexport/data/cjklist30.docx new file mode 100644 index 000000000000..b2efbb995d5f Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/cjklist30.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/cjklist31.docx b/sw/qa/extras/ooxmlexport/data/cjklist31.docx new file mode 100644 index 000000000000..95d4c9aeba16 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/cjklist31.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/cjklist34.docx b/sw/qa/extras/ooxmlexport/data/cjklist34.docx new file mode 100644 index 000000000000..c09615aa2b41 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/cjklist34.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/cjklist35.docx b/sw/qa/extras/ooxmlexport/data/cjklist35.docx new file mode 100644 index 000000000000..85aa24fc2089 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/cjklist35.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index c06ed65c54c9..851d72efaaa9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -41,6 +41,30 @@ protected: // If the testcase is stored in some other format, it's pointless to test. return (OString(filename).endsWith(".docx") && std::find(vBlacklist.begin(), vBlacklist.end(), filename) == vBlacklist.end()); } +protected: + bool CjkNumberedListTestHelper(sal_Int16 &nValue) + { + bool isNumber; + uno::Reference xPara(getParagraph(1)); + uno::Reference< beans::XPropertySet > properties( xPara, uno::UNO_QUERY); + properties->getPropertyValue("NumberingIsNumber") >>= isNumber; + if (!isNumber) + return false; + uno::Reference xLevels( properties->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Sequence< beans::PropertyValue > aPropertyValue; + xLevels->getByIndex(0) >>= aPropertyValue; + for( int j = 0 ; j< aPropertyValue.getLength() ; ++j) + { + beans::PropertyValue aProp= aPropertyValue[j]; + if (aProp.Name == "NumberingType") + { + nValue = aProp.Value.get(); + return true; + } + } + return false; + + } }; DECLARE_OOXMLEXPORT_TEST(testfdo81381, "fdo81381.docx") @@ -513,6 +537,34 @@ DECLARE_OOXMLEXPORT_TEST(testTableRtl, "table-rtl.docx") CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, getProperty(xTable, "WritingMode")); } +DECLARE_OOXMLEXPORT_TEST(testOoxmlCjklist30, "cjklist30.docx") +{ + sal_Int16 numFormat; + CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); + CPPUNIT_ASSERT_EQUAL(style::NumberingType::TIAN_GAN_ZH, numFormat); +} + +DECLARE_OOXMLEXPORT_TEST(testOoxmlCjklist31, "cjklist31.docx") +{ + sal_Int16 numFormat; + CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); + CPPUNIT_ASSERT_EQUAL(style::NumberingType::DI_ZI_ZH, numFormat); +} + +DECLARE_OOXMLEXPORT_TEST(testOoxmlCjklist34, "cjklist34.docx") +{ + sal_Int16 numFormat; + CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); + CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_UPPER_ZH_TW, numFormat); +} + +DECLARE_OOXMLEXPORT_TEST(testOoxmlCjklist35, "cjklist35.docx") +{ + sal_Int16 numFormat; + CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); + CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_LOWER_ZH, numFormat); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ww8export/data/cjklist30.doc b/sw/qa/extras/ww8export/data/cjklist30.doc new file mode 100644 index 000000000000..48f22cf79a35 Binary files /dev/null and b/sw/qa/extras/ww8export/data/cjklist30.doc differ diff --git a/sw/qa/extras/ww8export/data/cjklist31.doc b/sw/qa/extras/ww8export/data/cjklist31.doc new file mode 100644 index 000000000000..4a7d3e7e1360 Binary files /dev/null and b/sw/qa/extras/ww8export/data/cjklist31.doc differ diff --git a/sw/qa/extras/ww8export/data/cjklist34.doc b/sw/qa/extras/ww8export/data/cjklist34.doc new file mode 100644 index 000000000000..551fc89527c9 Binary files /dev/null and b/sw/qa/extras/ww8export/data/cjklist34.doc differ diff --git a/sw/qa/extras/ww8export/data/cjklist35.doc b/sw/qa/extras/ww8export/data/cjklist35.doc new file mode 100644 index 000000000000..33d247029ad9 Binary files /dev/null and b/sw/qa/extras/ww8export/data/cjklist35.doc differ diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index c1e6ca681a20..019c87b24eb9 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -28,6 +28,29 @@ public: // If the testcase is stored in some other format, it's pointless to test. return OString(filename).endsWith(".doc"); } +protected: + bool CjkNumberedListTestHelper(sal_Int16 &nValue) + { + bool isNumber; + uno::Reference xPara(getParagraph(1)); + uno::Reference< beans::XPropertySet > properties( xPara, uno::UNO_QUERY); + properties->getPropertyValue("NumberingIsNumber") >>= isNumber; + if (!isNumber) + return false; + uno::Reference xLevels( properties->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Sequence< beans::PropertyValue > aPropertyValue; + xLevels->getByIndex(0) >>= aPropertyValue; + for( int j = 0 ; j< aPropertyValue.getLength() ; ++j) + { + beans::PropertyValue aProp= aPropertyValue[j]; + if (aProp.Name == "NumberingType") + { + nValue = aProp.Value.get(); + return true; + } + } + return false; + } }; DECLARE_WW8EXPORT_TEST(testN325936, "n325936.doc") @@ -388,6 +411,35 @@ DECLARE_WW8EXPORT_TEST(testBnc636128, "bnc636128.doc") CPPUNIT_ASSERT_EQUAL(OUString("5"), xParameters->getByName("MaxLength").get()); } + +DECLARE_WW8EXPORT_TEST(testWw8Cjklist30, "cjklist30.doc") +{ + sal_Int16 numFormat; + CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); + CPPUNIT_ASSERT_EQUAL(style::NumberingType::TIAN_GAN_ZH, numFormat); +} + +DECLARE_WW8EXPORT_TEST(testWw8Cjklist31, "cjklist31.doc") +{ + sal_Int16 numFormat; + CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); + CPPUNIT_ASSERT_EQUAL(style::NumberingType::DI_ZI_ZH, numFormat); +} + +DECLARE_WW8EXPORT_TEST(testWw8Cjklist34, "cjklist34.doc") +{ + sal_Int16 numFormat; + CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); + CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_UPPER_ZH_TW, numFormat); +} + +DECLARE_WW8EXPORT_TEST(testWw8Cjklist35, "cjklist35.doc") +{ + sal_Int16 numFormat; + CPPUNIT_ASSERT(CjkNumberedListTestHelper(numFormat)); + CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_LOWER_ZH, numFormat); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit