sw/qa/extras/inc/swmodeltestbase.hxx        |   19 +++++++++++++++++++
 sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx |    6 +++---
 2 files changed, 22 insertions(+), 3 deletions(-)

New commits:
commit 7389393284c06fb235bdf9f2fc130d0b61b21ec3
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Mon Jun 16 12:04:57 2014 +0200

    SwModelTestBase: add a getShapeByName() method
    
    Change-Id: Ie3b7099aea1d473cca88c4904683234408920100

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx 
b/sw/qa/extras/inc/swmodeltestbase.hxx
index b55a8eb..6826472 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -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)
     {
diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
index bff87a9..888373a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
@@ -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"));
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to