Date: prev next · Thread: first prev next last
2016 Archives by date, by thread · List index


Hi Khaled,

On Tue, Nov 22, 2016 at 08:55:33AM +0200, Khaled Hosny <khaledhosny@eglug.org> wrote:
Thanks for the pointer. Incrementing the Y position by at least 1 fixes
the test, but I’m still not sure what the position is supposed to be in
the first place and why line spacing would matter.

Indeed it should not matter. SdTiledRenderingTest::testPostMouseEvent()
loads an Impress document, presses "x" (which in that context stars the
text edit of the only shape on the first slide), gets the position of
the cursor and then clicks to the same place, but 1000 mm100 away
towards the left edge of the slide.

Then it asserts that after the mouse click the cursor is no longer
after the "x" but before it.

The 1000 mm100 is indeed just something I came up with, assuming it is
larger than the width of "x" and smaller than the total width of the
text area of the shape. But in case it helps, feel free to tweak it,
just make sure that the asserts still pass:
rEditView.GetSelection().nStartPos should be "1" before clicking with
the mouse and it should be "0" after.

Maybe CPPUNIT_ASSERT(pView->GetTextEditObject()) currently fails as
after your changes the text area rectangle is changed, and 1000 is large
enough that it clicks outside the text area, finishing the whole text
edit, instead of just moving the cursor before "x"?

Another option: given that you mention incrementing Y by 1 changes the
situation, it would be fine to work with the "vertical center" of the
cursor not the "top" of it when we decide the click position.

Does this help? It would be no problem to include this change.

----
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 2d2cc99..4122adc 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -351,7 +351,7 @@ void SdTiledRenderingTest::testPostMouseEvent()
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), rEditView.GetSelection().nStartPos);
 
     vcl::Cursor* pCursor = rEditView.GetCursor();
-    Point aPosition = pCursor->GetPos();
+    Point aPosition(pCursor->GetPos().getX(), pCursor->GetPos().getY() + 
pCursor->GetSize().Height() / 2);
     aPosition.setX(aPosition.getX() - 1000);
     pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
                                       convertMm100ToTwip(aPosition.getX()), 
convertMm100ToTwip(aPosition.getY()),
----

Regards,

Miklos

Attachment: signature.asc
Description: Digital signature


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.