From b776233cba128bd7610834691da612b2b1a438a0 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 26 Jun 2012 15:07:38 +0200 Subject: n#766487 testcases Change-Id: I75c7913141461b354e85889faa6d43a1033680ef --- sw/qa/extras/ooxmltok/data/n766487.docx | Bin 0 -> 9273 bytes sw/qa/extras/ooxmltok/ooxmltok.cxx | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 sw/qa/extras/ooxmltok/data/n766487.docx diff --git a/sw/qa/extras/ooxmltok/data/n766487.docx b/sw/qa/extras/ooxmltok/data/n766487.docx new file mode 100644 index 000000000000..85eda0e7e381 Binary files /dev/null and b/sw/qa/extras/ooxmltok/data/n766487.docx differ diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx index 1d1bbb1b8367..ce4a91176301 100644 --- a/sw/qa/extras/ooxmltok/ooxmltok.cxx +++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx @@ -46,6 +46,8 @@ #include +#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) + using rtl::OString; using rtl::OUString; using rtl::OUStringBuffer; @@ -72,6 +74,7 @@ public: void testN766477(); void testN758883(); void testN766481(); + void testN766487(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -94,6 +97,7 @@ public: CPPUNIT_TEST(testN766477); CPPUNIT_TEST(testN758883); CPPUNIT_TEST(testN766481); + CPPUNIT_TEST(testN766487); #endif CPPUNIT_TEST_SUITE_END(); @@ -626,6 +630,37 @@ void Test::testN766481() CPPUNIT_ASSERT_EQUAL(sal_False, xParaEnum->hasMoreElements()); } +void Test::testN766487() +{ + /* + * The problem was that 1) the font size of the first para was too large 2) numbering had no first-line-indent. + * + * oParas = ThisComponent.Text.createEnumeration + * oPara = oParas.nextElement + * oRuns = oPara.createEnumeration + * oRun = oRuns.nextElement + * xray oRun.CharHeight ' 12, was larger + * oPara = oParas.nextElement + * xray oPara.ParaFirstLineIndent ' -635, was 0 + */ + load("n766487.docx"); + uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference xParaEnum(xParaEnumAccess->createEnumeration()); + + uno::Reference xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY); + uno::Reference xRunEnum(xRunEnumAccess->createEnumeration()); + uno::Reference xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY); + float fValue = 0; + xPropertySet->getPropertyValue("CharHeight") >>= fValue; + CPPUNIT_ASSERT_EQUAL(12.f, fValue); + + xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY); + sal_Int32 nValue = 0; + xPropertySet->getPropertyValue("ParaFirstLineIndent") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(-360)), nValue); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); -- cgit