summaryrefslogtreecommitdiff
path: root/sw/qa/extras/uiwriter/uiwriter2.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/extras/uiwriter/uiwriter2.cxx')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter2.cxx20
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