diff options
author | Mark Hung <marklh9@gmail.com> | 2014-11-08 07:45:16 -0800 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-11-09 22:42:20 +0100 |
commit | 1a0f494be698dbb20ff7c7eb66fc84db498cfa45 (patch) | |
tree | 10619fecaa4ce8353f03e9a915d05282a663aa04 | |
parent | e24ed4e3a0bf603f2ea359b10542477ddd654564 (diff) |
CJK Numbered list test cases for ooxmlimport and ww8import.
Reviewed on:
https://gerrit.libreoffice.org/12319
Change-Id: I8c23aa97a16feae32071cb2f71f1b63d771c467c
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/cjklist30.docx | bin | 0 -> 13395 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/cjklist31.docx | bin | 0 -> 13406 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/cjklist34.docx | bin | 0 -> 13414 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/cjklist35.docx | bin | 0 -> 13394 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 52 | ||||
-rw-r--r-- | sw/qa/extras/ww8export/data/cjklist30.doc | bin | 0 -> 27648 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/data/cjklist31.doc | bin | 0 -> 27648 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/data/cjklist34.doc | bin | 0 -> 27648 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/data/cjklist35.doc | bin | 0 -> 23552 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export.cxx | 52 |
10 files changed, 104 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/cjklist30.docx b/sw/qa/extras/ooxmlexport/data/cjklist30.docx Binary files differnew file mode 100644 index 000000000000..b2efbb995d5f --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/cjklist30.docx diff --git a/sw/qa/extras/ooxmlexport/data/cjklist31.docx b/sw/qa/extras/ooxmlexport/data/cjklist31.docx Binary files differnew file mode 100644 index 000000000000..95d4c9aeba16 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/cjklist31.docx diff --git a/sw/qa/extras/ooxmlexport/data/cjklist34.docx b/sw/qa/extras/ooxmlexport/data/cjklist34.docx Binary files differnew file mode 100644 index 000000000000..c09615aa2b41 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/cjklist34.docx diff --git a/sw/qa/extras/ooxmlexport/data/cjklist35.docx b/sw/qa/extras/ooxmlexport/data/cjklist35.docx Binary files differnew file mode 100644 index 000000000000..85aa24fc2089 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/cjklist35.docx 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<text::XTextRange> xPara(getParagraph(1)); + uno::Reference< beans::XPropertySet > properties( xPara, uno::UNO_QUERY); + properties->getPropertyValue("NumberingIsNumber") >>= isNumber; + if (!isNumber) + return false; + uno::Reference<container::XIndexAccess> 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<sal_Int16>(); + 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<sal_Int16>(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 Binary files differnew file mode 100644 index 000000000000..48f22cf79a35 --- /dev/null +++ b/sw/qa/extras/ww8export/data/cjklist30.doc diff --git a/sw/qa/extras/ww8export/data/cjklist31.doc b/sw/qa/extras/ww8export/data/cjklist31.doc Binary files differnew file mode 100644 index 000000000000..4a7d3e7e1360 --- /dev/null +++ b/sw/qa/extras/ww8export/data/cjklist31.doc diff --git a/sw/qa/extras/ww8export/data/cjklist34.doc b/sw/qa/extras/ww8export/data/cjklist34.doc Binary files differnew file mode 100644 index 000000000000..551fc89527c9 --- /dev/null +++ b/sw/qa/extras/ww8export/data/cjklist34.doc diff --git a/sw/qa/extras/ww8export/data/cjklist35.doc b/sw/qa/extras/ww8export/data/cjklist35.doc Binary files differnew file mode 100644 index 000000000000..33d247029ad9 --- /dev/null +++ b/sw/qa/extras/ww8export/data/cjklist35.doc 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<text::XTextRange> xPara(getParagraph(1)); + uno::Reference< beans::XPropertySet > properties( xPara, uno::UNO_QUERY); + properties->getPropertyValue("NumberingIsNumber") >>= isNumber; + if (!isNumber) + return false; + uno::Reference<container::XIndexAccess> 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<sal_Int16>(); + 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<OUString>()); } + +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: */ |