CppunitTest_framework_services: inherit from UnoApiTest

Change-Id: I8963f0dbf5e70347ee98e639dc6eeecc0f43b821
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143099
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli 2022-11-22 11:07:23 +01:00
parent 8654586816
commit 70a84bc0ee
2 changed files with 10 additions and 25 deletions

View file

@ -21,8 +21,11 @@ $(eval $(call gb_CppunitTest_use_libraries,framework_services, \
cppuhelper \
sal \
salhelper \
subsequenttest \
test \
unotest \
utl \
tl \
vcl \
))

View file

@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <test/bootstrapfixture.hxx>
#include <unotest/macros_test.hxx>
#include <test/unoapi_test.hxx>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XFrame.hpp>
@ -27,32 +26,15 @@ using namespace ::com::sun::star;
namespace
{
/// Covers framework/source/services/ fixes.
class Test : public test::BootstrapFixture, public unotest::MacrosTest
class Test : public UnoApiTest
{
protected:
uno::Reference<lang::XComponent> mxComponent;
public:
void setUp() override;
void tearDown() override;
uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
Test()
: UnoApiTest("/framework/qa/cppunit/data/")
{
}
};
void Test::setUp()
{
test::BootstrapFixture::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
}
void Test::tearDown()
{
if (mxComponent.is())
mxComponent->dispose();
test::BootstrapFixture::tearDown();
}
/// Invokes XFrameImpl::loadComponentFromURL() on a thread.
class TestThread : public salhelper::Thread
{
@ -106,7 +88,7 @@ CPPUNIT_TEST_FIXTURE(Test, testLoadComponentFromURL)
SolarMutexGuard guard;
uno::Reference<frame::XFrame> xFrame = mxDesktop->findFrame("_blank", /*nSearchFlags=*/0);
uno::Reference<frame::XComponentLoader> xComponentLoader(xFrame, uno::UNO_QUERY);
xThread = new TestThread(xComponentLoader, getComponent());
xThread = new TestThread(xComponentLoader, mxComponent);
xThread->launch();
// If loadComponentFromURL() doesn't lock the solar mutex, the test will abort here.
osl::Thread::wait(std::chrono::seconds(1));