How to write a unit test for dragging an adjust handle

Miklos Vajna vmiklos at
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> wrote:
> it is about bug
> Adjustment handle reacts wrongly, if custom shape has a non default viewBox
> A fix is in
> 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

- 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

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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: Digital signature
URL: <>

More information about the LibreOffice mailing list