sw/qa/extras/uiwriter/data3/tdf136385.odt |binary
 sw/qa/extras/uiwriter/uiwriter3.cxx       |   32 ++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

New commits:
commit 16e3dfccb7314af9b65f80684965d8c3f6d0d099
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Oct 21 15:22:15 2020 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Oct 22 13:34:58 2020 +0200

    tdf#136385: sw_uiwriter: Add unittest
    
    Change-Id: Ic205623b8838581baba3d75bb0a2fda49c65c3bf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104622
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data3/tdf136385.odt 
b/sw/qa/extras/uiwriter/data3/tdf136385.odt
new file mode 100644
index 000000000000..ee008e52372a
Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf136385.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 4480160ec169..5fed2bfc4496 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1542,6 +1542,38 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf117601)
     CPPUNIT_ASSERT(xCellB1->getString().endsWith("test1"));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf136385)
+{
+    load(DATA_DIRECTORY, "tdf136385.odt");
+    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();
+
+    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();
+
+    //Without the fix in place, this test would have failed with
+    //- Expected: 2447
+    //- Actual  : 446
+    CPPUNIT_ASSERT_EQUAL(aPos.X, xShape->getPosition().X);
+    CPPUNIT_ASSERT_EQUAL(aPos.Y, xShape->getPosition().Y);
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf128782)
 {
     load(DATA_DIRECTORY, "tdf128782.odt");
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to