add testcase for fdo#45187

This commit is contained in:
Miklos Vajna 2012-02-27 11:19:38 +01:00
parent 8e750a2d9c
commit bb4ceaa4bb
2 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,32 @@
{\rtf1
{\field
{\*\fldinst SHAPE }
{\fldrslt
{\shp
{\*\shpinst\shpleft1000\shptop1000\shpright2000\shpbottom2000
{\sp
{\sn shapeType}
{\sv 1}
}
}
}
}
}
first
\par
{\field
{\*\fldinst SHAPE }
{\fldrslt
{\shp
{\*\shpinst\shpleft1000\shptop3000\shpright2000\shpbottom4000
{\sp
{\sn shapeType}
{\sv 3}
}
}
}
}
}
second
\par
}

View file

@ -59,6 +59,7 @@ public:
void testFdo45543();
void testN695479();
void testFdo42465();
void testFdo45187();
CPPUNIT_TEST_SUITE(RtfModelTest);
#if !defined(MACOSX) && !defined(WNT)
@ -67,6 +68,7 @@ public:
CPPUNIT_TEST(testFdo45543);
CPPUNIT_TEST(testN695479);
CPPUNIT_TEST(testFdo42465);
CPPUNIT_TEST(testFdo45187);
#endif
CPPUNIT_TEST_SUITE_END();
@ -244,6 +246,26 @@ void RtfModelTest::testFdo42465()
CPPUNIT_ASSERT_EQUAL(3, getLength());
}
void RtfModelTest::testFdo45187()
{
load(OUString(RTL_CONSTASCII_USTRINGPARAM("fdo45187.rtf")));
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
// There should be two shapes.
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount());
// They should be anchored to different paragraphs.
uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
uno::Any aValue = xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AnchorPosition")));
awt::Point aFirstPoint;
aValue >>= aFirstPoint;
xPropertySet.set(xDraws->getByIndex(1), uno::UNO_QUERY);
aValue = xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AnchorPosition")));
awt::Point aSecondPoint;
aValue >>= aSecondPoint;
CPPUNIT_ASSERT(aFirstPoint.Y != aSecondPoint.Y);
}
CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
CPPUNIT_PLUGIN_IMPLEMENT();