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

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


Hi Miklos,

Miklos Vajna schrieb am 25-Feb-19 um 09:44:
> 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

Still in import-tests.cxx, I have now the lines

sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/tdf121845_Two_commands_U.odp"), 
ODP);

std::shared_ptr<GDIMetaFile> xMetaFile = 
xDocShRef.get()->GetPreviewMetaFile();
xMetaFile->dumpAsXml(OUString("myfirstmetafile.xml"));
MetafileXmlDump dumper;
xmlDocPtr pXmlDoc = XmlTestTools::dumpAndParse(dumper, *xMetaFile);

But the content of 'myfirstmetafile.xml' has no shape, but only the 
page. Background color and size of the page is correct.
[Of cause, the file 'myfirstmetafile.xml' does not belong to a final 
solution.]

The problem is similar. I do not get the shape.

Kind regards
Regina



More information about the LibreOffice mailing list