Kaydet (Commit) 1a0f494b authored tarafından Mark Hung's avatar Mark Hung Kaydeden (comit) Miklos Vajna

CJK Numbered list test cases for ooxmlimport and ww8import.

Reviewed on:
	https://gerrit.libreoffice.org/12319

Change-Id: I8c23aa97a16feae32071cb2f71f1b63d771c467c
üst e24ed4e3
...@@ -41,6 +41,30 @@ protected: ...@@ -41,6 +41,30 @@ protected:
// If the testcase is stored in some other format, it's pointless to test. // 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()); 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") DECLARE_OOXMLEXPORT_TEST(testfdo81381, "fdo81381.docx")
...@@ -513,6 +537,34 @@ DECLARE_OOXMLEXPORT_TEST(testTableRtl, "table-rtl.docx") ...@@ -513,6 +537,34 @@ DECLARE_OOXMLEXPORT_TEST(testTableRtl, "table-rtl.docx")
CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, getProperty<sal_Int16>(xTable, "WritingMode")); 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(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
...@@ -28,6 +28,29 @@ public: ...@@ -28,6 +28,29 @@ public:
// If the testcase is stored in some other format, it's pointless to test. // If the testcase is stored in some other format, it's pointless to test.
return OString(filename).endsWith(".doc"); 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") DECLARE_WW8EXPORT_TEST(testN325936, "n325936.doc")
...@@ -388,6 +411,35 @@ DECLARE_WW8EXPORT_TEST(testBnc636128, "bnc636128.doc") ...@@ -388,6 +411,35 @@ DECLARE_WW8EXPORT_TEST(testBnc636128, "bnc636128.doc")
CPPUNIT_ASSERT_EQUAL(OUString("5"), xParameters->getByName("MaxLength").get<OUString>()); 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(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment