[Libreoffice-commits] core.git: sw/qa
Miklos Vajna
vmiklos at collabora.co.uk
Thu Jun 12 00:39:30 PDT 2014
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 36 +++++++++++++++++++++++--------
1 file changed, 27 insertions(+), 9 deletions(-)
New commits:
commit 32d6d27eb61490b4c29320e65b3c9d2b6960acd5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jun 12 09:32:19 2014 +0200
CppunitTest_sw_ooxmlexport: port testPageRelSize to textboxes
Change-Id: I08e112b3816797a848ae9d16fa7002a67c12fc3d
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 812216b..900c865 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2373,15 +2373,33 @@ DECLARE_OOXMLEXPORT_TEST(testFdo73550, "fdo73550.docx")
DECLARE_OOXMLEXPORT_TEST(testPageRelSize, "pagerelsize.docx")
{
- // First textframe: width is relative from page, but not height.
- uno::Reference<drawing::XShape> xTextFrame = getTextFrameByName("Frame1");
- CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeWidthRelation"));
- CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeHeightRelation"));
-
- // Second textframe: height is relative from page, but not height.
- xTextFrame = getTextFrameByName("Text Box 2");
- CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeHeightRelation"));
- CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeWidthRelation"));
+ uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+ if (xIndexAccess->getCount())
+ {
+ // TODO TextBox: remove this when TextBox is enabled by default
+ // First textframe: width is relative from page, but not height.
+ uno::Reference<drawing::XShape> xTextFrame = getTextFrameByName("Frame1");
+ CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeWidthRelation"));
+ CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeHeightRelation"));
+
+ // Second textframe: height is relative from page, but not height.
+ xTextFrame = getTextFrameByName("Text Box 2");
+ CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeHeightRelation"));
+ CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeWidthRelation"));
+ }
+ else
+ {
+ // First shape: width is relative from page, but not height.
+ uno::Reference<drawing::XShape> xShape = getShape(1);
+ CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xShape, "RelativeWidthRelation"));
+ CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xShape, "RelativeHeightRelation"));
+
+ // Second shape: height is relative from page, but not height.
+ xShape = getShape(2);
+ CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xShape, "RelativeHeightRelation"));
+ CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xShape, "RelativeWidthRelation"));
+ }
}
DECLARE_OOXMLEXPORT_TEST(testRelSizeRound, "rel-size-round.docx")
More information about the Libreoffice-commits
mailing list