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>
This commit is contained in:
@@ -1616,6 +1616,17 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testImageComment)
|
|||||||
pView->GetViewFrame()->GetDispatcher()->Execute(FN_CNTNT_TO_NEXT_FRAME, SfxCallMode::SYNCHRON);
|
pView->GetViewFrame()->GetDispatcher()->Execute(FN_CNTNT_TO_NEXT_FRAME, SfxCallMode::SYNCHRON);
|
||||||
|
|
||||||
#if !defined(MACOSX)
|
#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.
|
// 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:
|
// Without the accompanying fix in place, this test would have failed with:
|
||||||
// - Expected less or equal than: 1418
|
// - Expected less or equal than: 1418
|
||||||
@@ -1626,7 +1637,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testImageComment)
|
|||||||
for (const auto& pItem : *pPostItMgr)
|
for (const auto& pItem : *pPostItMgr)
|
||||||
{
|
{
|
||||||
const SwRect& rAnchor = pItem->pPostIt->GetAnchorRect();
|
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.
|
// 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;
|
const boost::property_tree::ptree& rComment = rValue.second;
|
||||||
OString aAnchorPos(rComment.get<std::string>("anchorPos").c_str());
|
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
|
#endif
|
||||||
|
Reference in New Issue
Block a user