diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-09-14 14:13:16 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-09-15 15:27:57 +0200 |
commit | 04334ade62d6f8f3001684338d35b93edb5e3588 (patch) | |
tree | f7e10edd939307c9b8c9194a886b3b8a88297384 | |
parent | 6df6c300ea499b260af0daa4d9a97f320e3e161e (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>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102715
-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 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"); |