Hi all,
I try to write a unit test in xmloff for
https://gerrit.libreoffice.org/66888. I would need to load a file and
examine, whether it is rendered correctly. My idea was to use
loadFromDesktop() from unotest::MacrosTest. I have tried to mimic what I
have seen elsewhere, but it does not work. What I have done so far:
class DrawTest : public test::BootstrapFixture, public unotest::MacrosTest
and then
void DrawTest::setUp()
{
BootstrapFixture::setUp();
mxComponentContext.set(comphelper::getComponentContext(getMultiServiceFactory()));
mxDesktop.set(frame::Desktop::create(mxComponentContext));
}
but that gives the error
setUp() failed
- An uncaught exception of type com.sun.star.uno.DeploymentException
- component context fails to supply service com.sun.star.frame.Desktop
of type com.sun.star.frame.XDesktop2
The same error with
void DrawTest::setUp()
{
BootstrapFixture::setUp();
m_xContext = comphelper::getProcessComponentContext();
mxDesktop.set(frame::Desktop::create(m_xContext));
}
And here the assertion fails
void DrawTest::setUp()
{
BootstrapFixture::setUp();
m_xImpressComponent =
getMultiServiceFactory()->createInstance("com.sun.star.comp.presentation.PresentationDocument");
CPPUNIT_ASSERT_MESSAGE("no m_xImpressComponent",
m_xImpressComponent.is());
}
HowTo load a file in unit test in xmloff?
Kind regards
Regina
_______________________________________________
LibreOffice mailing list
LibreOffice@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/libreoffice