sw/qa/extras/uiwriter/data3/tdf135623.docx |binary sw/qa/extras/uiwriter/uiwriter3.cxx | 46 ++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-)
New commits: commit 04334ade62d6f8f3001684338d35b93edb5e3588 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon Sep 14 14:13:16 2020 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Sep 15 15:27:57 2020 +0200 tdf#135623: sw_uiwriter: Add unittest Change-Id: I77bc9e22d294ecc218b1570e75742344ef1d2ea4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102668 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102715 diff --git a/sw/qa/extras/uiwriter/data3/tdf135623.docx b/sw/qa/extras/uiwriter/data3/tdf135623.docx new file mode 100644 index 000000000000..ed139eaeffdb Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf135623.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 669122e62ebb..bddb827de74b 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -820,7 +820,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf128782) CPPUNIT_ASSERT_EQUAL(aPos[0].Y, xShape1->getPosition().Y); CPPUNIT_ASSERT_EQUAL(aPos[1].X, xShape2->getPosition().X); //Y position in shape 2 has changed - CPPUNIT_ASSERT(aPos[1].Y != xShape2->getPosition().Y); + CPPUNIT_ASSERT(aPos[1].Y < xShape2->getPosition().Y); dispatchCommand(mxComponent, ".uno:Undo", {}); Scheduler::ProcessEventsToIdle(); @@ -833,6 +833,50 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf128782) CPPUNIT_ASSERT_EQUAL(aPos[1].Y, xShape2->getPosition().Y); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135623) +{ + load(DATA_DIRECTORY, "tdf135623.docx"); + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + CPPUNIT_ASSERT_EQUAL(2, getShapes()); + CPPUNIT_ASSERT_EQUAL(2, getPages()); + + uno::Reference<drawing::XShape> xShape1 = getShape(1); + uno::Reference<drawing::XShape> xShape2 = getShape(2); + + awt::Point aPos[2]; + aPos[0] = xShape1->getPosition(); + aPos[1] = xShape2->getPosition(); + + //select shape 1 and move it down + dispatchCommand(mxComponent, ".uno:JumpToNextFrame", {}); + Scheduler::ProcessEventsToIdle(); + + pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_DOWN); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(aPos[0].X, xShape1->getPosition().X); + //Y position in shape 1 has changed + CPPUNIT_ASSERT(aPos[0].Y < xShape1->getPosition().Y); + CPPUNIT_ASSERT_EQUAL(aPos[1].X, xShape2->getPosition().X); + CPPUNIT_ASSERT_EQUAL(aPos[1].Y, xShape2->getPosition().Y); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(aPos[0].X, xShape1->getPosition().X); + CPPUNIT_ASSERT_EQUAL(aPos[0].Y, xShape1->getPosition().Y); + CPPUNIT_ASSERT_EQUAL(aPos[1].X, xShape2->getPosition().X); + + // Without the fix in place, this test would have failed here + // - Expected: 1351 + // - Actual : 2233 + CPPUNIT_ASSERT_EQUAL(aPos[1].Y, xShape2->getPosition().Y); + + CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133490) { load(DATA_DIRECTORY, "tdf133490.odt"); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits