diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-11-25 17:04:16 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-11-25 23:08:13 +0100 |
commit | a45ea4f7939e7ca2e5c071ad209c957702b527e6 (patch) | |
tree | 49b17e390bc2b4071e657567333cf2905b84d9a2 /sw | |
parent | 8f4d36009d789f645ab700bfcd20f8e268ce8cee (diff) |
tdf#138130: sw_uiwriter: Add unittest
Change-Id: If7eca097e83003d657cc39ae617eaccabcf62a5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106598
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/data3/tdf138130.docx | bin | 0 -> 8977 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 30 |
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 Binary files differnew file mode 100644 index 000000000000..a570dec4b08a --- /dev/null +++ b/sw/qa/extras/uiwriter/data3/tdf138130.docx diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 38b9e6e7115a..4f8c046356f8 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -1598,6 +1598,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, testTdf136385) { load(DATA_DIRECTORY, "tdf136385.odt"); |