[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Fri Jun 27 09:05:22 PDT 2014
sw/qa/extras/uiwriter/data/shape-textbox-autosize.odt |binary
sw/qa/extras/uiwriter/uiwriter.cxx | 18 ++++++++++++++++++
sw/source/core/doc/textboxhelper.cxx | 1 +
3 files changed, 19 insertions(+)
New commits:
commit 10d91ef984ae54eb688cbfe39acaf0f131964634
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Jun 27 17:34:02 2014 +0200
SwTextBoxHelper::create: handle TextAutoGrowHeight
Without this, in case TextAutoGrowHeight is set before TextBox, the
textbox of the shape won't have automatic height.
Change-Id: I2ebf77eacbe1f1d10ccf64ef833c39ee965245d3
diff --git a/sw/qa/extras/uiwriter/data/shape-textbox-autosize.odt b/sw/qa/extras/uiwriter/data/shape-textbox-autosize.odt
new file mode 100644
index 0000000..8877c72
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/shape-textbox-autosize.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index b279e7c..47aba1e 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -45,6 +45,7 @@ public:
void testShapeTextboxDelete();
void testCp1000071();
void testShapeTextboxVertadjust();
+ void testShapeTextboxAutosize();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -60,6 +61,7 @@ public:
CPPUNIT_TEST(testShapeTextboxDelete);
CPPUNIT_TEST(testCp1000071);
CPPUNIT_TEST(testShapeTextboxVertadjust);
+ CPPUNIT_TEST(testShapeTextboxAutosize);
CPPUNIT_TEST_SUITE_END();
private:
@@ -372,6 +374,22 @@ void SwUiWriterTest::testShapeTextboxVertadjust()
CPPUNIT_ASSERT_EQUAL(SDRTEXTVERTADJUST_CENTER, pFmt->GetTextVertAdjust().GetValue());
}
+void SwUiWriterTest::testShapeTextboxAutosize()
+{
+ SwDoc* pDoc = createDoc("shape-textbox-autosize.odt");
+ SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+ SdrObject* pFirst = pPage->GetObj(0);
+ CPPUNIT_ASSERT_EQUAL(OUString("1st"), pFirst->GetName());
+
+ SdrObject* pSecond = pPage->GetObj(1);
+ CPPUNIT_ASSERT_EQUAL(OUString("2nd"), pSecond->GetName());
+
+ // Shape -> textbox synchronization was missing, the second shape had the
+ // same height as the first, even though the first contained 1 paragraph
+ // and the other 2 ones.
+ CPPUNIT_ASSERT(pFirst->GetSnapRect().getHeight() < pSecond->GetSnapRect().getHeight());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index e93aae7..cc044d7 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -95,6 +95,7 @@ void SwTextBoxHelper::create(SwFrmFmt* pShape)
syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_RELATION, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_RELATION));
syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_POSITION, xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_POSITION));
syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_POSITION));
+ syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_IS_AUTO_HEIGHT, xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_AUTOGROWHEIGHT));
}
}
More information about the Libreoffice-commits
mailing list