[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - sw/qa

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 16 13:35:08 UTC 2019


 sw/qa/extras/uiwriter/uiwriter2.cxx |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

New commits:
commit ca8ff0f771b00618f40b0d3eba522d7d86111498
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Aug 16 16:56:15 2019 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Sep 16 15:34:40 2019 +0200

    CppunitTest_sw_uiwriter: fix top/left confusion in testImageComment
    
    This worked before as usually both are 1418, but in the case of
    <https://ci.libreoffice.org/job/gerrit_windows/43226/console> the left
    is a larger value (4194), while the top stays the same.
    
    Change-Id: Ie31cb29720f6426ad9e2a28405f326e6e82febaa
    Reviewed-on: https://gerrit.libreoffice.org/77597
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/79009
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Tested-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 9cbc14a4cc6a..22a8b7e85f79 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -1220,6 +1220,7 @@ void SwUiWriterTest2::testImageComment()
     CPPUNIT_ASSERT_GREATER(static_cast<size_t>(0), rAnchored.size());
     SwAnchoredObject* pObject = rAnchored[0];
     long nFrameLeft = pObject->GetObjRect().Left();
+    long nFrameTop = pObject->GetObjRect().Top();
 
     // Make sure that the anchor points to the bottom left corner of the image.
     // Without the accompanying fix in place, this test would have failed with:
@@ -1253,7 +1254,7 @@ void SwUiWriterTest2::testImageComment()
         OString aExpected;
         aExpected += OString::number(nFrameLeft);
         aExpected += ", ";
-        aExpected += OString::number(nFrameLeft);
+        aExpected += OString::number(nFrameTop);
         aExpected += ", 0, 0";
         CPPUNIT_ASSERT_EQUAL(aExpected, aAnchorPos);
     }
commit 018152ef7547fe96a6bd997564684e20755f134f
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Aug 16 14:52:14 2019 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Sep 16 15:34:29 2019 +0200

    CppunitTest_sw_uiwriter: get rid of hardcoded 1418 in testImageComment
    
    See a different value at
    <https://ci.libreoffice.org/job/gerrit_windows/43196/console> and the
    intention is to make sure the comment anchor and the fly frame position
    matches, not to check the actual value.
    
    Change-Id: I28eb39cfe5cbb57713b2c642a703e8509da25323
    Reviewed-on: https://gerrit.libreoffice.org/77582
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/79008
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Tested-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index b53b2faf4ccc..9cbc14a4cc6a 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -1210,6 +1210,17 @@ void SwUiWriterTest2::testImageComment()
     pView->GetViewFrame()->GetDispatcher()->Execute(FN_CNTNT_TO_NEXT_FRAME, SfxCallMode::SYNCHRON);
 
 #if !defined(MACOSX)
+    // Calc the left edge of the as-char frame.
+    SwRootFrame* pLayout = pWrtShell->GetLayout();
+    SwFrame* pPage = pLayout->GetLower();
+    SwFrame* pBody = pPage->GetLower();
+    SwFrame* pTextFrame = pBody->GetLower();
+    CPPUNIT_ASSERT(pTextFrame->GetDrawObjs());
+    const SwSortedObjs& rAnchored = *pTextFrame->GetDrawObjs();
+    CPPUNIT_ASSERT_GREATER(static_cast<size_t>(0), rAnchored.size());
+    SwAnchoredObject* pObject = rAnchored[0];
+    long nFrameLeft = pObject->GetObjRect().Left();
+
     // Make sure that the anchor points to the bottom left corner of the image.
     // Without the accompanying fix in place, this test would have failed with:
     // - Expected less or equal than: 1418
@@ -1220,7 +1231,7 @@ void SwUiWriterTest2::testImageComment()
     for (const auto& pItem : *pPostItMgr)
     {
         const SwRect& rAnchor = pItem->pPostIt->GetAnchorRect();
-        CPPUNIT_ASSERT_LESSEQUAL(static_cast<long>(1418), rAnchor.Left());
+        CPPUNIT_ASSERT_EQUAL(nFrameLeft, rAnchor.Left());
     }
 
     // Test the comment anchor we expose via the LOK API.
@@ -1239,7 +1250,12 @@ void SwUiWriterTest2::testImageComment()
     {
         const boost::property_tree::ptree& rComment = rValue.second;
         OString aAnchorPos(rComment.get<std::string>("anchorPos").c_str());
-        CPPUNIT_ASSERT_EQUAL(OString("1418, 1418, 0, 0"), aAnchorPos);
+        OString aExpected;
+        aExpected += OString::number(nFrameLeft);
+        aExpected += ", ";
+        aExpected += OString::number(nFrameLeft);
+        aExpected += ", 0, 0";
+        CPPUNIT_ASSERT_EQUAL(aExpected, aAnchorPos);
     }
 
 #endif


More information about the Libreoffice-commits mailing list