diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-08-16 14:52:14 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-08-16 16:49:45 +0200 |
commit | fe70fa98ef53e5dc054d86c7cb857e41d6c3e6d6 (patch) | |
tree | 4a9ffdda7c50955e2f5920d44102fa63f5be0641 | |
parent | 336afaa77fa2b8d08871de7b90e27c0ada32a81e (diff) |
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@collabora.com>
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter2.cxx | 20 |
1 files changed, 18 insertions, 2 deletions
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 |