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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Sun Nov 15 14:31:28 UTC 2020


 sw/qa/core/layout/data/shape-textbox.odt |binary
 sw/qa/core/layout/layout.cxx             |   32 +++++++------------------------
 2 files changed, 8 insertions(+), 24 deletions(-)

New commits:
commit ea3cda08132a4e3bfda40bd7f8e4d38b6352e713
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Nov 13 18:46:20 2020 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Sun Nov 15 15:30:50 2020 +0100

    tdf#135198: fix unittest
    
    The problem was reintroduced in
    f2eef84ff03660cbb46a76c317e640e054ed0a56
    and the previous unittest didn't fail.
    
    Change-Id: I7e25afd265d8f19fdced17efe5815fb93321a9ea
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105805
    Tested-by: Jenkins
    Reviewed-by: Dániel Arató <arato.daniel at nisz.hu>
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/core/layout/data/shape-textbox.odt b/sw/qa/core/layout/data/shape-textbox.odt
index 26a9eb7f7011..15b0aa48df48 100644
Binary files a/sw/qa/core/layout/data/shape-textbox.odt and b/sw/qa/core/layout/data/shape-textbox.odt differ
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index a992a32ae7d4..b66a4f5bbad9 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -14,10 +14,6 @@
 #include <wrtsh.hxx>
 #include <docsh.hxx>
 #include <unotxdoc.hxx>
-#include <flyfrm.hxx>
-#include <fmtornt.hxx>
-#include <frmtool.hxx>
-#include <textboxhelper.hxx>
 #include <drawdoc.hxx>
 #include <IDocumentDrawModelAccess.hxx>
 #include <svx/svdpage.hxx>
@@ -174,26 +170,14 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxStaysInsideShape)
 {
     // tdf#135198: check whether text box stays inside shape after moving it upwards
     load(DATA_DIRECTORY, "shape-textbox.odt");
-    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
-    SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
-    SdrObject* pTextBoxObj = pPage->GetObj(0);
-
-    xmlDocUniquePtr pLayoutBefore = parseLayoutDump();
-    CPPUNIT_ASSERT(pLayoutBefore);
-    const int nTextBoxTopBefore = getXPath(pLayoutBefore, "//fly/infos/bounds", "top").toInt32();
-
-    uno::Reference<drawing::XShape> xShape(pTextBoxObj->getUnoShape(), uno::UNO_QUERY_THROW);
-    auto aPosition = xShape->getPosition();
-    aPosition.Y -= 500;
-    xShape->setPosition(aPosition);
-
-    discardDumpedLayout();
-    xmlDocUniquePtr pLayoutAfter = parseLayoutDump();
-    CPPUNIT_ASSERT(pLayoutAfter);
-    const int nTextBoxTopAfter = getXPath(pLayoutAfter, "//fly/infos/bounds", "top").toInt32();
-    CPPUNIT_ASSERT_MESSAGE("text box was supposed to stay inside its shape",
-                           nTextBoxTopAfter < nTextBoxTopBefore);
+    xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: 1932
+    // - Actual  : 7476
+    assertXPath(pXmlDoc, "//fly/infos/bounds", "top", "1932");
+    assertXPath(pXmlDoc, "//fly/infos/bounds", "bottom", "7184");
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list