CppunitTest_toolkit: simplify code
Change-Id: Id5fd9d1ebe11551b73b44b6d12414d5418dd4de1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169863 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
parent
f457046fa4
commit
49e3ebcaa1
2 changed files with 7 additions and 29 deletions
|
@ -28,34 +28,23 @@ namespace
|
||||||
/// Test dialogs constructed via UNO
|
/// Test dialogs constructed via UNO
|
||||||
class DialogTest : public test::BootstrapFixture, public unotest::MacrosTest
|
class DialogTest : public test::BootstrapFixture, public unotest::MacrosTest
|
||||||
{
|
{
|
||||||
protected:
|
|
||||||
uno::Reference<uno::XComponentContext> mxContext;
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual void setUp() override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void DialogTest::setUp()
|
|
||||||
{
|
|
||||||
test::BootstrapFixture::setUp();
|
|
||||||
|
|
||||||
mxContext.set(comphelper::getComponentContext(getMultiServiceFactory()));
|
|
||||||
}
|
|
||||||
|
|
||||||
CPPUNIT_TEST_FIXTURE(DialogTest, testDialogSizeable)
|
CPPUNIT_TEST_FIXTURE(DialogTest, testDialogSizeable)
|
||||||
{
|
{
|
||||||
uno::Reference<awt::XDialog> xDialog;
|
uno::Reference<awt::XDialog> xDialog;
|
||||||
uno::Reference<lang::XMultiComponentFactory> xFactory(mxContext->getServiceManager(),
|
uno::Reference<lang::XMultiComponentFactory> xFactory(mxComponentContext->getServiceManager(),
|
||||||
uno::UNO_SET_THROW);
|
uno::UNO_SET_THROW);
|
||||||
uno::Reference<awt::XControlModel> xControlModel(
|
uno::Reference<awt::XControlModel> xControlModel(
|
||||||
xFactory->createInstanceWithContext(u"com.sun.star.awt.UnoControlDialogModel"_ustr,
|
xFactory->createInstanceWithContext(u"com.sun.star.awt.UnoControlDialogModel"_ustr,
|
||||||
mxContext),
|
mxComponentContext),
|
||||||
uno::UNO_QUERY_THROW);
|
uno::UNO_QUERY_THROW);
|
||||||
|
|
||||||
uno::Reference<beans::XPropertySet> xPropSet(xControlModel, uno::UNO_QUERY_THROW);
|
uno::Reference<beans::XPropertySet> xPropSet(xControlModel, uno::UNO_QUERY_THROW);
|
||||||
xPropSet->setPropertyValue(u"Sizeable"_ustr, uno::Any(true));
|
xPropSet->setPropertyValue(u"Sizeable"_ustr, uno::Any(true));
|
||||||
|
|
||||||
uno::Reference<awt::XUnoControlDialog> xControl = awt::UnoControlDialog::create(mxContext);
|
uno::Reference<awt::XUnoControlDialog> xControl
|
||||||
|
= awt::UnoControlDialog::create(mxComponentContext);
|
||||||
xControl->setModel(xControlModel);
|
xControl->setModel(xControlModel);
|
||||||
xControl->setVisible(true);
|
xControl->setVisible(true);
|
||||||
xDialog.set(xControl, uno::UNO_QUERY_THROW);
|
xDialog.set(xControl, uno::UNO_QUERY_THROW);
|
||||||
|
|
|
@ -32,28 +32,17 @@ namespace
|
||||||
/// Test EventContainer class
|
/// Test EventContainer class
|
||||||
class EventContainerTest : public test::BootstrapFixture
|
class EventContainerTest : public test::BootstrapFixture
|
||||||
{
|
{
|
||||||
protected:
|
|
||||||
Reference<XComponentContext> mxContext;
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual void setUp() override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void EventContainerTest::setUp()
|
|
||||||
{
|
|
||||||
test::BootstrapFixture::setUp();
|
|
||||||
|
|
||||||
mxContext.set(comphelper::getComponentContext(getMultiServiceFactory()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure that EventContainer keeps insertion order, and does not reorder its elements.
|
// Make sure that EventContainer keeps insertion order, and does not reorder its elements.
|
||||||
// Otherwise this would break macro signatures.
|
// Otherwise this would break macro signatures.
|
||||||
CPPUNIT_TEST_FIXTURE(EventContainerTest, testInsertOrder)
|
CPPUNIT_TEST_FIXTURE(EventContainerTest, testInsertOrder)
|
||||||
{
|
{
|
||||||
Reference<XMultiComponentFactory> xFactory(mxContext->getServiceManager(), UNO_SET_THROW);
|
Reference<XMultiComponentFactory> xFactory(mxComponentContext->getServiceManager(),
|
||||||
|
UNO_SET_THROW);
|
||||||
Reference<XControlModel> xControlModel(
|
Reference<XControlModel> xControlModel(
|
||||||
xFactory->createInstanceWithContext(u"com.sun.star.awt.UnoControlDialogModel"_ustr,
|
xFactory->createInstanceWithContext(u"com.sun.star.awt.UnoControlDialogModel"_ustr,
|
||||||
mxContext),
|
mxComponentContext),
|
||||||
UNO_QUERY_THROW);
|
UNO_QUERY_THROW);
|
||||||
|
|
||||||
Reference<beans::XPropertySet> xPropSet(xControlModel, UNO_QUERY_THROW);
|
Reference<beans::XPropertySet> xPropSet(xControlModel, UNO_QUERY_THROW);
|
||||||
|
|
Loading…
Reference in a new issue