sw/qa/extras/uiwriter/uiwriter2.cxx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
New commits: commit fe70fa98ef53e5dc054d86c7cb857e41d6c3e6d6 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Fri Aug 16 14:52:14 2019 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Aug 16 16:49:45 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 <vmik...@collabora.com> diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 6f314401f7e7..d2035512c393 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -1616,6 +1616,17 @@ CPPUNIT_TEST_FIXTURE(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 @@ -1626,7 +1637,7 @@ CPPUNIT_TEST_FIXTURE(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. @@ -1645,7 +1656,12 @@ CPPUNIT_TEST_FIXTURE(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 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits