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

SwModelTestBase: add a getShapeByName() method

Change-Id: Ie3b7099aea1d473cca88c4904683234408920100
üst 76fe2776
......@@ -486,6 +486,25 @@ protected:
return xShape;
}
/// Get shape by name
uno::Reference<drawing::XShape> getShapeByName(const OUString& aName)
{
uno::Reference<drawing::XShape> xRet;
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
for (sal_Int32 i = 0; i < xDrawPage->getCount(); ++i)
{
uno::Reference<container::XNamed> xShape(xDrawPage->getByIndex(i), uno::UNO_QUERY);
if (xShape->getName() == aName)
{
xRet.set(xShape, uno::UNO_QUERY);
break;
}
}
return xRet;
}
/// Get TextFrame by name
uno::Reference<drawing::XShape> getTextFrameByName(const OUString& aName)
{
......
......@@ -215,13 +215,13 @@ DECLARE_OOXMLEXPORT_TEST(testDMLTextFrameVertAdjust, "dml-textframe-vertadjust.d
// TextVerticalAdjust attribute so far.
// 1st frame's context is adjusted to the top
uno::Reference<beans::XPropertySet> xFrame(getTextFrameByName("Rectangle 1"), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xFrame(getShapeByName("Rectangle 1"), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_TOP, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust"));
// 2nd frame's context is adjusted to the center
xFrame.set(getTextFrameByName("Rectangle 2"), uno::UNO_QUERY);
xFrame.set(getShapeByName("Rectangle 2"), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_CENTER, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust"));
// 3rd frame's context is adjusted to the bottom
xFrame.set(getTextFrameByName("Rectangle 3"), uno::UNO_QUERY);
xFrame.set(getShapeByName("Rectangle 3"), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_BOTTOM, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust"));
}
......
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