How to make a unit test which involves a dialog

Miklos Vajna vmiklos at
Wed Oct 14 06:48:11 UTC 2020

Hi Regina,

On Tue, Oct 13, 2020 at 03:02:33PM +0200, Regina Henschel <rb.henschel at> wrote:
> the patch for which I want to make a unit test is in
> The error is produced, when you set a new width or height for a horizontal
> or vertical line in the Position&Size dialog in Calc. So how can I use the
> Position&Size dialog in a unit test? Is it possible with C++?

Note that your patch modifies SdrEditView::ResizeMultMarkedObj(), so
calling that member function directly from a cppunit test without a
dialog is also an option.

One technique is putting a breakpoint on the function, then seeing the
backtrace of it, so you can see what internal API the dialog uses (it
may or may not call ResizeMultMarkedObj() directly) and then perform the
same API calls from cppunit, without a dialog.

See e.g. testTdf111522() in sd/qa/unit/uiimpress.cxx, you can get the
sd::ViewShell of a loaded document, and its GetView() will give you an
SdrView, which may make it possible to invoke various SdrEditView member



More information about the LibreOffice mailing list