How to write a unit test for dragging an adjust handle

Regina Henschel rb.henschel at t-online.de
Wed Mar 20 15:04:40 UTC 2019


Hi Miklos,

Miklos Vajna schrieb am 20-Mar-19 um 09:28:
> Hi Regina,
> 
> On Tue, Mar 19, 2019 at 08:22:44PM +0100, Regina Henschel <rb.henschel at t-online.de> wrote:
>> it is about bug https://bugs.documentfoundation.org/show_bug.cgi?id=124212
>> Adjustment handle reacts wrongly, if custom shape has a non default viewBox
>> A fix is in https://gerrit.libreoffice.org/69439
>>
>> But I have no idea how to make a unit test for it. Perhaps you?
> 
> Here is what I would try:
> 
> - Crete a document manually that has a custom shape in it.
> 
> - Load that in a cppunit test.
> 
> - Get access to the underlying SdrObject, and downcast it to SdrObjCustomShape
> 
> - Create a EnhancedCustomShape2d manually, taking a reference to your
>    SdrObjCustomShape.
> 
> - At that point you can call the SetHandleControllerPosition() function
>    you modified in your code change and hopefully the AdjustmentValues
>    key of the SdrObject's SdrCustomShapeGeometryItem would allow you to
>    assert if the end result is good or bad.
> 
> This is really similar to what's done already in
> svx/qa/unit/customshapes.cxx:267.

Thank you.
That works, at least locally. Let's see what Gerrit says.

> 
> I.e. if possible, I would try to not emulate a full actual mouse drag in
> the test.

Not emulating a full actual mouse drag makes things a lot easier.

Kind regards
Regina


More information about the LibreOffice mailing list