summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-11-25 17:04:16 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2020-11-26 00:26:23 +0100
commit7893e24c82c97de9c066f6e09df0ac107a6d97dd (patch)
tree92dd6ef147977fc8cc2b7e928ea84229e799e375 /sw
parent92f1c430e4e77e71e7c914ad567d4970e5b2cd95 (diff)
tdf#138130: sw_uiwriter: Add unittest
Change-Id: If7eca097e83003d657cc39ae617eaccabcf62a5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106610 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106633
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/data3/tdf138130.docxbin0 -> 8977 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx30
2 files changed, 30 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data3/tdf138130.docx b/sw/qa/extras/uiwriter/data3/tdf138130.docx
new file mode 100644
index 000000000000..a570dec4b08a
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data3/tdf138130.docx
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index da425a13e071..36b971e6a5ec 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -868,6 +868,36 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf117601)
CPPUNIT_ASSERT(xCellB1->getString().endsWith("test1"));
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf138130)
+{
+ load(DATA_DIRECTORY, "tdf138130.docx");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+
+ CPPUNIT_ASSERT_EQUAL(1, getShapes());
+ uno::Reference<drawing::XShape> xShape = getShape(1);
+
+ awt::Point aPos = xShape->getPosition();
+
+ //select shape and change the anchor
+ dispatchCommand(mxComponent, ".uno:JumpToNextFrame", {});
+ Scheduler::ProcessEventsToIdle();
+
+ // Without the fix in place, this test would have crashed here
+ dispatchCommand(mxComponent, ".uno:SetAnchorToPage", {});
+ Scheduler::ProcessEventsToIdle();
+
+ //position has changed
+ CPPUNIT_ASSERT(aPos.X < xShape->getPosition().X);
+ CPPUNIT_ASSERT(aPos.Y < xShape->getPosition().Y);
+
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(aPos.X, xShape->getPosition().X);
+ CPPUNIT_ASSERT_EQUAL(aPos.Y, xShape->getPosition().Y);
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf128782)
{
load(DATA_DIRECTORY, "tdf128782.odt");