[Libreoffice-commits] core.git: sw/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 15 08:40:59 UTC 2020


 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 485a8a8f21f951d19586b694c233eb4a2dd7b57a
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon Sep 14 14:13:16 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Sep 15 10:40:29 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 <xiscofauli at libreoffice.org>

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 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");


More information about the Libreoffice-commits mailing list