diff options
author | Attila Bakos (NISZ) <bakos.attilakaroly@nisz.hu> | 2021-03-09 16:32:27 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2021-03-29 11:33:52 +0200 |
commit | ff321dd36554d25f0817903becf4598065e0a194 (patch) | |
tree | e7d348490b7b3040abb99d69af3b6a24108e1139 /sw/qa | |
parent | 3d844a131d7d2d2c82d865d17ad7657c7e8a185c (diff) |
tdf#140828 sw textbox: fix AS_CHAR regression
Textboxes anchored as characters don't lose
their text frames after changing the anchor
"To character".
Regression from commit 493a916a3113e877835c9bc7c93faef0d29f9a33
(tdf#140158 tdf#138598 tdf#140598 sw: fix sync of AS_CHAR textboxes).
Change-Id: I0e6d88c9dcdeff515744bc4c201a5640eb810d1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112209
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa')
-rwxr-xr-x | sw/qa/extras/uiwriter/data3/tdf140828.docx | bin | 0 -> 5393 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 32 |
2 files changed, 32 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data3/tdf140828.docx b/sw/qa/extras/uiwriter/data3/tdf140828.docx Binary files differnew file mode 100755 index 000000000000..bfdabc5d77ea --- /dev/null +++ b/sw/qa/extras/uiwriter/data3/tdf140828.docx diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 63a322af868e..cf14ac853264 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -14,6 +14,7 @@ #include <com/sun/star/drawing/GraphicExportFilter.hpp> #include <IDocumentDrawModelAccess.hxx> #include <com/sun/star/text/TextContentAnchorType.hpp> +#include <com/sun/star/text/XTextFrame.hpp> #include <com/sun/star/text/XTextTablesSupplier.hpp> #include <com/sun/star/text/XTextTable.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp> @@ -1089,6 +1090,37 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf76636_2) CPPUNIT_ASSERT_EQUAL(sal_Int32(6), xTextTable->getColumns()->getCount()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf140828) +{ + load(DATA_DIRECTORY, "tdf140828.docx"); + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + uno::Reference<drawing::XShape> xShp = getShape(1); + CPPUNIT_ASSERT(xShp); + + uno::Reference<beans::XPropertySet> ShpProps(xShp, uno::UNO_QUERY_THROW); + dispatchCommand(mxComponent, ".uno:JumpToNextFrame", {}); + Scheduler::ProcessEventsToIdle(); + + dispatchCommand(mxComponent, ".uno:SetAnchorAtChar", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT(ShpProps->getPropertyValue("AnchorType").get<text::TextContentAnchorType>() + != text::TextContentAnchorType::TextContentAnchorType_AS_CHARACTER); + + uno::Reference<text::XTextFrame> xTxBx(SwTextBoxHelper::getUnoTextFrame(xShp)); + CPPUNIT_ASSERT(xTxBx); + + uno::Reference<beans::XPropertySet> TxBxProps(xTxBx, uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(OUString("top left image"), xTxBx->getText()->getString()); + + CPPUNIT_ASSERT_MESSAGE("Bad Relative Orientation and Position!", + TxBxProps->getPropertyValue("HoriOrientRelation").get<sal_Int16>() + != text::RelOrientation::CHAR); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132725) { load(DATA_DIRECTORY, "tdf132725.odt"); |