diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-10-21 14:12:29 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-10-21 18:59:47 +0200 |
commit | 03d6d07d8c1be4f0123f1f9b05b4e5f0f92eabf6 (patch) | |
tree | 122fd2ad515e9d1ece8cc632c2e545ec7d19afda /test | |
parent | b08cf04012655c4995e3fe5a1f3b698615db5f11 (diff) |
CalcUnoApiTest: work with mxComponent directly
Change-Id: If6f2104ef3136952341c9d5d59a1f9784d0fe4b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141628
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/source/calc_unoapi_test.cxx | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/test/source/calc_unoapi_test.cxx b/test/source/calc_unoapi_test.cxx index fc8cae982bea..a0423cbc7e67 100644 --- a/test/source/calc_unoapi_test.cxx +++ b/test/source/calc_unoapi_test.cxx @@ -11,7 +11,6 @@ #include <sfx2/objsh.hxx> #include <com/sun/star/frame/XStorable.hpp> -#include <com/sun/star/util/XCloseable.hpp> #include <comphelper/propertyvalue.hxx> using namespace css; @@ -22,22 +21,15 @@ CalcUnoApiTest::CalcUnoApiTest(const OUString& path) { } -void CalcUnoApiTest::setUp() -{ - UnoApiTest::setUp(); - - // This is a bit of a fudge, we do this to ensure that ScGlobals::ensure, - // which is a private symbol to us, gets called - m_xCalcComponent = - getMultiServiceFactory()->createInstance("com.sun.star.comp.Calc.SpreadsheetDocument"); - CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xCalcComponent.is()); -} - void CalcUnoApiTest::tearDown() { - closeDocument(mxComponent); - uno::Reference< lang::XComponent >( m_xCalcComponent, UNO_QUERY_THROW )->dispose(); - UnoApiTest::tearDown(); + if (mxComponent.is()) + { + mxComponent->dispose(); + mxComponent.clear(); + } + + test::BootstrapFixture::tearDown(); } uno::Any CalcUnoApiTest::executeMacro(const OUString& rScriptURL, const uno::Sequence<uno::Any>& rParams) @@ -61,8 +53,8 @@ utl::TempFileNamed CalcUnoApiTest::save(const OUString& rFilter) uno::Sequence aArgs{ comphelper::makePropertyValue("FilterName", rFilter) }; css::uno::Reference<frame::XStorable> xStorable(mxComponent, css::uno::UNO_QUERY_THROW); xStorable->storeAsURL(aTempFile.GetURL(), aArgs); - css::uno::Reference<util::XCloseable> xCloseable(mxComponent, css::uno::UNO_QUERY_THROW); - xCloseable->close(true); + mxComponent->dispose(); + mxComponent.clear(); return aTempFile; } |