How to write a unit test for dragging an adjust handle

Miklos Vajna vmiklos at collabora.com
Wed Mar 20 08:28:38 UTC 2019


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.

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

Regards,

Miklos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: Digital signature
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20190320/9b8753db/attachment.sig>


More information about the LibreOffice mailing list