Kaydet (Commit) 0e5455eb authored tarafından Miklos Vajna's avatar Miklos Vajna

testcase for n#695479

üst dac4874e
{\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
}
...@@ -28,8 +28,11 @@ ...@@ -28,8 +28,11 @@
#include <com/sun/star/text/XTextDocument.hpp> #include <com/sun/star/text/XTextDocument.hpp>
#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.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/XTextGraphicObjectsSupplier.hpp>
#include <com/sun/star/text/XTextFramesSupplier.hpp>
#include <rtl/oustringostreaminserter.hxx>
#include <test/bootstrapfixture.hxx> #include <test/bootstrapfixture.hxx>
#include <unotest/macros_test.hxx> #include <unotest/macros_test.hxx>
#include <vcl/outdev.hxx> #include <vcl/outdev.hxx>
...@@ -50,12 +53,14 @@ public: ...@@ -50,12 +53,14 @@ public:
void testFdo45553(); void testFdo45553();
void testN192129(); void testN192129();
void testFdo45543(); void testFdo45543();
void testN695479();
CPPUNIT_TEST_SUITE(RtfModelTest); CPPUNIT_TEST_SUITE(RtfModelTest);
#if !defined(MACOSX) && !defined(WNT) #if !defined(MACOSX) && !defined(WNT)
CPPUNIT_TEST(testFdo45553); CPPUNIT_TEST(testFdo45553);
CPPUNIT_TEST(testN192129); CPPUNIT_TEST(testN192129);
CPPUNIT_TEST(testFdo45543); CPPUNIT_TEST(testFdo45543);
CPPUNIT_TEST(testN695479);
#endif #endif
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
...@@ -159,6 +164,34 @@ void RtfModelTest::testFdo45543() ...@@ -159,6 +164,34 @@ void RtfModelTest::testFdo45543()
CPPUNIT_ASSERT_EQUAL((sal_Int32)5, aBuf.getLength()); 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_TEST_SUITE_REGISTRATION(RtfModelTest);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
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