How to get a bitmap of page or shape in a unit test?

Miklos Vajna vmiklos at collabora.com
Mon Feb 25 08:44:16 UTC 2019


Hi Regina,

On Mon, Feb 25, 2019 at 01:13:00AM +0100, Regina Henschel <rb.henschel at t-online.de> wrote:
> I have tried to do it the same as in SdImportTest::testTdf93124 in
> import-tests.cxx in sd/qa/unit. But I only get a bitmap of the page without
> the shape.

Asserting pixel data in bitmap is really the last resort. :-)

If possible, it's much better to do something vector-based. Either
export the shape or page into a metafile:

sw/qa/extras/layout/layout.cxx:2349

or you can also do something similar to export it to SVG.

Can you check if getting the document preview + asserting metafile
content would allow you to test your changes?

I think this approach is good if your code change affects what VCL
methods are used. (If your code change affects what is stored in the
document model, then it's better to assert the document model.)

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/20190225/2150ae19/attachment.sig>


More information about the LibreOffice mailing list