[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/qa sw/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jul 17 08:32:49 UTC 2019
sw/qa/extras/uiwriter/uiwriter2.cxx | 19 +++++++++++++++++++
sw/source/core/fields/postithelper.cxx | 17 ++++++++++++++++-
2 files changed, 35 insertions(+), 1 deletion(-)
New commits:
commit e507a72b1bd2a90a153e71a3259373e0b4ddcf78
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Jul 16 12:17:01 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Jul 17 10:32:05 2019 +0200
sw comments on frames: avoid overlay that covers only an as-char image
As-char images had their comment arrow on the bottom left corner,
as-char ones had it at the bottom right one.
Standardize on bottom left and avoid the content overlay in case only
the frame itself is selected.
See commit cf5a3cb687a502e7f71cefb5f7001a73925bee56 (Adapt new test to
actual values observed on macOS, 2019-06-24) on why the test is not for
macOS, till somebody can check if this is working there properly.
(cherry picked from commit 3fb7ffeb85d87551ffcddd63b7c90c6b0e573e5f)
Conflicts:
sw/qa/extras/uiwriter/uiwriter2.cxx
Change-Id: I83516ea558182ecc7362f8383894ed07a16d3ad2
Reviewed-on: https://gerrit.libreoffice.org/75753
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 97eeb84c2cb1..aad559629cbb 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -44,6 +44,9 @@
#include <xmloff/odffields.hxx>
#include <com/sun/star/frame/DispatchHelper.hpp>
#include <txtfrm.hxx>
+#include <AnnotationWin.hxx>
+#include <PostItMgr.hxx>
+#include <postithelper.hxx>
namespace
{
@@ -1157,6 +1160,22 @@ void SwUiWriterTest2::testImageComment()
pView->GetViewFrame()->GetDispatcher()->ExecuteList(FN_INSERT_STRING, SfxCallMode::SYNCHRON,
{ &aItem });
pView->GetViewFrame()->GetDispatcher()->Execute(FN_CNTNT_TO_NEXT_FRAME, SfxCallMode::SYNCHRON);
+
+#if !defined(MACOSX)
+ // 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
+ // - Actual: 2442
+ // The anchor pointed to the bottom right corner, so as-char and at-char was inconsistent.
+ Scheduler::ProcessEventsToIdle();
+ SwPostItMgr* pPostItMgr = pView->GetPostItMgr();
+ for (const auto& pItem : *pPostItMgr)
+ {
+ const SwRect& rAnchor = pItem->pPostIt->GetAnchorRect();
+ CPPUNIT_ASSERT_LESSEQUAL(static_cast<long>(1418), rAnchor.Left());
+ }
+#endif
+
// Now delete the image.
pView->GetViewFrame()->GetDispatcher()->Execute(SID_DELETE, SfxCallMode::SYNCHRON);
// Without the accompanying fix in place, this test would have failed with 'Expected: 0; Actual:
diff --git a/sw/source/core/fields/postithelper.cxx b/sw/source/core/fields/postithelper.cxx
index 26cdd2bf8384..7081ad3973e0 100644
--- a/sw/source/core/fields/postithelper.cxx
+++ b/sw/source/core/fields/postithelper.cxx
@@ -60,7 +60,22 @@ bool AnnotationMarkCoversCommentAnchor(const sw::mark::IMark* pAnnotationMark,
if (rMarkStart != rAnchorPos)
{
- return false;
+ // This can be the as-char case: the comment placeholder character is exactly between the
+ // annotation mark start and end.
+ SwPosition aPosition(rMarkStart);
+ ++aPosition.nContent;
+ if (aPosition != rAnchorPos)
+ {
+ return false;
+ }
+
+ ++aPosition.nContent;
+ if (aPosition != rMarkEnd)
+ {
+ return false;
+ }
+
+ return true;
}
if (rMarkStart.nNode != rMarkEnd.nNode)
More information about the Libreoffice-commits
mailing list