diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-02-18 23:05:52 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-02-21 12:21:13 +0100 |
commit | 0e5455ebff4181bc5830eb6e6dd46b82611eeecb (patch) | |
tree | c1757c28c1ed6804adbbcf616aa45cd30c2e14d6 | |
parent | dac4874eb0a5f65aae2679b5fa0020154f84800d (diff) |
testcase for n#695479
-rw-r--r-- | sw/qa/extras/rtftok/data/n695479.rtf | 12 | ||||
-rw-r--r-- | sw/qa/extras/rtftok/rtftok.cxx | 33 |
2 files changed, 45 insertions, 0 deletions
diff --git a/sw/qa/extras/rtftok/data/n695479.rtf b/sw/qa/extras/rtftok/data/n695479.rtf new file mode 100644 index 000000000000..f72c8b0f76d0 --- /dev/null +++ b/sw/qa/extras/rtftok/data/n695479.rtf @@ -0,0 +1,12 @@ +{\rtf1 +\paperw12240\paperh15840\margl360\margr360\margt360\margb302\gutter0\ltrsect +\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\pvpg\posx116\posy2167\absh-300\absw5134\overlay\faauto\rin0\lin0\itap0 +\rtlch\fcs1 \af0\afs19\alang1025 \ltrch\fcs0 \fs19\lang1033\langfe1038\loch\af0\hich\af0\dbch\af31505\cgrid\langnp1033\langfenp1038 +{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \fs18\cf1\lang1038\langfe1038\langnp1038\insrsid10974703 +\hich\af0\dbch\af31505\loch\f0 first +\par } +\pard \ltrpar\ql \li0\ri0\nowidctlpar\pvpg\posx5562\posy5417\absh-226\absw5946\overlay\faauto\rin0\lin0\itap0\pararsid15926738 +{\rtlch\fcs1 \ab\af0 \ltrch\fcs0 \cf1\lang1038\langfe1038\langnp1038\insrsid10974703 +second\par } +\pard plain\par +} diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx index 9afb4f2033a4..2787d1597ab1 100644 --- a/sw/qa/extras/rtftok/rtftok.cxx +++ b/sw/qa/extras/rtftok/rtftok.cxx @@ -28,8 +28,11 @@ #include <com/sun/star/text/XTextDocument.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> +#include <com/sun/star/text/SizeType.hpp> #include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp> +#include <com/sun/star/text/XTextFramesSupplier.hpp> +#include <rtl/oustringostreaminserter.hxx> #include <test/bootstrapfixture.hxx> #include <unotest/macros_test.hxx> #include <vcl/outdev.hxx> @@ -50,12 +53,14 @@ public: void testFdo45553(); void testN192129(); void testFdo45543(); + void testN695479(); CPPUNIT_TEST_SUITE(RtfModelTest); #if !defined(MACOSX) && !defined(WNT) CPPUNIT_TEST(testFdo45553); CPPUNIT_TEST(testN192129); CPPUNIT_TEST(testFdo45543); + CPPUNIT_TEST(testN695479); #endif CPPUNIT_TEST_SUITE_END(); @@ -159,6 +164,34 @@ void RtfModelTest::testFdo45543() CPPUNIT_ASSERT_EQUAL((sal_Int32)5, aBuf.getLength()); } +void RtfModelTest::testN695479() +{ + load(OUString(RTL_CONSTASCII_USTRINGPARAM("n695479.rtf"))); + + uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + + // Negative ABSH should mean fixed size. + sal_Int16 nSizeType = 0; + uno::Any aValue = xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SizeType"))); + aValue >>= nSizeType; + CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX, nSizeType); + sal_Int32 nHeight = 0; + aValue = xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Height"))); + aValue >>= nHeight; + CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(300)), nHeight); + + // Both frames should be anchored to the first paragraph. + for (int i = 0; i < 2; ++i) + { + uno::Reference<text::XTextContent> xTextContent(xIndexAccess->getByIndex(i), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange(xTextContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XText> xText(xRange->getText(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(RTL_CONSTASCII_USTRINGPARAM("plain")), xText->getString()); + } +} + CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest); CPPUNIT_PLUGIN_IMPLEMENT(); |