summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-06-12 09:32:19 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-06-12 09:39:03 +0200
commit32d6d27eb61490b4c29320e65b3c9d2b6960acd5 (patch)
treed8fb43b3106d6ecc9f0b3012977da21398c16189
parent0e8c06660b3d651900a0f20abd2b1429c854a1c8 (diff)
CppunitTest_sw_ooxmlexport: port testPageRelSize to textboxes
Change-Id: I08e112b3816797a848ae9d16fa7002a67c12fc3d
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx36
1 files changed, 27 insertions, 9 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 812216bf8bc0..900c8659d959 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")