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

Regina Henschel rb.henschel at t-online.de
Mon Feb 25 00:13:00 UTC 2019


Hi all,

the current implementation of custom shape commands U and T 
(angleellipse) is wrong in the way, that for a command U with a series 
parameter groups only the first it treated as command U but the second 
as command T. Thus a line is drawn, where no line should be. My patch 
fixes this.
I now want to make a unit test for it. I thought, that I make a bitmap 
from the page or from the shape and look, whether the pixel at the place 
of the line has the stroke color or the background color. But I cannot 
create a bitmap.

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.

I have some other ideas, but without success:
Save the file and examine the thumbnail. How can I load the thumbnail 
out of a package?
Using dispatcher and convert the shape to a bitmap. How to use 
dispatcher in a unit test? I only now it from macros.

Other methods to get a bitmap from a page or shape?

Or do methods exists to get the color at a position without bitmap?

Or any other idea, how to test it? The erroneous line is always between 
the segments, so that my trick of the other tests, to look at the 
bounding box, does not work here.

Kind regards
Regina



More information about the LibreOffice mailing list