BootstrapFixture: get rid of mxComponentContext

Change-Id: I0318485c3c0159277e47096e0c7e0df8ed109ea4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169865
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli 2024-07-02 11:18:04 +02:00
parent 49e3ebcaa1
commit 83a8d5a275
45 changed files with 85 additions and 93 deletions

View file

@ -26,8 +26,7 @@ class Test : public test::BootstrapFixture, public unotest::MacrosTest
CPPUNIT_TEST_FIXTURE(Test, testBibliographyLoader)
{
// Given a bibliography provider:
uno::Reference<container::XNameAccess> xBibAccess
= frame::Bibliography::create(mxComponentContext);
uno::Reference<container::XNameAccess> xBibAccess = frame::Bibliography::create(m_xContext);
uno::Reference<beans::XPropertySet> xPropSet(xBibAccess, uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aSeq;

View file

@ -53,7 +53,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSignCertificateSubjectName)
return;
uno::Reference<xml::crypto::XSEInitializer> xSEInitializer
= xml::crypto::SEInitializer::create(mxComponentContext);
= xml::crypto::SEInitializer::create(m_xContext);
uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext
= xSEInitializer->createSecurityContext(OUString());
uno::Reference<xml::crypto::XSecurityEnvironment> xSecurityEnvironment

View file

@ -51,7 +51,7 @@ CPPUNIT_TEST_FIXTURE(Test, checkDefaultTitle)
uno::Reference<frame::XTitle> xTitle(xFrame, css::uno::UNO_QUERY);
OUString defaultTitle = xTitle->getTitle();
uno::Reference<util::XURLTransformer> xParser(util::URLTransformer::create(mxComponentContext));
uno::Reference<util::XURLTransformer> xParser(util::URLTransformer::create(m_xContext));
// Open print preview window and get title.
util::URL printPreviewURL;
@ -113,7 +113,7 @@ CPPUNIT_TEST_FIXTURE(Test, setTitleAndCheck)
uno::Reference<frame::XDispatchProvider> xDispatchProvider(xModel->getCurrentController(),
uno::UNO_QUERY);
uno::Reference<util::XURLTransformer> xParser(util::URLTransformer::create(mxComponentContext));
uno::Reference<util::XURLTransformer> xParser(util::URLTransformer::create(m_xContext));
util::URL printPreviewURL;
printPreviewURL.Complete = u".uno::PrintPreview"_ustr;

View file

@ -182,7 +182,7 @@ CPPUNIT_TEST_FIXTURE(DispatchTest, testSfxOfficeDispatchDispose)
uno::Reference<frame::XDispatchProvider> xFrame(xController->getFrame(), uno::UNO_QUERY);
CPPUNIT_ASSERT(xFrame.is());
uno::Reference<util::XURLTransformer> xParser(util::URLTransformer::create(mxComponentContext));
uno::Reference<util::XURLTransformer> xParser(util::URLTransformer::create(m_xContext));
util::URL url;
url.Complete = xModel->getURL() + "#dummy";
xParser->parseStrict(url);

View file

@ -118,7 +118,7 @@ CPPUNIT_TEST_FIXTURE(Test, testURLTransformer_parseSmart)
css::util::URL aURL;
aURL.Complete = "www.example.com:8080/foo/bar?q=baz#F";
css::uno::Reference xParser(css::util::URLTransformer::create(mxComponentContext));
css::uno::Reference xParser(css::util::URLTransformer::create(m_xContext));
CPPUNIT_ASSERT(xParser->parseSmart(aURL, u"http:"_ustr));
CPPUNIT_ASSERT_EQUAL(u"http://www.example.com:8080/foo/bar?q=baz#F"_ustr, aURL.Complete);
CPPUNIT_ASSERT_EQUAL(u"http://www.example.com:8080/foo/bar"_ustr, aURL.Main);

View file

@ -32,7 +32,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testNumberingIdentifi
std::vector<OString> aFail;
uno::Reference<text::XNumberingTypeInfo> xFormatter(
text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY);
text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY);
// Do not use getSupportedNumberingTypes() because it depends on
// configuration whether CTL and CJK numberings are included or not.
@ -83,7 +83,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero)
{
// 1 -> "01"
uno::Reference<text::XNumberingFormatter> xFormatter(
text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY);
text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aProperties = {
comphelper::makePropertyValue(u"NumberingType"_ustr,
static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO)),
@ -109,7 +109,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero3)
{
// 10 -> "010"
uno::Reference<text::XNumberingFormatter> xFormatter(
text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY);
text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aProperties = {
comphelper::makePropertyValue(u"NumberingType"_ustr,
static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO3)),
@ -135,7 +135,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero4)
{
// 100 -> "0100"
uno::Reference<text::XNumberingFormatter> xFormatter(
text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY);
text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aProperties = {
comphelper::makePropertyValue(u"NumberingType"_ustr,
static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO4)),
@ -161,7 +161,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero5)
{
// 1000 -> "01000"
uno::Reference<text::XNumberingFormatter> xFormatter(
text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY);
text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aProperties = {
comphelper::makePropertyValue(u"NumberingType"_ustr,
static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO5)),
@ -187,7 +187,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanCounting)
{
// 1 -> "일"
uno::Reference<text::XNumberingFormatter> xFormatter(
text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY);
text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aProperties = {
comphelper::makePropertyValue(
u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_HANGUL_KO)),
@ -222,7 +222,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal)
{
// 1 -> "하나"
uno::Reference<text::XNumberingFormatter> xFormatter(
text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY);
text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aProperties = {
comphelper::makePropertyValue(
u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
@ -399,7 +399,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanDigital)
{
// 1 -> "일"
uno::Reference<text::XNumberingFormatter> xFormatter(
text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY);
text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aProperties = {
comphelper::makePropertyValue(
u"NumberingType"_ustr,
@ -437,7 +437,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanDigital2)
{
// 1 -> "一"
uno::Reference<text::XNumberingFormatter> xFormatter(
text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY);
text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aProperties = {
comphelper::makePropertyValue(
u"NumberingType"_ustr,

View file

@ -46,8 +46,6 @@ class OOO_DLLPUBLIC_TEST BootstrapFixture : public BootstrapFixtureBase
bool m_bAssertOnDialog;
protected:
css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
// A convenience function to be used to conditionally exclude tests not behaving properly
// on UI scaling other than 1:1. Using this should be considered a temporary workaround,
// until a proper fix is implemented that either considers the DPI properly in the test, or

View file

@ -319,7 +319,7 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf115005)
// additional checks of the output file
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
= packages::zip::ZipFileAccess::createWithURL(mxComponentContext, maTempFile.GetURL());
= packages::zip::ZipFileAccess::createWithURL(m_xContext, maTempFile.GetURL());
// check that the document contains original vector images
const uno::Sequence<OUString> names = xNameAccess->getElementNames();
@ -352,7 +352,7 @@ int SdOOXMLExportTest3::testTdf115005_FallBack_Images(bool bAddReplacementImages
// additional checks of the output file
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
= packages::zip::ZipFileAccess::createWithURL(mxComponentContext, maTempFile.GetURL());
= packages::zip::ZipFileAccess::createWithURL(m_xContext, maTempFile.GetURL());
// check that the document contains original vector images
const uno::Sequence<OUString> names = xNameAccess->getElementNames();

View file

@ -60,7 +60,7 @@ CPPUNIT_TEST_FIXTURE(UnodrawTest, testWriterGraphicExport)
// Export it as JPEG.
uno::Reference<drawing::XGraphicExportFilter> xExportFilter
= drawing::GraphicExportFilter::create(mxComponentContext);
= drawing::GraphicExportFilter::create(m_xContext);
// This resulted in a css::lang::IllegalArgumentException for a Writer
// picture.
xExportFilter->setSourceDocument(xShape);

View file

@ -45,7 +45,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
}
Reference<XInterface> init() override

View file

@ -42,7 +42,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -45,7 +45,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -44,7 +44,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -58,7 +58,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -70,7 +70,7 @@ void SwXDocumentIndexMark::setUp()
{
test::BootstrapFixture::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxTextDocument = uno::Reference<text::XTextDocument>(
loadFromDesktop(u"private:factory/swriter"_ustr, u"com.sun.star.text.TextDocument"_ustr),
uno::UNO_QUERY_THROW);

View file

@ -46,7 +46,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -61,7 +61,7 @@ void SwXDocumentSettings::setUp()
{
test::BootstrapFixture::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
}
void SwXDocumentSettings::tearDown()

View file

@ -41,7 +41,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -85,7 +85,7 @@ void SwXFootnote::setUp()
{
test::BootstrapFixture::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxTextDocument = Reference<text::XTextDocument>(
loadFromDesktop(u"private:factory/swriter"_ustr, u"com.sun.star.text.TextDocument"_ustr),
uno::UNO_QUERY_THROW);

View file

@ -45,7 +45,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -46,7 +46,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -52,7 +52,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -42,7 +42,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -44,7 +44,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -48,7 +48,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -48,7 +48,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -49,7 +49,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -51,7 +51,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -54,7 +54,7 @@ struct SwXTextField final : public UnoApiTest,
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -45,7 +45,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -45,7 +45,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -39,7 +39,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -49,7 +49,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -46,7 +46,7 @@ public:
virtual void setUp() override
{
UnoApiTest::setUp();
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
CPPUNIT_ASSERT(mxComponent.is());
}

View file

@ -2432,7 +2432,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf133477)
// Save the shape to a BMP.
uno::Reference<drawing::XGraphicExportFilter> xGraphicExporter
= drawing::GraphicExportFilter::create(mxComponentContext);
= drawing::GraphicExportFilter::create(m_xContext);
uno::Reference<lang::XComponent> xSourceDoc(getShape(1), uno::UNO_QUERY);
xGraphicExporter->setSourceDocument(xSourceDoc);

View file

@ -43,7 +43,7 @@ void test::AccessibleTestBase::setUp()
{
test::BootstrapFixture::setUp();
mxDesktop = frame::Desktop::create(mxComponentContext);
mxDesktop = frame::Desktop::create(m_xContext);
}
void test::AccessibleTestBase::close()

View file

@ -113,8 +113,6 @@ void test::BootstrapFixture::setUp()
#if OSL_DEBUG_LEVEL > 0
Scheduler::ProcessEventsToIdle();
#endif
mxComponentContext.set(comphelper::getComponentContext(getMultiServiceFactory()));
}
test::BootstrapFixture::~BootstrapFixture()

View file

@ -33,18 +33,17 @@ class DialogTest : public test::BootstrapFixture, public unotest::MacrosTest
CPPUNIT_TEST_FIXTURE(DialogTest, testDialogSizeable)
{
uno::Reference<awt::XDialog> xDialog;
uno::Reference<lang::XMultiComponentFactory> xFactory(mxComponentContext->getServiceManager(),
uno::Reference<lang::XMultiComponentFactory> xFactory(m_xContext->getServiceManager(),
uno::UNO_SET_THROW);
uno::Reference<awt::XControlModel> xControlModel(
xFactory->createInstanceWithContext(u"com.sun.star.awt.UnoControlDialogModel"_ustr,
mxComponentContext),
m_xContext),
uno::UNO_QUERY_THROW);
uno::Reference<beans::XPropertySet> xPropSet(xControlModel, uno::UNO_QUERY_THROW);
xPropSet->setPropertyValue(u"Sizeable"_ustr, uno::Any(true));
uno::Reference<awt::XUnoControlDialog> xControl
= awt::UnoControlDialog::create(mxComponentContext);
uno::Reference<awt::XUnoControlDialog> xControl = awt::UnoControlDialog::create(m_xContext);
xControl->setModel(xControlModel);
xControl->setVisible(true);
xDialog.set(xControl, uno::UNO_QUERY_THROW);

View file

@ -38,11 +38,10 @@ class EventContainerTest : public test::BootstrapFixture
// Otherwise this would break macro signatures.
CPPUNIT_TEST_FIXTURE(EventContainerTest, testInsertOrder)
{
Reference<XMultiComponentFactory> xFactory(mxComponentContext->getServiceManager(),
UNO_SET_THROW);
Reference<XMultiComponentFactory> xFactory(m_xContext->getServiceManager(), UNO_SET_THROW);
Reference<XControlModel> xControlModel(
xFactory->createInstanceWithContext(u"com.sun.star.awt.UnoControlDialogModel"_ustr,
mxComponentContext),
m_xContext),
UNO_QUERY_THROW);
Reference<beans::XPropertySet> xPropSet(xControlModel, UNO_QUERY_THROW);

View file

@ -51,7 +51,7 @@ void VclFilterIpdfTest::setUp()
UnoApiTest::setUp();
MacrosTest::setUpX509(m_directories, u"vcl_filter_ipdf"_ustr);
mxSEInitializer = xml::crypto::SEInitializer::create(mxComponentContext);
mxSEInitializer = xml::crypto::SEInitializer::create(m_xContext);
mxSecurityContext = mxSEInitializer->createSecurityContext(OUString());
}

View file

@ -77,8 +77,7 @@ void EPUBExportTest::createDoc(std::u16string_view rFile,
else
aMediaDescriptor[u"FilterOptions"_ustr] <<= maFilterOptions;
xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
mxZipFile
= packages::zip::ZipFileAccess::createWithURL(mxComponentContext, maTempFile.GetURL());
mxZipFile = packages::zip::ZipFileAccess::createWithURL(m_xContext, maTempFile.GetURL());
}
std::map<OUString, std::vector<OUString>> EPUBExportTest::parseCss(const OUString& rName)
@ -165,7 +164,7 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testMimetype)
mpXmlDoc, "/opf:package/opf:metadata/opf:meta[@name='generator']"_ostr, "content"_ostr);
CPPUNIT_ASSERT(aGenerator.startsWith(utl::DocInfoHelper::GetGeneratorString()));
uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponentContext->getServiceManager(),
uno::Reference<lang::XMultiServiceFactory> xMSF(m_xContext->getServiceManager(),
uno::UNO_QUERY);
constexpr OUString aServiceName(u"com.sun.star.comp.Writer.EPUBExportFilter"_ustr);
uno::Reference<document::XFilter> xFilter(xMSF->createInstance(aServiceName), uno::UNO_QUERY);

View file

@ -70,7 +70,7 @@ void XmlScriptTest::setUp()
test::BootstrapFixture::setUp();
maDataPath = "/xmlscript/qa/cppunit/data/";
mxDesktop.set(frame::Desktop::create(mxComponentContext));
mxDesktop.set(frame::Desktop::create(m_xContext));
}
Reference<container::XNameContainer> XmlScriptTest::importFile(std::u16string_view sFileName)
@ -87,12 +87,12 @@ Reference<container::XNameContainer> XmlScriptTest::importFile(std::u16string_vi
aFile.close();
Reference<container::XNameContainer> xDialogModel(
mxComponentContext->getServiceManager()->createInstanceWithContext(
u"com.sun.star.awt.UnoControlDialogModel"_ustr, mxComponentContext),
m_xContext->getServiceManager()->createInstanceWithContext(
u"com.sun.star.awt.UnoControlDialogModel"_ustr, m_xContext),
UNO_QUERY);
::xmlscript::importDialogModel(::xmlscript::createInputStream(std::move(bytes)), xDialogModel,
mxComponentContext, nullptr);
m_xContext, nullptr);
Reference<lang::XComponent> xDialogModelComp(xDialogModel, UNO_QUERY);
if (xDialogModelComp)
@ -105,7 +105,7 @@ void XmlScriptTest::exportToFile(std::u16string_view sURL,
Reference<container::XNameContainer> const& xDialogModel)
{
Reference<io::XInputStreamProvider> xProvider(
::xmlscript::exportDialogModel(xDialogModel, mxComponentContext, nullptr));
::xmlscript::exportDialogModel(xDialogModel, m_xContext, nullptr));
Reference<io::XInputStream> xStream(xProvider->createInputStream());
Sequence<sal_Int8> bytes;

View file

@ -73,7 +73,7 @@ void PDFSigningTest::setUp()
MacrosTest::setUpX509(m_directories, u"xmlsecurity_pdfsigning"_ustr);
uno::Reference<xml::crypto::XSEInitializer> xSEInitializer
= xml::crypto::SEInitializer::create(mxComponentContext);
= xml::crypto::SEInitializer::create(m_xContext);
uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext
= xSEInitializer->createSecurityContext(OUString());
#if USE_CRYPTO_NSS
@ -88,7 +88,7 @@ void PDFSigningTest::setUp()
std::vector<SignatureInformation> PDFSigningTest::verify(const OUString& rURL, size_t nCount)
{
uno::Reference<xml::crypto::XSEInitializer> xSEInitializer
= xml::crypto::SEInitializer::create(mxComponentContext);
= xml::crypto::SEInitializer::create(m_xContext);
uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext
= xSEInitializer->createSecurityContext(OUString());
std::vector<SignatureInformation> aRet;
@ -116,7 +116,7 @@ bool PDFSigningTest::sign(const OUString& rInURL, const OUString& rOutURL,
{
// Make sure that input has nOriginalSignatureCount signatures.
uno::Reference<xml::crypto::XSEInitializer> xSEInitializer
= xml::crypto::SEInitializer::create(mxComponentContext);
= xml::crypto::SEInitializer::create(m_xContext);
uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext
= xSEInitializer->createSecurityContext(OUString());
vcl::filter::PDFDocument aDocument;
@ -238,7 +238,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFRemove)
// Make sure that good.pdf has 1 valid signature.
uno::Reference<xml::crypto::XSEInitializer> xSEInitializer
= xml::crypto::SEInitializer::create(mxComponentContext);
= xml::crypto::SEInitializer::create(m_xContext);
uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext
= xSEInitializer->createSecurityContext(OUString());
vcl::filter::PDFDocument aDocument;
@ -284,7 +284,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFRemoveAll)
// testPDFRemove(), here intentionally test DocumentSignatureManager and
// PDFSignatureHelper code as well.
uno::Reference<xml::crypto::XSEInitializer> xSEInitializer
= xml::crypto::SEInitializer::create(mxComponentContext);
= xml::crypto::SEInitializer::create(m_xContext);
uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext
= xSEInitializer->createSecurityContext(OUString());
@ -296,7 +296,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFRemoveAll)
osl::File::RC::E_None,
osl::File::copy(m_directories.getURLFromSrc(DATA_DIRECTORY) + "2good.pdf", aOutURL));
// Load the test document as a storage and read its two signatures.
DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content);
DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content);
std::unique_ptr<SvStream> pStream
= utl::UcbStreamHelper::CreateStream(aOutURL, StreamMode::READ | StreamMode::WRITE);
uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(std::move(pStream)));
@ -320,12 +320,12 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFRemoveAll)
CPPUNIT_TEST_FIXTURE(PDFSigningTest, testTdf107782)
{
uno::Reference<xml::crypto::XSEInitializer> xSEInitializer
= xml::crypto::SEInitializer::create(mxComponentContext);
= xml::crypto::SEInitializer::create(m_xContext);
uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext
= xSEInitializer->createSecurityContext(OUString());
// Load the test document as a storage and read its signatures.
DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content);
DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content);
OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf107782.pdf";
std::unique_ptr<SvStream> pStream
= utl::UcbStreamHelper::CreateStream(aURL, StreamMode::READ | StreamMode::WRITE);
@ -590,13 +590,13 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testUnknownSubFilter)
// Tokenize the bugdoc.
uno::Reference<xml::crypto::XSEInitializer> xSEInitializer
= xml::crypto::SEInitializer::create(mxComponentContext);
= xml::crypto::SEInitializer::create(m_xContext);
uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext
= xSEInitializer->createSecurityContext(OUString());
std::unique_ptr<SvStream> pStream = utl::UcbStreamHelper::CreateStream(
m_directories.getURLFromSrc(DATA_DIRECTORY) + "cr-comment.pdf", StreamMode::STD_READ);
uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(std::move(pStream)));
DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content);
DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content);
aManager.setSignatureStream(xStream);
aManager.read(/*bUseTempStream=*/false);
@ -615,14 +615,14 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testGoodCustomMagic)
// Tokenize the bugdoc.
uno::Reference<xml::crypto::XSEInitializer> xSEInitializer
= xml::crypto::SEInitializer::create(mxComponentContext);
= xml::crypto::SEInitializer::create(m_xContext);
uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext
= xSEInitializer->createSecurityContext(OUString());
std::unique_ptr<SvStream> pStream = utl::UcbStreamHelper::CreateStream(
m_directories.getURLFromSrc(DATA_DIRECTORY) + "good-custom-magic.pdf",
StreamMode::STD_READ);
uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(std::move(pStream)));
DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content);
DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content);
aManager.setSignatureStream(xStream);
aManager.read(/*bUseTempStream=*/false);

View file

@ -96,7 +96,7 @@ void SigningTest::setUp()
MacrosTest::setUpGpg(m_directories, u"xmlsecurity_signing"_ustr);
// Initialize crypto after setting up the environment variables.
mxSEInitializer = xml::crypto::SEInitializer::create(mxComponentContext);
mxSEInitializer = xml::crypto::SEInitializer::create(m_xContext);
mxSecurityContext = mxSEInitializer->createSecurityContext(OUString());
#if USE_CRYPTO_NSS
#ifdef NSS_USE_ALG_IN_ANY_SIGNATURE
@ -141,7 +141,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testDescription)
save(u"writer8"_ustr);
DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content);
DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content);
CPPUNIT_ASSERT(aManager.init());
uno::Reference<embed::XStorage> xStorage
= comphelper::OStorageHelper::GetStorageOfFormatFromURL(
@ -173,7 +173,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testECDSA)
save(u"writer8"_ustr);
DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content);
DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content);
CPPUNIT_ASSERT(aManager.init());
uno::Reference<embed::XStorage> xStorage
= comphelper::OStorageHelper::GetStorageOfFormatFromURL(
@ -207,7 +207,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testECDSAOOXML)
save(u"MS Word 2007 XML"_ustr);
DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content);
DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content);
CPPUNIT_ASSERT(aManager.init());
uno::Reference<embed::XStorage> xStorage
= comphelper::OStorageHelper::GetStorageOfFormatFromURL(
@ -243,7 +243,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testECDSAPDF)
save(u"writer_pdf_Export"_ustr);
DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content);
DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content);
CPPUNIT_ASSERT(aManager.init());
std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(
maTempFile.GetURL(), StreamMode::READ | StreamMode::WRITE));
@ -283,7 +283,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLDescription)
save(u"MS Word 2007 XML"_ustr);
DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content);
DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content);
CPPUNIT_ASSERT(aManager.init());
uno::Reference<embed::XStorage> xStorage
= comphelper::OStorageHelper::GetStorageOfFormatFromURL(
@ -314,7 +314,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLAppend)
// Copy the test document to a temporary file, as it'll be modified.
createTempCopy(u"partial.docx");
// Load the test document as a storage and read its single signature.
DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content);
DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content);
CPPUNIT_ASSERT(aManager.init());
uno::Reference<embed::XStorage> xStorage
= comphelper::OStorageHelper::GetStorageOfFormatFromURL(
@ -344,7 +344,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLAppend)
CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLRemove)
{
// Load the test document as a storage and read its signatures: purpose1 and purpose2.
DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content);
DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content);
CPPUNIT_ASSERT(aManager.init());
createTempCopy(u"multi.docx");
uno::Reference<embed::XStorage> xStorage
@ -376,7 +376,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLRemoveAll)
// Copy the test document to a temporary file, as it'll be modified.
createTempCopy(u"partial.docx");
// Load the test document as a storage and read its single signature.
DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content);
DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content);
CPPUNIT_ASSERT(aManager.init());
uno::Reference<embed::XStorage> xStorage
= comphelper::OStorageHelper::GetStorageOfFormatFromURL(
@ -406,7 +406,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLRemoveAll)
= xStorage->openStreamElement(u"[Content_Types].xml"_ustr, embed::ElementModes::READWRITE);
uno::Reference<io::XInputStream> xInputStream = xStream->getInputStream();
uno::Sequence<uno::Sequence<beans::StringPair>> aContentTypeInfo
= comphelper::OFOPXMLHelper::ReadContentTypeSequence(xInputStream, mxComponentContext);
= comphelper::OFOPXMLHelper::ReadContentTypeSequence(xInputStream, m_xContext);
const uno::Sequence<beans::StringPair>& rOverrides = aContentTypeInfo[1];
CPPUNIT_ASSERT(
std::none_of(rOverrides.begin(), rOverrides.end(), [](const beans::StringPair& rPair) {
@ -841,7 +841,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testXAdESNotype)
createTempCopy(u"notype-xades.odt");
// Read existing signature.
DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content);
DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content);
CPPUNIT_ASSERT(aManager.init());
uno::Reference<embed::XStorage> xStorage
= comphelper::OStorageHelper::GetStorageOfFormatFromURL(
@ -897,7 +897,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testXAdES)
save(u"writer8"_ustr);
DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content);
DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content);
CPPUNIT_ASSERT(aManager.init());
uno::Reference<embed::XStorage> xStorage
= comphelper::OStorageHelper::GetStorageOfFormatFromURL(
@ -950,7 +950,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testSigningMultipleTimes_ODT)
save(u"writer8"_ustr);
{
DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content);
DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content);
CPPUNIT_ASSERT(aManager.init());
uno::Reference<embed::XStorage> xStorage
= comphelper::OStorageHelper::GetStorageOfFormatFromURL(
@ -1023,7 +1023,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testSigningMultipleTimes_OOXML)
save(u"MS Word 2007 XML"_ustr);
{
DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content);
DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content);
CPPUNIT_ASSERT(aManager.init());
uno::Reference<embed::XStorage> xStorage
= comphelper::OStorageHelper::GetStorageOfFormatFromURL(

View file

@ -60,7 +60,7 @@ void SigningTest2::setUp()
MacrosTest::setUpGpg(m_directories, u"xmlsecurity_signing2"_ustr);
// Initialize crypto after setting up the environment variables.
mxSEInitializer = xml::crypto::SEInitializer::create(mxComponentContext);
mxSEInitializer = xml::crypto::SEInitializer::create(m_xContext);
mxSecurityContext = mxSEInitializer->createSecurityContext(OUString());
#if USE_CRYPTO_NSS
#ifdef NSS_USE_ALG_IN_ANY_SIGNATURE