summaryrefslogtreecommitdiff
path: root/sw/qa/extras/unowriter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-06-21 17:55:01 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-06-21 19:17:58 +0200
commitac246d6ea1bc43bfc82c9b4c69c9c0f1fd678129 (patch)
tree11eca013dce1676c1d049c6fd00b037566e1274f /sw/qa/extras/unowriter
parent548e12533f52d152aca0efdfe1250102f1264ba2 (diff)
sw comments on frames: fix layout to place anchor next to the image
With this, if you load sw/qa/extras/unowriter/data/image-comment-at-char.odt, the comment anchor leads to the commented image, not to the anchor of the image (between "aaa" and "bbb"). Change-Id: I99389c9fc849269eb20d0266f8f604db89faec12 Reviewed-on: https://gerrit.libreoffice.org/74519 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/qa/extras/unowriter')
-rw-r--r--sw/qa/extras/unowriter/unowriter.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx
index 38c55cfb74dd..b7b38d4a6da3 100644
--- a/sw/qa/extras/unowriter/unowriter.cxx
+++ b/sw/qa/extras/unowriter/unowriter.cxx
@@ -24,6 +24,9 @@
#include <ndtxt.hxx>
#include <swdtflvr.hxx>
#include <view.hxx>
+#include <PostItMgr.hxx>
+#include <postithelper.hxx>
+#include <AnnotationWin.hxx>
using namespace ::com::sun::star;
@@ -561,6 +564,17 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testImageCommentAtChar)
getProperty<OUString>(getRun(xPara, 4), "TextPortionType"));
CPPUNIT_ASSERT_EQUAL(OUString("Text"),
getProperty<OUString>(getRun(xPara, 5), "TextPortionType"));
+
+ // Without the accompanying fix in place, this test would have failed with 'Expected:
+ // 5892; Actual: 1738', i.e. the anchor pos was between the "aaa" and "bbb" portions, not at the
+ // center of the page (horizontally) where the image is.
+ SwView* pView = pDoc->GetDocShell()->GetView();
+ SwPostItMgr* pPostItMgr = pView->GetPostItMgr();
+ for (const auto& pItem : *pPostItMgr)
+ {
+ const SwRect& rAnchor = pItem->pPostIt->GetAnchorRect();
+ CPPUNIT_ASSERT_EQUAL(static_cast<long>(5892), rAnchor.Left());
+ }
}
CPPUNIT_PLUGIN_IMPLEMENT();