summaryrefslogtreecommitdiff
path: root/sw/qa/extras/rtfimport/rtfimport.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-07-20 21:22:14 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-07-22 11:19:56 +0200
commit5ccf0dac637345bab3d3a4e37ea6707c6d9bd0a6 (patch)
treeb18de026f4efa470e52fd9dda02df8c7982e99b9 /sw/qa/extras/rtfimport/rtfimport.cxx
parent7e6cf79dee36fcbb856e84cc250ddb5bea7f7c88 (diff)
tdf#134400 RTF import: fix unexpected inner properties for picture-in-textframe
Regression from commit 4ab658b56f5c6ff0082d38d8ace1924d11e30e96 (RTF import: implement support for tables inside text frames, 2013-06-16), the problem was that both the outer "textbox" and the inner "picture frame" object had a shapeType property, and the properties were stored in a vector. So by the time RTFSdrImport::initShape() looked up the shape type for the inner shape, it thought it's not a picture frame, leading to data loss. (cherry picked from commit 5a083be34456e91427d0f2e2fea172f49f4502db) Change-Id: I4a536789371619d1d54afa8c8d41c7d273b0d21b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99118 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99167 Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/qa/extras/rtfimport/rtfimport.cxx')
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index d2c2d4d24c8f..42c0108c020f 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -933,6 +933,22 @@ CPPUNIT_TEST_FIXTURE(Test, testOleInline)
getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
}
+CPPUNIT_TEST_FIXTURE(Test, testPictureInTextframe)
+{
+ load(mpTestDocumentPath, "picture-in-textframe.rtf");
+ uno::Reference<drawing::XDrawPageSupplier> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage = xTextDocument->getDrawPage();
+ uno::Reference<beans::XPropertySet> xInnerShape(xDrawPage->getByIndex(1), uno::UNO_QUERY);
+ text::TextContentAnchorType eAnchorType = text::TextContentAnchorType_AT_PARAGRAPH;
+ xInnerShape->getPropertyValue("AnchorType") >>= eAnchorType;
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1
+ // - Actual : 4
+ // i.e. the properties of the inner shape (including its anchor type and bitmap fill) were lost
+ // on import.
+ CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, eAnchorType);
+}
+
CPPUNIT_TEST_FIXTURE(Test, testTdf128611)
{
load(mpTestDocumentPath, "tdf128611.rtf");