How to copy text from shape to body text in a unit test

Joao S. O. Bueno gwidion at gmail.com
Thu Jan 11 12:24:36 UTC 2024


A slight unrelated comment, by a luker on the project:

Really thank you for taking your time to write tests for behaviors
like these. As you know, these complex iterations have tons
of edge cases, and that usually bytes users at the worst moments,
and it has been so in all wysiwyg apps ever written - these will sure
make L.O. a more predictable, and nice to use, tool.

On Thu, Jan 11, 2024 at 7:56 AM Miklos Vajna <vmiklos at collabora.com> wrote:
>
> Hi Regina,
>
> On Wed, Jan 10, 2024 at 06:29:24PM +0100, Regina Henschel <rb.henschel at t-online.de> wrote:
> > please have a look at the unit test in
> > https://gerrit.libreoffice.org/c/core/+/161842. It works but it looks
> > strange to me.
> > The task is this:
> > Copy the text content of a shape and paste it in rich text format to the
> > body text. Make sure, that a line break (shift enter) in the original text
> > is preserved in the pasted text.
> >
> > It there a better way for this task in a unit test?
>
> I think you do want to copy and paste there, because that's how the
> editeng RTF export is invoked. An alternative would be to go via
> text::XTextCopy, but that is more about copying from Writer to Writer.
>
> The other odd part of the test is how you enter and leave the shape text
> edit mode. You can see how SwTiledRenderingTest's testViewLock uses
> BeginTextEdit() and EndTextEdit() for this. If it works in your case,
> then using those functions instead of pressing "enter" and "esc" at
> magic places would be more clean, I guess.
>
> Regards,
>
> Miklos


More information about the LibreOffice mailing list