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
Context
- HowTo load a file in unit test in xmloff? · Regina Henschel
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.