Unittest problem with service com.sun.star.drawing.GraphicExportFilter

Regina Henschel rb.henschel at t-online.de
Tue Oct 25 19:59:07 UTC 2022

Hi Michael,

Michael Stahl schrieb am 25.10.2022 um 18:36:
> On 25.10.22 18:24, Regina Henschel wrote:
>> Hi all,
>> this is about https://gerrit.libreoffice.org/c/core/+/141830
>> tdf#83671 SmartArt: preserve pos and size for metafile
>> If you try the patch, you will see, that the SmartArt is imported in 
>> Calc as group object with one child object. The child is a 
>> "com.sun.star.drawing.GraphicObjectShape". Copying to Draw shows, that 
>> it is indeed a metafile. So the patch seems to be correct.
>> But the unit test fails. It has the warning
>> warn:oox.drawingml:2860:13240:oox/source/drawingml/shape.cxx:2039: 
>> Shape::renderDiagramToGraphic com.sun.star.uno.DeploymentException 
>> message: "component context fails to supply service 
>> com.sun.star.drawing.GraphicExportFilter of type 
>> com.sun.star.drawing.XGraphicExportFilter"
>> The warning comes from method create() from class GraphicExportFilter, 
>> where creating of "the_instance" fails. And so indeed no metafile is 
>> created.
>> I have no idea about the reason as in a normal running LO the import 
>> works and resaving as ods or xlsx has no problems.
> the unit test makefile is missing some component file.

Ah. I wouldn't have thought of that.

> many unit tests use the whole services.rdb but some unfortunately have a 
> long list of individiual files inside a call to 
> gb_CppunitTest_use_components.

CppunitTest_sc_subsequent_filters_test2.mk is:
$(eval $(call sc_subsequent_test,filters_test2))

That is, it uses template sc_subsequent_test in subsequent_setup.mk

I have added svx/util/svxcore there and now the unit test works.

> you can find the component file with a command like this:
>> git grep com.sun.star.drawing.GraphicExportFilter $(git ls-files 
>> '*.component')
> svx/util/svxcore.component:    <service 
> name="com.sun.star.drawing.GraphicExportFilter"/>
> then add the "svx/util/svxcore" to the gb_CppunitTest_use_components 
> list in the test's CppunitTest_*.mk - don't forget the '\' must be the 
> last character of the line.

Thank you for your quick help.

Kind regards,

More information about the LibreOffice mailing list