diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-09-14 14:13:16 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-09-15 10:40:29 +0200 |
commit | 485a8a8f21f951d19586b694c233eb4a2dd7b57a (patch) | |
tree | 6fc1cc1673db3438c04d1c40d0a785faaae4f5f1 /sw | |
parent | 28b53da4c49b2dc8550f28b07183fb7c60e1c298 (diff) |
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 <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/data3/tdf135623.docx | bin | 0 -> 25768 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 46 |
2 files changed, 45 insertions, 1 deletions
diff --git a/sw/qa/extras/uiwriter/data3/tdf135623.docx b/sw/qa/extras/uiwriter/data3/tdf135623.docx Binary files differnew file mode 100644 index 000000000000..ed139eaeffdb --- /dev/null +++ b/sw/qa/extras/uiwriter/data3/tdf135623.docx diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 46e5a4eee028..5cfe6beb3aa4 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -1317,7 +1317,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(); @@ -1330,6 +1330,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"); |