diff options
64 files changed, 361 insertions, 319 deletions
diff --git a/basic/qa/cppunit/basic_coverage.cxx b/basic/qa/cppunit/basic_coverage.cxx index a77b85a05470..585d54ad007a 100644 --- a/basic/qa/cppunit/basic_coverage.cxx +++ b/basic/qa/cppunit/basic_coverage.cxx @@ -138,7 +138,7 @@ void Coverage::process_directory(const OUString& sDirName) void Coverage::Coverage_Iterator() { - OUString sDirName = getURLFromSrc("/basic/qa/basic_coverage/"); + OUString sDirName = m_directories.getURLFromSrc("/basic/qa/basic_coverage/"); CPPUNIT_ASSERT(!sDirName.isEmpty()); process_directory(sDirName); // any files in the root test dir are run in test harness default locale ( en-US ) diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx index b70d51096d37..265aaf6f7e91 100644 --- a/basic/qa/cppunit/test_vba.cxx +++ b/basic/qa/cppunit/test_vba.cxx @@ -54,7 +54,7 @@ void VBATest::testMiscVBAFunctions() #endif "win32compatb.vb" // same methods, different signatures. }; - OUString sMacroPathURL = getURLFromSrc("/basic/qa/vba_tests/"); + OUString sMacroPathURL = m_directories.getURLFromSrc("/basic/qa/vba_tests/"); // Some test data expects the uk locale LanguageTag aLocale(LANGUAGE_ENGLISH_UK); SvtSysLocaleOptions aLocalOptions; @@ -109,11 +109,11 @@ void VBATest::testMiscOLEStuff() "ole_dfltObjDflMethod.vb", }; - OUString sMacroPathURL = getURLFromSrc("/basic/qa/vba_tests/"); + OUString sMacroPathURL = m_directories.getURLFromSrc("/basic/qa/vba_tests/"); uno::Sequence< uno::Any > aArgs(1); // path to test document - OUString sPath = getPathFromSrc("/basic/qa/vba_tests/data/"); + OUString sPath = m_directories.getPathFromSrc("/basic/qa/vba_tests/data/"); sPath += "ADODBdata.xls"; sPath = sPath.replaceAll( "/", "\\" ); diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx index 21e89feb3b94..874948bd9e4f 100644 --- a/chart2/qa/extras/charttest.hxx +++ b/chart2/qa/extras/charttest.hxx @@ -113,7 +113,7 @@ void ChartTest::load( const OUString& aDir, const OUString& aName ) maServiceName = "com.sun.star.drawing.DrawingDocument"; } - mxComponent = loadFromDesktop(getURLFromSrc(aDir) + aName, maServiceName); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(aDir) + aName, maServiceName); CPPUNIT_ASSERT(mxComponent.is()); } @@ -414,7 +414,7 @@ std::vector<uno::Sequence<uno::Any> > getDataSeriesLabelsFromChartType( const Re uno::Reference< chart::XChartDocument > ChartTest::getChartDocFromImpress( const char* pDir, const char* pName ) { - mxComponent = loadFromDesktop(getURLFromSrc(pDir) + OUString::createFromAscii(pName), "com.sun.star.comp.Draw.PresentationDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(pDir) + OUString::createFromAscii(pName), "com.sun.star.comp.Draw.PresentationDocument"); uno::Reference< drawing::XDrawPagesSupplier > xDoc(mxComponent, uno::UNO_QUERY_THROW ); uno::Reference< drawing::XDrawPage > xPage( xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW ); diff --git a/connectivity/qa/connectivity/ado/DriverTest.cxx b/connectivity/qa/connectivity/ado/DriverTest.cxx index c4fdf709c4a9..bc62ee699c3b 100644 --- a/connectivity/qa/connectivity/ado/DriverTest.cxx +++ b/connectivity/qa/connectivity/ado/DriverTest.cxx @@ -62,7 +62,7 @@ void AdoDriverTest::setUp() CPPUNIT_ASSERT_MESSAGE("no ado component!", m_xAdoComponent.is()); OUString url = "sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + - getPathFromWorkdir("/CppunitTest/TS001018407.mdb"); + m_directories.getPathFromWorkdir("/CppunitTest/TS001018407.mdb"); Sequence< PropertyValue > info; Reference< XDriver> xDriver(m_xAdoComponent, UNO_QUERY); diff --git a/connectivity/qa/connectivity/mork/DriverTest.cxx b/connectivity/qa/connectivity/mork/DriverTest.cxx index bdcfc622181d..38de4520ea84 100644 --- a/connectivity/qa/connectivity/mork/DriverTest.cxx +++ b/connectivity/qa/connectivity/mork/DriverTest.cxx @@ -65,7 +65,7 @@ void MorkDriverTest::setUp() // is this the best way to pass test file through URL? // may be take a custom Sequence< PropertyValue > route? OUString url = "sdbc:address:thunderbird:unittest:" + - getPathFromSrc("/connectivity/qa/connectivity/mork/abook_10_john_does.mab"); + m_directories.getPathFromSrc("/connectivity/qa/connectivity/mork/abook_10_john_does.mab"); Sequence< PropertyValue > info; Reference< XDriver> xDriver(m_xMorkComponent, UNO_QUERY); diff --git a/dbaccess/qa/extras/dialog-save.cxx b/dbaccess/qa/extras/dialog-save.cxx index 38344dfcb569..e73c4ff45f8a 100644 --- a/dbaccess/qa/extras/dialog-save.cxx +++ b/dbaccess/qa/extras/dialog-save.cxx @@ -68,7 +68,7 @@ void DialogSaveTest::test() SolarMutexReleaser rel; const OUString sStandard("Standard"); - const OUString aFileName(getURLFromWorkdir("CppunitTest/testDialogSave.odb")); + const OUString aFileName(m_directories.getURLFromWorkdir("CppunitTest/testDialogSave.odb")); { uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileName); CPPUNIT_ASSERT(xComponent.is()); diff --git a/dbaccess/qa/extras/empty-stdlib-save.cxx b/dbaccess/qa/extras/empty-stdlib-save.cxx index d8e355c058ee..42c1783ac3fd 100644 --- a/dbaccess/qa/extras/empty-stdlib-save.cxx +++ b/dbaccess/qa/extras/empty-stdlib-save.cxx @@ -68,7 +68,7 @@ void DialogSaveTest::test() SolarMutexReleaser rel; const OUString sStandard("Standard"); - const OUString aFileName(getURLFromWorkdir("CppunitTest/testEmptyStdlibSave.odb")); + const OUString aFileName(m_directories.getURLFromWorkdir("CppunitTest/testEmptyStdlibSave.odb")); { uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileName); CPPUNIT_ASSERT(xComponent.is()); diff --git a/dbaccess/qa/extras/nolib-save.cxx b/dbaccess/qa/extras/nolib-save.cxx index c41dc2617948..16b63c5cd30a 100644 --- a/dbaccess/qa/extras/nolib-save.cxx +++ b/dbaccess/qa/extras/nolib-save.cxx @@ -68,7 +68,7 @@ void DialogSaveTest::test() SolarMutexReleaser rel; const OUString sStandard("Standard"); - const OUString aFileName(getURLFromWorkdir("CppunitTest/testNolibSave.odb")); + const OUString aFileName(m_directories.getURLFromWorkdir("CppunitTest/testNolibSave.odb")); { uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileName); CPPUNIT_ASSERT(xComponent.is()); diff --git a/dbaccess/qa/extras/rowsetclones.cxx b/dbaccess/qa/extras/rowsetclones.cxx index 36b6db4f2163..2ae55ccdf263 100644 --- a/dbaccess/qa/extras/rowsetclones.cxx +++ b/dbaccess/qa/extras/rowsetclones.cxx @@ -60,7 +60,7 @@ RowSetClones::RowSetClones() void RowSetClones::test() { - const OUString sFilePath(getURLFromWorkdir("CppunitTest/RowSetClones.odb")); + const OUString sFilePath(m_directories.getURLFromWorkdir("CppunitTest/RowSetClones.odb")); uno::Reference< lang::XComponent > xComponent (loadFromDesktop(sFilePath)); CPPUNIT_ASSERT(xComponent.is()); diff --git a/extensions/qa/update/test_update.cxx b/extensions/qa/update/test_update.cxx index a434b580ef38..57417998aeeb 100644 --- a/extensions/qa/update/test_update.cxx +++ b/extensions/qa/update/test_update.cxx @@ -37,7 +37,7 @@ public: // repositories that we will be checking m_aRepositoryList.realloc( 1 ); - m_aRepositoryList[0] = getURLFromSrc( "/extensions/qa/update/simple.xml" ); + m_aRepositoryList[0] = m_directories.getURLFromSrc( "/extensions/qa/update/simple.xml" ); } virtual void tearDown() override diff --git a/filter/qa/cppunit/filters-dxf-test.cxx b/filter/qa/cppunit/filters-dxf-test.cxx index 2b1aa3d3e891..d90d4173baa2 100644 --- a/filter/qa/cppunit/filters-dxf-test.cxx +++ b/filter/qa/cppunit/filters-dxf-test.cxx @@ -60,7 +60,7 @@ bool DxfFilterTest::load(const OUString &, void DxfFilterTest::testCVEs() { testDir(OUString(), - getURLFromSrc("/filter/qa/cppunit/data/dxf/")); + m_directories.getURLFromSrc("/filter/qa/cppunit/data/dxf/")); } CPPUNIT_TEST_SUITE_REGISTRATION(DxfFilterTest); diff --git a/filter/qa/cppunit/filters-eps-test.cxx b/filter/qa/cppunit/filters-eps-test.cxx index 830503853d6a..da204859f8ac 100644 --- a/filter/qa/cppunit/filters-eps-test.cxx +++ b/filter/qa/cppunit/filters-eps-test.cxx @@ -60,7 +60,7 @@ bool EpsFilterTest::load(const OUString &, void EpsFilterTest::testCVEs() { testDir(OUString(), - getURLFromSrc("/filter/qa/cppunit/data/eps/")); + m_directories.getURLFromSrc("/filter/qa/cppunit/data/eps/")); } CPPUNIT_TEST_SUITE_REGISTRATION(EpsFilterTest); diff --git a/filter/qa/cppunit/filters-met-test.cxx b/filter/qa/cppunit/filters-met-test.cxx index 6bde13af92eb..af78d17bbe21 100644 --- a/filter/qa/cppunit/filters-met-test.cxx +++ b/filter/qa/cppunit/filters-met-test.cxx @@ -60,7 +60,7 @@ bool MetFilterTest::load(const OUString &, void MetFilterTest::testCVEs() { testDir(OUString(), - getURLFromSrc("/filter/qa/cppunit/data/met/")); + m_directories.getURLFromSrc("/filter/qa/cppunit/data/met/")); } CPPUNIT_TEST_SUITE_REGISTRATION(MetFilterTest); diff --git a/filter/qa/cppunit/filters-pcd-test.cxx b/filter/qa/cppunit/filters-pcd-test.cxx index 1ed47487fcdb..6f967665474c 100644 --- a/filter/qa/cppunit/filters-pcd-test.cxx +++ b/filter/qa/cppunit/filters-pcd-test.cxx @@ -60,7 +60,7 @@ bool PcdFilterTest::load(const OUString &, void PcdFilterTest::testCVEs() { testDir(OUString(), - getURLFromSrc("/filter/qa/cppunit/data/pcd/")); + m_directories.getURLFromSrc("/filter/qa/cppunit/data/pcd/")); } CPPUNIT_TEST_SUITE_REGISTRATION(PcdFilterTest); diff --git a/filter/qa/cppunit/filters-pcx-test.cxx b/filter/qa/cppunit/filters-pcx-test.cxx index 83d996f15a53..4c5c778fac0e 100644 --- a/filter/qa/cppunit/filters-pcx-test.cxx +++ b/filter/qa/cppunit/filters-pcx-test.cxx @@ -60,7 +60,7 @@ bool PcxFilterTest::load(const OUString &, void PcxFilterTest::testCVEs() { testDir(OUString(), - getURLFromSrc("/filter/qa/cppunit/data/pcx/")); + m_directories.getURLFromSrc("/filter/qa/cppunit/data/pcx/")); } CPPUNIT_TEST_SUITE_REGISTRATION(PcxFilterTest); diff --git a/filter/qa/cppunit/filters-pict-test.cxx b/filter/qa/cppunit/filters-pict-test.cxx index 14ba6b8c379c..9ca3ba5a7e15 100644 --- a/filter/qa/cppunit/filters-pict-test.cxx +++ b/filter/qa/cppunit/filters-pict-test.cxx @@ -46,7 +46,7 @@ public: OUString pictURL() { - return getURLFromSrc("/filter/qa/cppunit/data/pict/"); + return m_directories.getURLFromSrc("/filter/qa/cppunit/data/pict/"); } /** diff --git a/filter/qa/cppunit/filters-ppm-test.cxx b/filter/qa/cppunit/filters-ppm-test.cxx index 71b3fc435edb..0eefd1979203 100644 --- a/filter/qa/cppunit/filters-ppm-test.cxx +++ b/filter/qa/cppunit/filters-ppm-test.cxx @@ -60,10 +60,10 @@ bool PpmFilterTest::load(const OUString &, void PpmFilterTest::testCVEs() { testDir(OUString(), - getURLFromSrc("/filter/qa/cppunit/data/ppm/")); + m_directories.getURLFromSrc("/filter/qa/cppunit/data/ppm/")); testDir(OUString(), - getURLFromSrc("/filter/qa/cppunit/data/pbm/")); + m_directories.getURLFromSrc("/filter/qa/cppunit/data/pbm/")); } CPPUNIT_TEST_SUITE_REGISTRATION(PpmFilterTest); diff --git a/filter/qa/cppunit/filters-psd-test.cxx b/filter/qa/cppunit/filters-psd-test.cxx index 8c49a238ec18..0f1f007e7772 100644 --- a/filter/qa/cppunit/filters-psd-test.cxx +++ b/filter/qa/cppunit/filters-psd-test.cxx @@ -60,7 +60,7 @@ bool PsdFilterTest::load(const OUString &, void PsdFilterTest::testCVEs() { testDir(OUString(), - getURLFromSrc("/filter/qa/cppunit/data/psd/")); + m_directories.getURLFromSrc("/filter/qa/cppunit/data/psd/")); } CPPUNIT_TEST_SUITE_REGISTRATION(PsdFilterTest); diff --git a/filter/qa/cppunit/filters-ras-test.cxx b/filter/qa/cppunit/filters-ras-test.cxx index a61e0f2ec132..4293b8da5db3 100644 --- a/filter/qa/cppunit/filters-ras-test.cxx +++ b/filter/qa/cppunit/filters-ras-test.cxx @@ -60,7 +60,7 @@ bool RasFilterTest::load(const OUString &, void RasFilterTest::testCVEs() { testDir(OUString(), - getURLFromSrc("/filter/qa/cppunit/data/ras/")); + m_directories.getURLFromSrc("/filter/qa/cppunit/data/ras/")); } CPPUNIT_TEST_SUITE_REGISTRATION(RasFilterTest); diff --git a/filter/qa/cppunit/filters-tga-test.cxx b/filter/qa/cppunit/filters-tga-test.cxx index e105863959e9..6df9e5818d64 100644 --- a/filter/qa/cppunit/filters-tga-test.cxx +++ b/filter/qa/cppunit/filters-tga-test.cxx @@ -60,7 +60,7 @@ bool TgaFilterTest::load(const OUString &, void TgaFilterTest::testCVEs() { testDir(OUString(), - getURLFromSrc("/filter/qa/cppunit/data/tga/")); + m_directories.getURLFromSrc("/filter/qa/cppunit/data/tga/")); } CPPUNIT_TEST_SUITE_REGISTRATION(TgaFilterTest); diff --git a/filter/qa/cppunit/filters-tiff-test.cxx b/filter/qa/cppunit/filters-tiff-test.cxx index 6a3e12293dfc..80b8fa3a1b6a 100644 --- a/filter/qa/cppunit/filters-tiff-test.cxx +++ b/filter/qa/cppunit/filters-tiff-test.cxx @@ -60,7 +60,7 @@ bool TiffFilterTest::load(const OUString &, void TiffFilterTest::testCVEs() { testDir(OUString(), - getURLFromSrc("/filter/qa/cppunit/data/tiff/")); + m_directories.getURLFromSrc("/filter/qa/cppunit/data/tiff/")); } CPPUNIT_TEST_SUITE_REGISTRATION(TiffFilterTest); diff --git a/filter/qa/cppunit/xslt-test.cxx b/filter/qa/cppunit/xslt-test.cxx index 49757197dc31..01fe09d58ba7 100644 --- a/filter/qa/cppunit/xslt-test.cxx +++ b/filter/qa/cppunit/xslt-test.cxx @@ -80,14 +80,14 @@ void XsltFilterTest::testXsltCopyNew() osl_closeFile(tempFile); // close it so xSFA can open it on WNT OUString source( - getURLFromSrc("/filter/source/xsltfilter/xsltfilter.component")); + m_directories.getURLFromSrc("/filter/source/xsltfilter/xsltfilter.component")); uno::Sequence<uno::Any> args(7); args[0] <<= beans::NamedValue("StylesheetURL", - uno::makeAny(getURLFromSrc("/filter/qa/cppunit/data/xslt/copy.xslt"))); + uno::makeAny(m_directories.getURLFromSrc("/filter/qa/cppunit/data/xslt/copy.xslt"))); args[1] <<= beans::NamedValue("SourceURL", uno::makeAny(source)); args[2] <<= beans::NamedValue("TargetURL", uno::makeAny(tempURL)); args[3] <<= beans::NamedValue("SourceBaseURL", - uno::makeAny(getURLFromSrc("/filter/source/xsltfilter/"))); + uno::makeAny(m_directories.getURLFromSrc("/filter/source/xsltfilter/"))); args[4] <<= beans::NamedValue("TargetBaseURL", uno::makeAny(tempDirURL)); args[5] <<= beans::NamedValue("SystemType", uno::makeAny(OUString())); args[6] <<= beans::NamedValue("PublicType", uno::makeAny(OUString())); @@ -137,14 +137,14 @@ void XsltFilterTest::testXsltCopyOld() osl_closeFile(tempFile); // close it so xSFA can open it on WNT OUString source( - getURLFromSrc("/filter/source/xsltfilter/xsltfilter.component")); + m_directories.getURLFromSrc("/filter/source/xsltfilter/xsltfilter.component")); uno::Sequence<uno::Any> args(7); args[0] <<= beans::NamedValue("StylesheetURL", - uno::makeAny(getURLFromSrc("/filter/qa/cppunit/data/xslt/copy.xslt"))); + uno::makeAny(m_directories.getURLFromSrc("/filter/qa/cppunit/data/xslt/copy.xslt"))); args[1] <<= beans::NamedValue("SourceURL", uno::makeAny(source)); args[2] <<= beans::NamedValue("TargetURL", uno::makeAny(tempURL)); args[3] <<= beans::NamedValue("SourceBaseURL", - uno::makeAny(getURLFromSrc("/filter/source/xsltfilter/"))); + uno::makeAny(m_directories.getURLFromSrc("/filter/source/xsltfilter/"))); args[4] <<= beans::NamedValue("TargetBaseURL", uno::makeAny(tempDirURL)); args[5] <<= beans::NamedValue("SystemType", uno::makeAny(OUString())); args[6] <<= beans::NamedValue("PublicType", uno::makeAny(OUString())); diff --git a/hwpfilter/qa/cppunit/test_hwpfilter.cxx b/hwpfilter/qa/cppunit/test_hwpfilter.cxx index 900d255dc2ee..f497d12ec3e6 100644 --- a/hwpfilter/qa/cppunit/test_hwpfilter.cxx +++ b/hwpfilter/qa/cppunit/test_hwpfilter.cxx @@ -60,7 +60,7 @@ namespace void HwpFilterTest::test() { testDir(OUString(), - getURLFromSrc("/hwpfilter/qa/cppunit/data/")); + m_directories.getURLFromSrc("/hwpfilter/qa/cppunit/data/")); } CPPUNIT_TEST_SUITE_REGISTRATION(HwpFilterTest); diff --git a/include/unotest/bootstrapfixturebase.hxx b/include/unotest/bootstrapfixturebase.hxx index 812cc588f132..8b2f80978847 100644 --- a/include/unotest/bootstrapfixturebase.hxx +++ b/include/unotest/bootstrapfixturebase.hxx @@ -11,7 +11,6 @@ #include <sal/config.h> -#include <rtl/string.hxx> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> @@ -21,6 +20,7 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/plugin/TestPlugIn.h> #include <unotest/detail/unotestdllapi.hxx> +#include <unotest/directories.hxx> namespace test { @@ -33,13 +33,8 @@ namespace test { // run of unit tests ... class OOO_DLLPUBLIC_UNOTEST BootstrapFixtureBase : public CppUnit::TestFixture { -private: - OUString m_aSrcRootURL; - OUString m_aSrcRootPath; - OUString m_aWorkdirRootURL; - OUString m_aWorkdirRootPath; - protected: + Directories m_directories; css::uno::Reference<css::uno::XComponentContext> m_xContext; css::uno::Reference<css::lang::XMultiServiceFactory> m_xSFactory; css::uno::Reference<css::lang::XMultiComponentFactory> m_xFactory; @@ -53,24 +48,6 @@ public: css::uno::Reference<css::lang::XMultiServiceFactory> getMultiServiceFactory() { return m_xSFactory; } - OUString getSrcRootURL() { return m_aSrcRootURL; } - OUString getSrcRootPath() { return m_aSrcRootPath; } - - // return a URL to a given c-str path from the source directory - OUString getURLFromSrc( const char *pPath ); - OUString getURLFromSrc( const OUString& rPath ); - - // return a Path to a given c-str path from the source directory - OUString getPathFromSrc( const char *pPath ); - - - // return a URL to a given c-str path from the workdir directory - OUString getURLFromWorkdir( const char *pPath ); - -#ifdef _WIN32 - // return a Path to a given c-str path from the workdir directory - OUString getPathFromWorkdir( const char *pPath ); -#endif virtual void setUp() override; virtual void tearDown() override; diff --git a/include/unotest/directories.hxx b/include/unotest/directories.hxx new file mode 100644 index 000000000000..a658d187a46d --- /dev/null +++ b/include/unotest/directories.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_UNOTEST_DIRECTORIES_HXX +#define INCLUDED_UNOTEST_DIRECTORIES_HXX + +#include <sal/config.h> + +#include <rtl/ustring.hxx> +#include <unotest/detail/unotestdllapi.hxx> + +namespace test { + +class OOO_DLLPUBLIC_UNOTEST Directories { +private: + OUString m_aSrcRootURL; + OUString m_aSrcRootPath; + OUString m_aWorkdirRootURL; + OUString m_aWorkdirRootPath; + +public: + Directories(); + + OUString getSrcRootURL() { return m_aSrcRootURL; } + OUString getSrcRootPath() { return m_aSrcRootPath; } + + // return a URL to a given c-str path from the source directory + OUString getURLFromSrc( const char *pPath ); + OUString getURLFromSrc( const OUString& rPath ); + + // return a Path to a given c-str path from the source directory + OUString getPathFromSrc( const char *pPath ); + + // return a URL to a given c-str path from the workdir directory + OUString getURLFromWorkdir( const char *pPath ); + +#ifdef _WIN32 + // return a Path to a given c-str path from the workdir directory + OUString getPathFromWorkdir( const char *pPath ); +#endif +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx b/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx index 7b4767ff43ac..961faa668a36 100644 --- a/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx +++ b/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx @@ -62,7 +62,7 @@ namespace void LotusWordProTest::test() { testDir(OUString(), - getURLFromSrc("/lotuswordpro/qa/cppunit/data/")); + m_directories.getURLFromSrc("/lotuswordpro/qa/cppunit/data/")); } CPPUNIT_TEST_SUITE_REGISTRATION(LotusWordProTest); diff --git a/oox/qa/unit/vba_compression.cxx b/oox/qa/unit/vba_compression.cxx index e5d8ccea386d..5302c165fc31 100644 --- a/oox/qa/unit/vba_compression.cxx +++ b/oox/qa/unit/vba_compression.cxx @@ -84,8 +84,8 @@ void ReadFiles(const OUString& rTestFile, const OUString& rReference, void TestVbaCompression::testSimple1() { - OUString aTestFile = getPathFromSrc("/oox/qa/unit/data/vba/simple1.bin"); - OUString aReference = getPathFromSrc("/oox/qa/unit/data/vba/reference/simple1.bin"); + OUString aTestFile = m_directories.getPathFromSrc("/oox/qa/unit/data/vba/simple1.bin"); + OUString aReference = m_directories.getPathFromSrc("/oox/qa/unit/data/vba/reference/simple1.bin"); SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); @@ -107,8 +107,8 @@ void TestVbaCompression::testSimple1() void TestVbaCompression::testSimple2() { - OUString aTestFile = getPathFromSrc("/oox/qa/unit/data/vba/simple2.bin"); - OUString aReference = getPathFromSrc("/oox/qa/unit/data/vba/reference/simple2.bin"); + OUString aTestFile = m_directories.getPathFromSrc("/oox/qa/unit/data/vba/simple2.bin"); + OUString aReference = m_directories.getPathFromSrc("/oox/qa/unit/data/vba/reference/simple2.bin"); SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); @@ -129,8 +129,8 @@ void TestVbaCompression::testSimple2() void TestVbaCompression::testSimple3() { - OUString aTestFile = getPathFromSrc("/oox/qa/unit/data/vba/simple3.bin"); - OUString aReference = getPathFromSrc("/oox/qa/unit/data/vba/reference/simple3.bin"); + OUString aTestFile = m_directories.getPathFromSrc("/oox/qa/unit/data/vba/simple3.bin"); + OUString aReference = m_directories.getPathFromSrc("/oox/qa/unit/data/vba/reference/simple3.bin"); SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); @@ -151,8 +151,8 @@ void TestVbaCompression::testSimple3() void TestVbaCompression::testComplex1() { - OUString aTestFile = getPathFromSrc("/oox/qa/unit/data/vba/complex1.bin"); - OUString aReference = getPathFromSrc("/oox/qa/unit/data/vba/reference/complex1.bin"); + OUString aTestFile = m_directories.getPathFromSrc("/oox/qa/unit/data/vba/complex1.bin"); + OUString aReference = m_directories.getPathFromSrc("/oox/qa/unit/data/vba/reference/complex1.bin"); SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); @@ -173,8 +173,8 @@ void TestVbaCompression::testComplex1() void TestVbaCompression::testSpec321() { - OUString aTestFile = getPathFromSrc("/oox/qa/unit/data/vba/spec321.bin"); - OUString aReference = getPathFromSrc("/oox/qa/unit/data/vba/reference/spec321.bin"); + OUString aTestFile = m_directories.getPathFromSrc("/oox/qa/unit/data/vba/spec321.bin"); + OUString aReference = m_directories.getPathFromSrc("/oox/qa/unit/data/vba/reference/spec321.bin"); SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); @@ -195,8 +195,8 @@ void TestVbaCompression::testSpec321() void TestVbaCompression::testSpec322() { - OUString aTestFile = getPathFromSrc("/oox/qa/unit/data/vba/spec322.bin"); - OUString aReference = getPathFromSrc("/oox/qa/unit/data/vba/reference/spec322.bin"); + OUString aTestFile = m_directories.getPathFromSrc("/oox/qa/unit/data/vba/spec322.bin"); + OUString aReference = m_directories.getPathFromSrc("/oox/qa/unit/data/vba/reference/spec322.bin"); SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); @@ -217,8 +217,8 @@ void TestVbaCompression::testSpec322() void TestVbaCompression::testSpec323() { - OUString aTestFile = getPathFromSrc("/oox/qa/unit/data/vba/spec323.bin"); - OUString aReference = getPathFromSrc("/oox/qa/unit/data/vba/reference/spec323.bin"); + OUString aTestFile = m_directories.getPathFromSrc("/oox/qa/unit/data/vba/spec323.bin"); + OUString aReference = m_directories.getPathFromSrc("/oox/qa/unit/data/vba/reference/spec323.bin"); SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); diff --git a/package/qa/cppunit/test_package.cxx b/package/qa/cppunit/test_package.cxx index c4ae317993e3..07b3abb757d0 100644 --- a/package/qa/cppunit/test_package.cxx +++ b/package/qa/cppunit/test_package.cxx @@ -53,7 +53,7 @@ namespace void PackageTest::test() { testDir(OUString(), - getURLFromSrc("/package/qa/cppunit/data/")); + m_directories.getURLFromSrc("/package/qa/cppunit/data/")); } CPPUNIT_TEST_SUITE_REGISTRATION(PackageTest); diff --git a/sc/qa/extras/htmlexporttest.cxx b/sc/qa/extras/htmlexporttest.cxx index 58936c878e4d..ed5dae9f2d88 100644 --- a/sc/qa/extras/htmlexporttest.cxx +++ b/sc/qa/extras/htmlexporttest.cxx @@ -40,7 +40,7 @@ class ScHTMLExportTest : public test::BootstrapFixture, public unotest::MacrosTe { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(getURLFromSrc(pDir) + OUString::createFromAscii(pName), "com.sun.star.comp.Calc.SpreadsheetDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(pDir) + OUString::createFromAscii(pName), "com.sun.star.comp.Calc.SpreadsheetDocument"); } void save(const OUString& aFilterName, TempFile& rTempFile) diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index cec53a7920ad..0a0eac8851ec 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -129,22 +129,22 @@ void ScFiltersTest::testCVEs() { #ifndef DISABLE_CVE_TESTS testDir("Quattro Pro 6.0", - getURLFromSrc("/sc/qa/unit/data/qpro/")); + m_directories.getURLFromSrc("/sc/qa/unit/data/qpro/")); //warning, the current "sylk filter" in sc (docsh.cxx) automatically //chains on failure on trying as csv, rtf, etc. so "success" may //not indicate that it imported as .slk. testDir("SYLK", - getURLFromSrc("/sc/qa/unit/data/slk/")); + m_directories.getURLFromSrc("/sc/qa/unit/data/slk/")); testDir("MS Excel 97", - getURLFromSrc("/sc/qa/unit/data/xls/")); + m_directories.getURLFromSrc("/sc/qa/unit/data/xls/")); testDir("dBase", - getURLFromSrc("/sc/qa/unit/data/dbf/")); + m_directories.getURLFromSrc("/sc/qa/unit/data/dbf/")); testDir("Lotus", - getURLFromSrc("/sc/qa/unit/data/wks/")); + m_directories.getURLFromSrc("/sc/qa/unit/data/wks/")); #endif } diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index d734a2e8d061..c4df244c7974 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -606,7 +606,7 @@ OUString EnsureSeparator(const OUStringBuffer& rFilePath) void ScBootstrapFixture::createFileURL( const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath) { - OUStringBuffer aBuffer( getSrcRootURL() ); + OUStringBuffer aBuffer( m_directories.getSrcRootURL() ); aBuffer.append(EnsureSeparator(aBuffer)).append(m_aBaseString); aBuffer.append(EnsureSeparator(aBuffer)).append(aFileExtension); aBuffer.append(EnsureSeparator(aBuffer)).append(aFileBase).append(aFileExtension); @@ -615,7 +615,7 @@ void ScBootstrapFixture::createFileURL( void ScBootstrapFixture::createCSVPath(const OUString& aFileBase, OUString& rCSVPath) { - OUStringBuffer aBuffer( getSrcRootPath()); + OUStringBuffer aBuffer( m_directories.getSrcRootPath()); aBuffer.append(EnsureSeparator(aBuffer)).append(m_aBaseString); aBuffer.append(EnsureSeparator(aBuffer)).append("contentCSV/").append(aFileBase).append("csv"); rCSVPath = aBuffer.makeStringAndClear(); diff --git a/sd/qa/unit/HtmlExportTest.cxx b/sd/qa/unit/HtmlExportTest.cxx index 50602707300c..976f3dbf2e2a 100644 --- a/sd/qa/unit/HtmlExportTest.cxx +++ b/sd/qa/unit/HtmlExportTest.cxx @@ -31,7 +31,7 @@ public: void testHTMLExport() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/HtmlExportTestDocument.odp"), ODP); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/HtmlExportTestDocument.odp"), ODP); htmlDocPtr htmlDoc = exportAndParseHtml(xDocShRef); assertXPath(htmlDoc, "/html", 1); diff --git a/sd/qa/unit/SVGExportTests.cxx b/sd/qa/unit/SVGExportTests.cxx index 7dec2c6de5bb..d241822caecc 100644 --- a/sd/qa/unit/SVGExportTests.cxx +++ b/sd/qa/unit/SVGExportTests.cxx @@ -39,7 +39,7 @@ protected: void load(const char* pDir, const char* pName) { - return loadURL(getURLFromSrc(pDir) + OUString::createFromAscii(pName), pName); + return loadURL(m_directories.getURLFromSrc(pDir) + OUString::createFromAscii(pName), pName); } void loadURL(OUString const& rURL, const char* pName) diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 82466084916c..222c7f02fff1 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -264,7 +264,7 @@ public: void SdExportTest::testN821567() { OUString bgImage; - ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n821567.pptx"), PPTX ); + ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n821567.pptx"), PPTX ); xDocShRef = saveAndReload( xDocShRef, ODP ); uno::Reference< drawing::XDrawPagesSupplier > xDoc( @@ -309,7 +309,7 @@ void checkFontAttributes( const SdrTextObj* pObj, ItemValue nVal) void SdExportTest::testBnc870233_1() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_1.pptx"), PPTX); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_1.pptx"), PPTX); xDocShRef = saveAndReload( xDocShRef, PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -335,7 +335,7 @@ void SdExportTest::testBnc870233_1() void SdExportTest::testBnc870233_2() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_2.pptx"), PPTX); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_2.pptx"), PPTX); xDocShRef = saveAndReload( xDocShRef, PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -366,7 +366,7 @@ void SdExportTest::testBnc870233_2() void SdExportTest::testN828390_4() { bool bPassed = false; - ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/n828390_4.odp"), ODP ); + ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/n828390_4.odp"), ODP ); xDocShRef = saveAndReload( xDocShRef, PPTX ); @@ -401,7 +401,7 @@ void SdExportTest::testN828390_4() void SdExportTest::testN828390_5() { - ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/n828390_5.odp"), ODP ); + ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/n828390_5.odp"), ODP ); xDocShRef = saveAndReload( xDocShRef, PPTX ); @@ -421,7 +421,7 @@ void SdExportTest::testN828390_5() void SdExportTest::testTransparentBackground() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/transparent_background.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/transparent_background.odp"), ODP); xDocShRef = saveAndReload( xDocShRef, ODP ); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -435,7 +435,7 @@ void SdExportTest::testTransparentBackground() void SdExportTest::testMediaEmbedding() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/media_embedding.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/media_embedding.odp"), ODP); #if HAVE_FEATURE_GLTF xDocShRef = saveAndReload( xDocShRef, ODP ); @@ -467,7 +467,7 @@ void SdExportTest::testMediaEmbedding() void SdExportTest::testFdo84043() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo84043.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/fdo84043.odp"), ODP); xDocShRef = saveAndReload( xDocShRef, ODP ); // the bug was duplicate attributes, causing crash in a build with asserts @@ -478,7 +478,7 @@ void SdExportTest::testFdo84043() void SdExportTest::testFdo71961() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo71961.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/fdo71961.odp"), ODP); xDocShRef = saveAndReload( xDocShRef, PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -506,7 +506,7 @@ void SdExportTest::testFdo71961() void SdExportTest::testN828390() { bool bPassed = false; - ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390.pptx"), PPTX ); + ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n828390.pptx"), PPTX ); xDocShRef = saveAndReload( xDocShRef, PPTX ); @@ -539,7 +539,7 @@ void SdExportTest::testN828390() void SdExportTest::testBnc880763() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc880763.pptx"), PPTX); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc880763.pptx"), PPTX); xDocShRef = saveAndReload( xDocShRef, PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -560,7 +560,7 @@ void SdExportTest::testBnc880763() void SdExportTest::testBnc862510_5() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_5.pptx"), PPTX); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_5.pptx"), PPTX); xDocShRef = saveAndReload( xDocShRef, PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -581,7 +581,7 @@ void SdExportTest::testBnc862510_5() // not written into the file. void SdExportTest::testBnc822347_EmptyBullet() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/bnc822347_EmptyBullet.odp"), ODP); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/bnc822347_EmptyBullet.odp"), ODP); xDocShRef = saveAndReload(xDocShRef, PPTX); SdDrawDocument* pDoc = xDocShRef->GetDoc(); @@ -610,7 +610,7 @@ void SdExportTest::testBnc822347_EmptyBullet() //Bullets not having any text following them are not getting exported to pptx correctly. void SdExportTest::testFdo90607() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo90607.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/fdo90607.pptx"), PPTX); xDocShRef = saveAndReload(xDocShRef, PPTX); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -624,7 +624,7 @@ void SdExportTest::testFdo90607() void SdExportTest::testFdo83751() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/fdo83751.pptx"), PPTX); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/fdo83751.pptx"), PPTX); xDocShRef = saveAndReload( xDocShRef, PPTX ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); @@ -641,7 +641,7 @@ void SdExportTest::testFdo83751() void SdExportTest::testFdo79731() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo79731.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/fdo79731.odp"), ODP); xDocShRef = saveAndReload(xDocShRef, PPTX); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT(pDoc); @@ -665,7 +665,7 @@ void SdExportTest::testSwappedOutImageExport() for( size_t nExportFormat = 0; nExportFormat < SAL_N_ELEMENTS(vFormats); ++nExportFormat ) { // Load the original file with one image - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/document_with_two_images.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/document_with_two_images.odp"), ODP); const OString sFailedMessage = OString("Failed on filter: ") + OString(aFileFormats[vFormats[nExportFormat]].pFilterName); // Export the document and import again for a check @@ -729,7 +729,7 @@ void SdExportTest::testSwappedOutImageExport() void SdExportTest::testTdf80020() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/tdf80020.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf80020.odp"), ODP); { uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xDocShRef->GetModel(), uno::UNO_QUERY); uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); @@ -757,7 +757,7 @@ void SdExportTest::testLinkedGraphicRT() for( size_t nExportFormat = 0; nExportFormat < SAL_N_ELEMENTS(vFormats); ++nExportFormat ) { // Load the original file with one image - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/document_with_linked_graphic.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/document_with_linked_graphic.odp"), ODP); const OString sFailedMessage = OString("Failed on filter: ") + OString(aFileFormats[vFormats[nExportFormat]].pFilterName); // Export the document and import again for a check @@ -809,7 +809,7 @@ void SdExportTest::testImageWithSpecialID() for( size_t nExportFormat = 0; nExportFormat < SAL_N_ELEMENTS(vFormats); ++nExportFormat ) { // Load the original file - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/images_with_special_IDs.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/images_with_special_IDs.odp"), ODP); const OString sFailedMessage = OString("Failed on filter: ") + OString(aFileFormats[vFormats[nExportFormat]].pFilterName); // Export the document and import again for a check @@ -877,7 +877,7 @@ void SdExportTest::testTableCellFillProperties() batch->commit(); // Load the original file - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/Table_with_Cell_Fill.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/Table_with_Cell_Fill.odp"), ODP); // Export the document and import again for a check uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY); @@ -921,7 +921,7 @@ void SdExportTest::testTableCellFillProperties() void SdExportTest::testBulletStartNumber() { - ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n90255.pptx"), PPTX ); + ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n90255.pptx"), PPTX ); xDocShRef = saveAndReload( xDocShRef, PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -936,7 +936,7 @@ void SdExportTest::testBulletStartNumber() void SdExportTest::testLineStyle() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/lineStyle.pptx"), PPTX); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/lineStyle.pptx"), PPTX); xDocShRef = saveAndReload( xDocShRef, PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -952,7 +952,7 @@ void SdExportTest::testLineStyle() void SdExportTest::testRightToLeftParaghraph() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/rightToLeftParagraph.pptx"), PPTX); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/rightToLeftParagraph.pptx"), PPTX); xDocShRef = saveAndReload( xDocShRef, PPTX ); uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); @@ -970,7 +970,7 @@ void SdExportTest::testRightToLeftParaghraph() void SdExportTest::testTextboxWithHyperlink() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/hyperlinktest.pptx"), PPTX); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/hyperlinktest.pptx"), PPTX); xDocShRef = saveAndReload( xDocShRef, PPTX ); uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); @@ -996,7 +996,7 @@ void SdExportTest::testTextboxWithHyperlink() void SdExportTest::testBulletColor() { - ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bulletColor.pptx"), PPTX ); + ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bulletColor.pptx"), PPTX ); xDocShRef = saveAndReload( xDocShRef, PPTX ); @@ -1013,7 +1013,7 @@ void SdExportTest::testBulletColor() void SdExportTest::testTdf62176() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/Tdf62176.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/Tdf62176.odp"), ODP); uno::Reference<drawing::XDrawPage> xPage( getPage( 0, xDocShRef ) ); //there should be only *one* shape @@ -1056,7 +1056,7 @@ void SdExportTest::testTdf62176() void SdExportTest::testBulletCharAndFont() { - ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/odp/bulletCharAndFont.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/bulletCharAndFont.odp"), ODP); xDocShRef = saveAndReload( xDocShRef, PPTX ); uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); @@ -1086,7 +1086,7 @@ void SdExportTest::testTdf91378() { //Check For Import and Export Both - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/tdf91378.pptx"), PPTX); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf91378.pptx"), PPTX); for( sal_uInt32 i=0;i<2;i++) { SdDrawDocument *pDoc = xDocShRef->GetDoc(); @@ -1105,7 +1105,7 @@ void SdExportTest::testTdf91378() void SdExportTest::testBnc822341() { // Check import / export of embedded text document - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/odp/bnc822341.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/bnc822341.odp"), ODP); utl::TempFile tempFile1; xDocShRef = saveAndReload( xDocShRef, PPTX, &tempFile1 ); @@ -1175,7 +1175,7 @@ void SdExportTest::testBnc822341() void SdExportTest::testMathObject() { // Check import / export of math object - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/odp/math.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/math.odp"), ODP); utl::TempFile tempFile1; xDocShRef = saveAndReload(xDocShRef, PPTX, &tempFile1); @@ -1222,7 +1222,7 @@ void SdExportTest::testMathObject() void SdExportTest::testMathObjectPPT2010() { // Check import / export of math object - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/Math.pptx"), PPTX); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/Math.pptx"), PPTX); utl::TempFile tempFile1; xDocShRef = saveAndReload(xDocShRef, PPTX, &tempFile1); @@ -1248,7 +1248,7 @@ void SdExportTest::testMathObjectPPT2010() void SdExportTest::testBulletMarginAndIndentation() { - ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bulletMarginAndIndent.pptx"), PPTX ); + ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bulletMarginAndIndent.pptx"), PPTX ); xDocShRef = saveAndReload( xDocShRef, PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -1266,7 +1266,7 @@ void SdExportTest::testBulletMarginAndIndentation() void SdExportTest::testParaMarginAndindentation() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/paraMarginAndIndentation.pptx"), PPTX); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/paraMarginAndIndentation.pptx"), PPTX); xDocShRef = saveAndReload( xDocShRef, PPTX ); uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); @@ -1288,7 +1288,7 @@ void SdExportTest::testParaMarginAndindentation() void SdExportTest::testCellLeftAndRightMargin() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/n90223.pptx"), PPTX); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/n90223.pptx"), PPTX); xDocShRef = saveAndReload( xDocShRef, PPTX ); sal_Int32 nLeftMargin, nRightMargin; @@ -1319,7 +1319,7 @@ void SdExportTest::testCellLeftAndRightMargin() void SdExportTest::testTableCellBorder() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/n90190.pptx"), PPTX); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/n90190.pptx"), PPTX); xDocShRef = saveAndReload( xDocShRef, PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -1369,7 +1369,7 @@ void SdExportTest::testTableCellBorder() void SdExportTest::testTdf80224() { - ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/odp/tdf80224.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf80224.odp"), ODP); xDocShRef = saveAndReload( xDocShRef, PPTX ); uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); @@ -1425,7 +1425,7 @@ bool checkTransitionOnPage(uno::Reference<drawing::XDrawPagesSupplier> xDoc, sal void SdExportTest::testExportTransitionsPPTX() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/AllTransitions.odp"), ODP); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/AllTransitions.odp"), ODP); xDocShRef = saveAndReload(xDocShRef, PPTX); uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW); @@ -1471,7 +1471,7 @@ void SdExportTest::testTdf92527() // We draw a diamond in an empty document. A newly created diamond shape does not have // CustomShapeGeometry - Path - Segments property, and previously DrawingML exporter // did not export custom shapes which did not have CustomShapeGeometry - Path - Segments property. - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/empty.fodp"), FODG ); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/empty.fodp"), FODG ); uno::Reference<css::lang::XMultiServiceFactory> xFactory(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape1(xFactory->createInstance("com.sun.star.drawing.CustomShape"), uno::UNO_QUERY); uno::Reference<drawing::XDrawPagesSupplier> xDoc1(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW); @@ -1550,7 +1550,7 @@ void matchNumberFormat( int nPage, uno::Reference< text::XTextField > xField) void SdExportTest::testDatetimeFieldNumberFormat() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/numfmt.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/numfmt.odp"), ODP); xDocShRef = saveAndReload( xDocShRef, PPTX ); @@ -1564,7 +1564,7 @@ void SdExportTest::testDatetimeFieldNumberFormat() void SdExportTest::testDatetimeFieldNumberFormatPPTX() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/numfmt.pptx"), PPTX); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/numfmt.pptx"), PPTX); xDocShRef = saveAndReload( xDocShRef, PPTX ); @@ -1578,7 +1578,7 @@ void SdExportTest::testDatetimeFieldNumberFormatPPTX() void SdExportTest::testSlideNumberField() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/slidenum_field.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/slidenum_field.odp"), ODP); xDocShRef = saveAndReload( xDocShRef, PPTX ); @@ -1590,7 +1590,7 @@ void SdExportTest::testSlideNumberField() void SdExportTest::testSlideNumberFieldPPTX() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/slidenum_field.pptx"), PPTX); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/slidenum_field.pptx"), PPTX); xDocShRef = saveAndReload( xDocShRef, PPTX ); @@ -1602,7 +1602,7 @@ void SdExportTest::testSlideNumberFieldPPTX() void SdExportTest::testSlideCountField() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/slidecount_field.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/slidecount_field.odp"), ODP); xDocShRef = saveAndReload( xDocShRef, PPTX ); @@ -1614,7 +1614,7 @@ void SdExportTest::testSlideCountField() void SdExportTest::testSlideNameField() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/slidename_field.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/slidename_field.odp"), ODP); xDocShRef = saveAndReload( xDocShRef, PPTX ); @@ -1626,7 +1626,7 @@ void SdExportTest::testSlideNameField() void SdExportTest::testExtFileField() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/extfile_field.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/extfile_field.odp"), ODP); xDocShRef = saveAndReload( xDocShRef, PPTX ); @@ -1659,7 +1659,7 @@ void SdExportTest::testExtFileField() void SdExportTest::testAuthorField() { - ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/author_field.odp"), ODP); + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/author_field.odp"), ODP); xDocShRef = saveAndReload( xDocShRef, PPTX ); diff --git a/sd/qa/unit/filters-test.cxx b/sd/qa/unit/filters-test.cxx index a553e028e531..836fa645fca6 100644 --- a/sd/qa/unit/filters-test.cxx +++ b/sd/qa/unit/filters-test.cxx @@ -81,23 +81,23 @@ void SdFiltersTest::testCVEs() { #ifndef DISABLE_CVE_TESTS testDir("MS PowerPoint 97", - getURLFromSrc("/sd/qa/unit/data/ppt/"), + m_directories.getURLFromSrc("/sd/qa/unit/data/ppt/"), "sdfilt"); testDir("Impress Office Open XML", - getURLFromSrc("/sd/qa/unit/data/pptx/"), + m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/"), "", (SfxFilterFlags::IMPORT | SfxFilterFlags::ALIEN | SfxFilterFlags::STARONEFILTER)); testDir("impress8", - getURLFromSrc("/sd/qa/unit/data/odp/"), + m_directories.getURLFromSrc("/sd/qa/unit/data/odp/"), "sdfilt"); testDir("draw8", - getURLFromSrc("/sd/qa/unit/data/odg/"), + m_directories.getURLFromSrc("/sd/qa/unit/data/odg/"), "sdfilt"); testDir("CGM - Computer Graphics Metafile", - getURLFromSrc("/sd/qa/unit/data/cgm/"), + m_directories.getURLFromSrc("/sd/qa/unit/data/cgm/"), "icg"); #endif } diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index c7e4f00d3df1..1e153b04b54e 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -210,18 +210,18 @@ void SdImportTest::testDocumentLayout() { int nUpdateMe = -1; // index of test we want to update; supposedly only when the test is created - sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pInput ), aFilesToCompare[i].nFormat ); + sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pInput ), aFilesToCompare[i].nFormat ); if( aFilesToCompare[i].nExportType >= 0 ) xDocShRef = saveAndReload( xDocShRef, aFilesToCompare[i].nExportType ); compareWithShapesDump( xDocShRef, - getPathFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pDump ), + m_directories.getPathFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pDump ), i == nUpdateMe ); } } void SdImportTest::testSmoketest() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/smoketest.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/smoketest.pptx"), PPTX); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr ); @@ -249,7 +249,7 @@ void SdImportTest::testSmoketest() void SdImportTest::testN759180() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/n759180.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/n759180.pptx"), PPTX); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -284,7 +284,7 @@ void SdImportTest::testN759180() void SdImportTest::testN862510_1() { - sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_1.pptx"), PPTX ); + sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n862510_1.pptx"), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); { @@ -306,7 +306,7 @@ void SdImportTest::testN862510_1() void SdImportTest::testN862510_2() { - sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_2.pptx"), PPTX ); + sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n862510_2.pptx"), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); { @@ -322,7 +322,7 @@ void SdImportTest::testN862510_2() void SdImportTest::testN862510_4() { - sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_4.pptx"), PPTX ); + sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n862510_4.pptx"), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); { @@ -344,7 +344,7 @@ void SdImportTest::testN862510_4() void SdImportTest::testN828390_2() { - sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390_2.pptx"), PPTX ); + sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n828390_2.pptx"), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); SdrObject *pObj = pPage->GetObj(0); @@ -360,7 +360,7 @@ void SdImportTest::testN828390_2() void SdImportTest::testN828390_3() { bool bPassed = true; - sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390_3.pptx"), PPTX ); + sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n828390_3.pptx"), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); SdrObject *pObj = pPage->GetObj(0); @@ -388,7 +388,7 @@ void SdImportTest::testN828390_3() void SdImportTest::testMasterPageStyleParent() { - sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/odp/masterpage_style_parent.odp"), ODP ); + sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/masterpage_style_parent.odp"), ODP ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr ); @@ -424,7 +424,7 @@ void SdImportTest::testMasterPageStyleParent() void SdImportTest::testGradientAngle() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odg/gradient-angle.fodg"), FODG); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odg/gradient-angle.fodg"), FODG); uno::Reference<lang::XMultiServiceFactory> const xDoc( xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY); @@ -480,7 +480,7 @@ void SdImportTest::testGradientAngle() void SdImportTest::testN778859() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/n778859.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n778859.pptx"), PPTX); const SdrPage *pPage = GetPage( 1, xDocShRef ); { @@ -496,7 +496,7 @@ void SdImportTest::testN778859() void SdImportTest::testFdo68594() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/ppt/fdo68594.ppt"), PPT); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/ppt/fdo68594.ppt"), PPT); const SdrPage *pPage = &(GetPage( 1, xDocShRef )->TRG_GetMasterPage()); SdrObject *pObj = pPage->GetObj(1); @@ -512,7 +512,7 @@ void SdImportTest::testFdo68594() void SdImportTest::testFdo72998() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/cshapes.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/cshapes.pptx"), PPTX); const SdrPage *pPage = GetPage( 1, xDocShRef ); { @@ -539,7 +539,7 @@ std::ostream& operator<<(std::ostream& rStrm, const Color& rColor) void SdImportTest::testFdo77027() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/fdo77027.odp"), ODP); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/fdo77027.odp"), ODP); const SdrPage *pPage = GetPage( 1, xDocShRef ); { @@ -571,7 +571,7 @@ std::ostream& operator<<(std::ostream& rStrm, const uno::Reference<T>& xRef) void SdImportTest::testTdf97808() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/tdf97808.fodp"), FODP); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/tdf97808.fodp"), FODP); uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier( xDocShRef->GetModel(), uno::UNO_QUERY); @@ -599,7 +599,7 @@ void SdImportTest::testTdf97808() void SdImportTest::testFdo64512() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo64512.odp"), ODP); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/fdo64512.odp"), ODP); uno::Reference< drawing::XDrawPagesSupplier > xDoc( xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW ); @@ -644,7 +644,7 @@ void SdImportTest::testFdo71075() { double values[] = { 12.0, 13.0, 14.0 }; css::uno::Any aAny; - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo71075.odp"), ODP); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/fdo71075.odp"), ODP); uno::Reference< beans::XPropertySet > xPropSet( getShapeFromPage( 0, 0, xDocShRef ) ); aAny = xPropSet->getPropertyValue( "Model" ); @@ -679,7 +679,7 @@ void SdImportTest::testFdo71075() void SdImportTest::testStrictOOXML() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/strict_ooxml.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/strict_ooxml.pptx"), PPTX); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr ); @@ -690,7 +690,7 @@ void SdImportTest::testStrictOOXML() void SdImportTest::testBnc870237() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870237.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc870237.pptx"), PPTX); const SdrPage *pPage = GetPage( 1, xDocShRef ); // Simulate a:ext inside dsp:txXfrm with changing the lower distance @@ -706,7 +706,7 @@ void SdImportTest::testBnc870237() void SdImportTest::testCreationDate() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo71434.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/fdo71434.pptx"), PPTX); uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(xDocShRef->GetModel(), uno::UNO_QUERY); uno::Reference<document::XDocumentProperties> xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties(); util::DateTime aDate = xDocumentProperties->getCreationDate(); @@ -719,7 +719,7 @@ void SdImportTest::testCreationDate() void SdImportTest::testBnc887225() { - sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bnc887225.pptx"), PPTX ); + sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc887225.pptx"), PPTX ); // In the document, lastRow and lastCol table properties are used. // Make sure styles are set properly for individual cells. @@ -764,7 +764,7 @@ void SdImportTest::testBnc887225() void SdImportTest::testBnc480256() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc480256.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc480256.pptx"), PPTX); // In the document, there are two tables with table background properties. // Make sure colors are set properly for individual cells. @@ -820,7 +820,7 @@ void SdImportTest::testBnc584721_1() { // Title text shape on the master page contained wrong text. - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc584721_1_2.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc584721_1_2.pptx"), PPTX); const SdrPage *pPage = &(GetPage( 1, xDocShRef )->TRG_GetMasterPage()); SdrObject *pObj = pPage->GetObj(0); @@ -835,7 +835,7 @@ void SdImportTest::testBnc584721_2() { // Import created an extra/unneeded outliner shape on the master slide next to the imported title shape. - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc584721_1_2.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc584721_1_2.pptx"), PPTX); const SdrPage *pPage = &(GetPage( 1, xDocShRef )->TRG_GetMasterPage()); CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount()); @@ -845,7 +845,7 @@ void SdImportTest::testBnc584721_2() void SdImportTest::testBnc591147() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc591147.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc591147.pptx"), PPTX); // In the document, there are two slides with media files. uno::Reference< drawing::XDrawPagesSupplier > xDoc( @@ -883,7 +883,7 @@ void SdImportTest::testBnc584721_4() { // Black text was imported as white because of wrong caching mechanism - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc584721_4.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc584721_4.pptx"), PPTX); uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 1, 1, xDocShRef ) ); // Get first paragraph of the text @@ -905,7 +905,7 @@ void SdImportTest::testBnc904423() { // Here the problem was that different fill properties were applied in wrong order on the shape // Right order: 1) master slide fill style, 2) theme, 3) direct formatting - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/bnc904423.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/bnc904423.pptx"), PPTX); const SdrPage *pPage = GetPage( 1, xDocShRef ); // First shape's background color is defined on master slide @@ -954,7 +954,7 @@ void SdImportTest::testShapeLineStyle() { // Here the problem was that different line properties were applied in wrong order on the shape // Right order: 1) master slide line style, 2) theme, 3) direct formatting - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/ShapeLineProperties.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/ShapeLineProperties.pptx"), PPTX); const SdrPage *pPage = GetPage( 1, xDocShRef ); // First shape's line style is defined on master slide @@ -1017,7 +1017,7 @@ void SdImportTest::testShapeLineStyle() void SdImportTest::testBnc862510_6() { // Black text was imported instead of gray - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_6.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_6.pptx"), PPTX); uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); // Get first paragraph of the text @@ -1038,7 +1038,7 @@ void SdImportTest::testBnc862510_6() void SdImportTest::testBnc862510_7() { // Title shape's text was aligned to left instead of center. - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_7.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_7.pptx"), PPTX); uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); // Get first paragraph @@ -1056,7 +1056,7 @@ void SdImportTest::testBnc862510_7() void SdImportTest::testPDFImport() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pdf/txtpic.pdf"), PDF); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pdf/txtpic.pdf"), PDF); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr ); uno::Reference< drawing::XDrawPagesSupplier > xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW ); @@ -1075,7 +1075,7 @@ void SdImportTest::testPDFImportSkipImages() SfxAllItemSet *pParams = new SfxAllItemSet( SfxGetpApp()->GetPool() ); pParams->Put( SfxStringItem ( SID_FILE_FILTEROPTIONS, OUString("SkipImages") ) ); - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pdf/txtpic.pdf"), PDF, pParams); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pdf/txtpic.pdf"), PDF, pParams); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr ); uno::Reference< drawing::XDrawPagesSupplier > xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW ); @@ -1094,7 +1094,7 @@ void SdImportTest::testPDFImportSkipImages() void SdImportTest::testBulletSuffix() { - sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n83889.pptx"), PPTX ); + sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n83889.pptx"), PPTX ); // check suffix of the char bullet const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -1110,7 +1110,7 @@ void SdImportTest::testBulletSuffix() void SdImportTest::testBnc910045() { // Problem with table style which defines cell color with fill style - sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bnc910045.pptx"), PPTX ); + sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc910045.pptx"), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0)); @@ -1126,7 +1126,7 @@ void SdImportTest::testBnc910045() void SdImportTest::testRowHeight() { - sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n80340.pptx"), PPTX ); + sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n80340.pptx"), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0)); @@ -1143,7 +1143,7 @@ void SdImportTest::testRowHeight() void SdImportTest::testTdf93830() { // Text shape offset was ignored - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/tdf93830.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf93830.pptx"), PPTX); uno::Reference< drawing::XDrawPage > xPage( getPage( 0, xDocShRef ) ); // Get the first text box from group shape @@ -1161,7 +1161,7 @@ void SdImportTest::testTdf93830() void SdImportTest::testTdf93097() { // Throwing metadata import aborted the filter, check that metadata is now imported. - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/tdf93097.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf93097.pptx"), PPTX); uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(xDocShRef->GetModel(), uno::UNO_QUERY); uno::Reference<document::XDocumentProperties> xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties(); CPPUNIT_ASSERT_EQUAL(OUString("ss"), xDocumentProperties->getTitle()); @@ -1170,7 +1170,7 @@ void SdImportTest::testTdf93097() void SdImportTest::testTdf62255() { - sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/tdf62255.pptx"), PPTX); + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf62255.pptx"), PPTX); const SdrPage *pPage = GetPage( 1, xDocShRef ); sdr::table::SdrTableObj *pTableObj; diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx index e1d8b2abed40..0d34f507dcaf 100644 --- a/sd/qa/unit/misc-tests.cxx +++ b/sd/qa/unit/misc-tests.cxx @@ -97,7 +97,7 @@ void SdMiscTest::testTdf96206() { // Copying/pasting slide referring to a non-default master with a text duplicated the master - sd::DrawDocShellRef xDocSh = Load(getURLFromSrc("/sd/qa/unit/data/odp/tdf96206.odp"), ODP); + sd::DrawDocShellRef xDocSh = Load(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf96206.odp"), ODP); sd::ViewShell *pViewShell = xDocSh->GetViewShell(); auto pSSVS = sd::slidesorter::SlideSorterViewShell::GetSlideSorter(pViewShell->GetViewShellBase()); auto& xSSController = pSSVS->GetSlideSorter().GetController(); @@ -114,7 +114,7 @@ void SdMiscTest::testTdf96206() void SdMiscTest::testTdf96708() { - sd::DrawDocShellRef xDocSh = Load(getURLFromSrc("/sd/qa/unit/data/odp/tdf96708.odp"), ODP); + sd::DrawDocShellRef xDocSh = Load(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf96708.odp"), ODP); sd::ViewShell *pViewShell = xDocSh->GetViewShell(); auto pSSVS = sd::slidesorter::SlideSorterViewShell::GetSlideSorter(pViewShell->GetViewShellBase()); auto& xSSController = pSSVS->GetSlideSorter().GetController(); diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx index 57245d5d5a93..5fdddf0ff324 100644 --- a/sd/qa/unit/sdmodeltestbase.hxx +++ b/sd/qa/unit/sdmodeltestbase.hxx @@ -251,7 +251,7 @@ protected: OUStringToOString(aString, RTL_TEXTENCODING_UTF8).getStr(), static_cast<int>(aString.getLength()), OUStringToOString( - getPathFromSrc("/sd/qa/unit/data/tolerance.xml"), + m_directories.getPathFromSrc("/sd/qa/unit/data/tolerance.xml"), RTL_TEXTENCODING_UTF8).getStr()); } } diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index cea486e2ceb4..0bc9ad8b1d1a 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -132,7 +132,7 @@ SdXImpressDocument* SdTiledRenderingTest::createDoc(const char* pName) { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(getURLFromSrc(DATA_DIRECTORY) + OUString::createFromAscii(pName), "com.sun.star.presentation.PresentationDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(DATA_DIRECTORY) + OUString::createFromAscii(pName), "com.sun.star.presentation.PresentationDocument"); SdXImpressDocument* pImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pImpressDocument); pImpressDocument->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>()); diff --git a/sdext/source/pdfimport/test/tests.cxx b/sdext/source/pdfimport/test/tests.cxx index e2b043c9defc..e48962341855 100644 --- a/sdext/source/pdfimport/test/tests.cxx +++ b/sdext/source/pdfimport/test/tests.cxx @@ -458,7 +458,7 @@ namespace std::shared_ptr<TestSink> pSink( new TestSink() ); CPPUNIT_ASSERT( pdfi::xpdf_ImportFromFile( - getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"), + m_directories.getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"), pSink, uno::Reference< task::XInteractionHandler >(), OUString(), @@ -475,7 +475,7 @@ namespace CPPUNIT_ASSERT( osl::File::createTempFile( nullptr, nullptr, &tempFileURL ) == osl::File::E_None ); osl::File::remove( tempFileURL ); // FIXME the below apparently fails silently if the file already exists CPPUNIT_ASSERT_MESSAGE("Exporting to ODF", - xAdaptor->odfConvert( getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"), + xAdaptor->odfConvert( m_directories.getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"), new OutputWrap(tempFileURL), nullptr )); osl::File::remove( tempFileURL ); @@ -490,7 +490,7 @@ namespace CPPUNIT_ASSERT( osl::File::createTempFile( nullptr, nullptr, &tempFileURL ) == osl::File::E_None ); osl::File::remove( tempFileURL ); // FIXME the below apparently fails silently if the file already exists CPPUNIT_ASSERT_MESSAGE("Exporting to ODF", - xAdaptor->odfConvert( getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"), + xAdaptor->odfConvert( m_directories.getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"), new OutputWrap(tempFileURL), nullptr )); osl::File::remove( tempFileURL ); @@ -503,7 +503,7 @@ namespace OString aOutput; CPPUNIT_ASSERT_MESSAGE("Exporting to ODF", - xAdaptor->odfConvert(getURLFromSrc("/sdext/source/pdfimport/test/testTdf96993.pdf"), + xAdaptor->odfConvert(m_directories.getURLFromSrc("/sdext/source/pdfimport/test/testTdf96993.pdf"), new OutputWrapString(aOutput), nullptr)); // This ensures that the imported image arrives properly flipped @@ -517,7 +517,7 @@ namespace OString aOutput; CPPUNIT_ASSERT_MESSAGE("Exporting to ODF", - xAdaptor->odfConvert(getURLFromSrc("/sdext/source/pdfimport/test/testTdf96993.pdf"), + xAdaptor->odfConvert(m_directories.getURLFromSrc("/sdext/source/pdfimport/test/testTdf96993.pdf"), new OutputWrapString(aOutput), nullptr)); // This ensures that the imported image arrives properly flipped diff --git a/sot/qa/cppunit/test_sot.cxx b/sot/qa/cppunit/test_sot.cxx index 50841ad2f9f2..8157bdf570e3 100644 --- a/sot/qa/cppunit/test_sot.cxx +++ b/sot/qa/cppunit/test_sot.cxx @@ -118,12 +118,12 @@ namespace void SotTest::test() { testDir(OUString(), - getURLFromSrc("/sot/qa/cppunit/data/")); + m_directories.getURLFromSrc("/sot/qa/cppunit/data/")); } void SotTest::testSize() { - OUString aURL(getURLFromSrc("/sot/qa/cppunit/data/pass/fdo84229-1.compound")); + OUString aURL(m_directories.getURLFromSrc("/sot/qa/cppunit/data/pass/fdo84229-1.compound")); SvFileStream aStream(aURL, StreamMode::READ); tools::SvRef<SotStorage> xObjStor = new SotStorage(aStream); CPPUNIT_ASSERT_MESSAGE("sot storage failed to open", diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx index 1ab9d62b0464..5c808f323b26 100644 --- a/starmath/qa/extras/mmlimport-test.cxx +++ b/starmath/qa/extras/mmlimport-test.cxx @@ -84,21 +84,21 @@ void Test::tearDown() void Test::testSimple() { - loadURL(getURLFromSrc("starmath/qa/extras/data/simple.mml")); + loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/simple.mml")); OUString sExpected("left ( {a + b} right )^2"); CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText()); } void Test::testNsPrefixMath() { - loadURL(getURLFromSrc("starmath/qa/extras/data/ns-prefix-math.mml")); + loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/ns-prefix-math.mml")); OUString sExpected("left ( {a + b} right )^2"); CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText()); } void Test::testMaction() { - loadURL(getURLFromSrc("starmath/qa/extras/data/maction.mml")); + loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/maction.mml")); OUString sExpected("matrix {1 ## 2 ## 3}"); CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText()); } diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 3b0c7729ea38..feea8179f4d9 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -83,8 +83,8 @@ Primitive2DSequence Test::parseSvg(const char* aSource) { const Reference<XSvgParser> xSvgParser = SvgTools::create(m_xContext); - OUString aUrl = getURLFromSrc(aSource); - OUString aPath = getPathFromSrc(aSource); + OUString aUrl = m_directories.getURLFromSrc(aSource); + OUString aPath = m_directories.getPathFromSrc(aSource); SvFileStream aFileStream(aUrl, StreamMode::READ); sal_Size nSize = aFileStream.remainingSize(); diff --git a/svtools/qa/unit/GraphicObjectTest.cxx b/svtools/qa/unit/GraphicObjectTest.cxx index cbefed1f1f66..d1ee3c2abe43 100644 --- a/svtools/qa/unit/GraphicObjectTest.cxx +++ b/svtools/qa/unit/GraphicObjectTest.cxx @@ -80,7 +80,7 @@ void GraphicObjectTest::testSwap() { // simple non-linked case { - GraphicObject aGraphObj(lcl_loadGraphic(getURLFromSrc(aGraphicFile))); + GraphicObject aGraphObj(lcl_loadGraphic(m_directories.getURLFromSrc(aGraphicFile))); CPPUNIT_ASSERT(!aGraphObj.HasSwapStreamHdl()); CPPUNIT_ASSERT(!aGraphObj.IsSwappedOut()); CPPUNIT_ASSERT_EQUAL(nGraphicSizeBytes, aGraphObj.GetGraphic().GetSizeBytes()); @@ -96,7 +96,7 @@ void GraphicObjectTest::testSwap() // linked case { - GraphicObject aGraphObj(lcl_loadGraphic(getURLFromSrc(aGraphicFile))); + GraphicObject aGraphObj(lcl_loadGraphic(m_directories.getURLFromSrc(aGraphicFile))); aGraphObj.SetSwapStreamHdl(LINK(this, GraphicObjectTest, getLinkStream)); CPPUNIT_ASSERT(aGraphObj.HasSwapStreamHdl()); @@ -114,7 +114,7 @@ void GraphicObjectTest::testSwap() // combination of two GraphicObjects { - GraphicObject aGraphObj(lcl_loadGraphic(getURLFromSrc(aGraphicFile))); + GraphicObject aGraphObj(lcl_loadGraphic(m_directories.getURLFromSrc(aGraphicFile))); GraphicObject aGraphObj2(aGraphObj); aGraphObj2.SetSwapStreamHdl(LINK(this, GraphicObjectTest, getLinkStream)); @@ -155,7 +155,7 @@ void GraphicObjectTest::testSizeBasedAutoSwap() } uno::Reference< lang::XComponent > xComponent = - loadFromDesktop(getURLFromSrc("svtools/qa/unit/data/document_with_two_images.odt"), "com.sun.star.text.TextDocument"); + loadFromDesktop(m_directories.getURLFromSrc("svtools/qa/unit/data/document_with_two_images.odt"), "com.sun.star.text.TextDocument"); SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(xComponent.get()); CPPUNIT_ASSERT(pTxtDoc); @@ -246,7 +246,7 @@ void GraphicObjectTest::testTdf88935() // Load a file with two images uno::Reference< lang::XComponent > xComponent = - loadFromDesktop(getURLFromSrc("svtools/qa/unit/data/document_with_two_images.odt"), "com.sun.star.text.TextDocument"); + loadFromDesktop(m_directories.getURLFromSrc("svtools/qa/unit/data/document_with_two_images.odt"), "com.sun.star.text.TextDocument"); SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(xComponent.get()); CPPUNIT_ASSERT(pTxtDoc); SwDoc* pDoc = pTxtDoc->GetDocShell()->GetDoc(); diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx index 4e484ea8322f..be2e774e712c 100644 --- a/sw/qa/core/filters-test.cxx +++ b/sw/qa/core/filters-test.cxx @@ -134,54 +134,54 @@ bool SwFiltersTest::filter(const OUString &rFilter, const OUString &rURL, void SwFiltersTest::testCVEs() { testDir("StarOffice XML (Writer)", - getURLFromSrc("/sw/qa/core/data/xml/"), + m_directories.getURLFromSrc("/sw/qa/core/data/xml/"), FILTER_XML, SfxFilterFlags::IMPORT | SfxFilterFlags::OWN | SfxFilterFlags::DEFAULT, isstorage, SOFFICE_FILEFORMAT_CURRENT); testDir("writer8", - getURLFromSrc("/sw/qa/core/data/odt/"), + m_directories.getURLFromSrc("/sw/qa/core/data/odt/"), FILTER_XML, SfxFilterFlags::IMPORT | SfxFilterFlags::OWN | SfxFilterFlags::DEFAULT, isstorage, SOFFICE_FILEFORMAT_CURRENT); testDir("MS Word 97", - getURLFromSrc("/sw/qa/core/data/ww8/"), + m_directories.getURLFromSrc("/sw/qa/core/data/ww8/"), FILTER_WW8); testDir("MS WinWord 6.0", - getURLFromSrc("/sw/qa/core/data/ww6/"), + m_directories.getURLFromSrc("/sw/qa/core/data/ww6/"), sWW6); testDir("MS WinWord 5", - getURLFromSrc("/sw/qa/core/data/ww5/"), + m_directories.getURLFromSrc("/sw/qa/core/data/ww5/"), sWW5); testDir("Text (encoded)", - getURLFromSrc("/sw/qa/core/data/txt/"), + m_directories.getURLFromSrc("/sw/qa/core/data/txt/"), FILTER_TEXT_DLG); testDir("MS Word 2007 XML", - getURLFromSrc("/sw/qa/core/data/ooxml/"), + m_directories.getURLFromSrc("/sw/qa/core/data/ooxml/"), OUString(), SfxFilterFlags::STARONEFILTER); testDir("Rich Text Format", - getURLFromSrc("/sw/qa/core/data/rtf/"), + m_directories.getURLFromSrc("/sw/qa/core/data/rtf/"), OUString(), SfxFilterFlags::STARONEFILTER); testDir("HTML", - getURLFromSrc("/sw/qa/core/data/html/"), + m_directories.getURLFromSrc("/sw/qa/core/data/html/"), sHTML); testDir("T602Document", - getURLFromSrc("/sw/qa/core/data/602/"), + m_directories.getURLFromSrc("/sw/qa/core/data/602/"), OUString(), SfxFilterFlags::STARONEFILTER); testDir("Rich Text Format", - getURLFromSrc("/sw/qa/core/exportdata/rtf/"), + m_directories.getURLFromSrc("/sw/qa/core/exportdata/rtf/"), OUString(), SfxFilterFlags::STARONEFILTER, SotClipboardFormatId::NONE, @@ -189,7 +189,7 @@ void SwFiltersTest::testCVEs() /*bExport=*/true); testDir("HTML", - getURLFromSrc("/sw/qa/core/exportdata/html/"), + m_directories.getURLFromSrc("/sw/qa/core/exportdata/html/"), sHTML, SfxFilterFlags::NONE, SotClipboardFormatId::NONE, @@ -197,7 +197,7 @@ void SwFiltersTest::testCVEs() /*bExport=*/true); testDir("MS Word 2007 XML", - getURLFromSrc("/sw/qa/core/exportdata/ooxml/"), + m_directories.getURLFromSrc("/sw/qa/core/exportdata/ooxml/"), OUString(), SfxFilterFlags::STARONEFILTER, SotClipboardFormatId::NONE, diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index 3a5453aa6e06..8b465c5a24cd 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -116,7 +116,7 @@ private: void SwMacrosTest::createFileURL(const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath) { OUString aSep("/"); - OUStringBuffer aBuffer( getSrcRootURL() ); + OUStringBuffer aBuffer( m_directories.getSrcRootURL() ); aBuffer.append(m_aBaseString).append(aSep).append(aFileExtension); aBuffer.append(aSep).append(aFileBase).append(aFileExtension); rFilePath = aBuffer.makeStringAndClear(); diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index 54f2c1518ae8..2ac43bf6a26e 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -73,7 +73,7 @@ void Test::testSwappedOutImageExport() if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/document_with_two_images.odt"), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/document_with_two_images.odt"), "com.sun.star.text.TextDocument"); // Export the document and import again for a check uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -149,7 +149,7 @@ void Test::testLinkedGraphicRT() { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/document_with_linked_graphic.odt"), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/document_with_linked_graphic.odt"), "com.sun.star.text.TextDocument"); const OString sFailedMessage = OString("Failed on filter: ") + OUStringToOString(aFilterNames[nFilter], RTL_TEXTENCODING_ASCII_US); @@ -219,7 +219,7 @@ void Test::testImageWithSpecialID() { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/images_with_special_IDs.odt"), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/images_with_special_IDs.odt"), "com.sun.star.text.TextDocument"); // Export the document and import again for a check uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -300,7 +300,7 @@ void Test::testGraphicShape() { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/graphic_shape.odt"), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/graphic_shape.odt"), "com.sun.star.text.TextDocument"); // Export the document and import again for a check uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -382,7 +382,7 @@ void Test::testCharHighlightBody() { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/char_highlight.docx"), + mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/char_highlight.docx"), "com.sun.star.text.TextDocument"); const OString sFailedMessage = OString("Failed on filter: ") + aFilterNames[nFilter]; @@ -477,7 +477,7 @@ void Test::testCharHighlight() void Test::testCharHighlightODF() { - mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/char_background_editing.docx"), + mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/char_background_editing.docx"), "com.sun.star.text.TextDocument"); // don't check import, testMSCharBackgroundEditing already does that @@ -570,7 +570,7 @@ void Test::testMSCharBackgroundEditing() if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/char_background_editing.docx"), + mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/char_background_editing.docx"), "com.sun.star.text.TextDocument"); const OString sFailedMessage = OString("Failed on filter: ") + aFilterNames[nFilter]; @@ -683,7 +683,7 @@ void Test::testCharBackgroundToHighlighting() { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/char_background.odt"), + mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/char_background.odt"), "com.sun.star.text.TextDocument"); OString sFailedMessage = OString("Failed on filter: ") + aFilterNames[nFilter]; @@ -768,10 +768,10 @@ void Test::testSkipImages() args[0].Handle = -1; args[0].Value <<= OUString::createFromAscii(aFilterNames[nFilter][1]); args[0].State = beans::PropertyState_DIRECT_VALUE; - mxComponent = loadFromDesktop(getURLFromSrc(aFilterNames[nFilter][0]), "com.sun.star.text.TextDocument", args); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(aFilterNames[nFilter][0]), "com.sun.star.text.TextDocument", args); sFailedMessage = sFailedMessage + " - " + aFilterNames[nFilter][1]; } else - mxComponent = loadFromDesktop(getURLFromSrc(aFilterNames[nFilter][0]), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(m_directories.getURLFromSrc(aFilterNames[nFilter][0]), "com.sun.star.text.TextDocument"); // Check shapes (images, textboxes, custom shapes) uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index 424f03e078c7..c92a125570a1 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -609,7 +609,7 @@ protected: void load(const char* pDir, const char* pName) { - return loadURL(getURLFromSrc(pDir) + OUString::createFromAscii(pName), pName); + return loadURL(m_directories.getURLFromSrc(pDir) + OUString::createFromAscii(pName), pName); } void loadURL(OUString const& rURL, const char* pName) diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx b/sw/qa/extras/mailmerge/mailmerge.cxx index c74115950e7b..c54998afe182 100644 --- a/sw/qa/extras/mailmerge/mailmerge.cxx +++ b/sw/qa/extras/mailmerge/mailmerge.cxx @@ -74,7 +74,7 @@ public: utl::TempFile aTempDir(nullptr, true); const OUString aWorkDir = aTempDir.GetURL(); - const OUString aURI( getURLFromSrc(mpTestDocumentPath) + OUString::createFromAscii(datasource) ); + const OUString aURI( m_directories.getURLFromSrc(mpTestDocumentPath) + OUString::createFromAscii(datasource) ); OUString aDBName = registerDBsource( aURI, aWorkDir ); initMailMergeJobAndArgs( filename, tablename, aDBName, "LOMM_", aWorkDir, file ); @@ -118,7 +118,7 @@ public: seq_id = 0; mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_OUTPUT_TYPE ), uno::Any( file ? text::MailMergeType::FILE : text::MailMergeType::SHELL ) ); mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_DOCUMENT_URL ), uno::Any( - ( OUString(getURLFromSrc(mpTestDocumentPath) + OUString::createFromAscii(filename)) ) ) ); + ( OUString(m_directories.getURLFromSrc(mpTestDocumentPath) + OUString::createFromAscii(filename)) ) ) ); mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_DATA_SOURCE_NAME ), uno::Any( aDBName ) ); mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_OUTPUT_URL ), uno::Any( aWorkDir ) ); mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_FILE_NAME_PREFIX ), uno::Any( aPrefix )); diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index f7be78bdef8a..0ac923ba6ea3 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -112,7 +112,7 @@ protected: uno::Reference<document::XFilter> xFilter(m_xSFactory->createInstance("com.sun.star.comp.Writer.WriterFilter"), uno::UNO_QUERY_THROW); uno::Reference<document::XImporter> xImporter(xFilter, uno::UNO_QUERY_THROW); xImporter->setTargetDocument(mxComponent); - SvStream* pStream = utl::UcbStreamHelper::CreateStream(getURLFromSrc("/sw/qa/extras/ooxmlimport/data/") + rFilename, StreamMode::READ); + SvStream* pStream = utl::UcbStreamHelper::CreateStream(m_directories.getURLFromSrc("/sw/qa/extras/ooxmlimport/data/") + rFilename, StreamMode::READ); uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(*pStream)); uno::Sequence<beans::PropertyValue> aDescriptor(comphelper::InitPropertySequence( { @@ -138,7 +138,7 @@ public: std::cout << filename << ","; mnStartTime = osl_getGlobalTimer(); { - OUString aURL(getURLFromSrc(mpTestDocumentPath) + OUString::createFromAscii(filename)); + OUString aURL(m_directories.getURLFromSrc(mpTestDocumentPath) + OUString::createFromAscii(filename)); CPPUNIT_ASSERT_MESSAGE("no desktop", mxDesktop.is()); uno::Reference<frame::XComponentLoader> xLoader(mxDesktop, uno::UNO_QUERY); CPPUNIT_ASSERT_MESSAGE("no loader", xLoader.is()); diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index d98b9b9ccd62..f8193cdef6b0 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -105,7 +105,7 @@ protected: xImporter->setTargetDocument(mxComponent); uno::Sequence<beans::PropertyValue> aDescriptor(xTextRange.is() ? 3 : 2); aDescriptor[0].Name = "InputStream"; - SvStream* pStream = utl::UcbStreamHelper::CreateStream(getURLFromSrc("/sw/qa/extras/rtfimport/data/") + aFilename, StreamMode::WRITE); + SvStream* pStream = utl::UcbStreamHelper::CreateStream(m_directories.getURLFromSrc("/sw/qa/extras/rtfimport/data/") + aFilename, StreamMode::WRITE); uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(*pStream)); aDescriptor[0].Value <<= xStream; aDescriptor[1].Name = "InsertMode"; diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index fced549e4585..69a78276ce23 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -989,7 +989,7 @@ void SwUiWriterTest::testMergeDoc() SwDoc* const pDoc1(createDoc("merge-change1.odt")); auto xDoc2Component(loadFromDesktop( - getURLFromSrc(DATA_DIRECTORY) + "merge-change2.odt", + m_directories.getURLFromSrc(DATA_DIRECTORY) + "merge-change2.odt", "com.sun.star.text.TextDocument")); auto pxDoc2Document( dynamic_cast<SwXTextDocument *>(xDoc2Component.get())); @@ -1707,7 +1707,7 @@ void SwUiWriterTest::testTdf69282WithMirror() void SwUiWriterTest::testTdf78742() { //testing with service type and any .ods file - OUString path = getURLFromSrc(DATA_DIRECTORY) + "calc-data-source.ods"; + OUString path = m_directories.getURLFromSrc(DATA_DIRECTORY) + "calc-data-source.ods"; SfxMedium aMedium(path, StreamMode::READ | StreamMode::SHARE_DENYWRITE); SfxFilterMatcher aMatcher(OUString("com.sun.star.text.TextDocument")); const SfxFilter* pFilter = nullptr; @@ -1724,7 +1724,7 @@ void SwUiWriterTest::testTdf78742() //Filter should be returned with proper Name CPPUNIT_ASSERT_EQUAL(OUString("calc8"), pFilter2->GetFilterName()); //testing with service type and any .odt file - OUString path2 = getURLFromSrc(DATA_DIRECTORY) + "fdo69893.odt"; + OUString path2 = m_directories.getURLFromSrc(DATA_DIRECTORY) + "fdo69893.odt"; SfxMedium aMedium3(path2, StreamMode::READ | StreamMode::SHARE_DENYWRITE); SfxFilterMatcher aMatcher3(OUString("com.sun.star.text.TextDocument")); const SfxFilter* pFilter3 = nullptr; diff --git a/test/source/unoapi_test.cxx b/test/source/unoapi_test.cxx index d609d3c6c992..ece8785b6ea5 100644 --- a/test/source/unoapi_test.cxx +++ b/test/source/unoapi_test.cxx @@ -36,7 +36,7 @@ void UnoApiTest::tearDown() void UnoApiTest::createFileURL(const OUString& aFileBase, OUString& rFilePath) { - rFilePath = getSrcRootURL() + m_aBaseString + "/" + aFileBase; + rFilePath = m_directories.getSrcRootURL() + m_aBaseString + "/" + aFileBase; } void UnoApiTest::closeDocument( uno::Reference< lang::XComponent > xDocument ) diff --git a/unotest/Library_unotest.mk b/unotest/Library_unotest.mk index 3f9d99b6f0a3..315447cd6dd0 100644 --- a/unotest/Library_unotest.mk +++ b/unotest/Library_unotest.mk @@ -32,6 +32,7 @@ $(eval $(call gb_Library_use_externals,unotest,\ $(eval $(call gb_Library_add_exception_objects,unotest,\ unotest/source/cpp/bootstrapfixturebase \ + unotest/source/cpp/directories \ unotest/source/cpp/filters-test \ unotest/source/cpp/getargument \ unotest/source/cpp/gettestargument \ diff --git a/unotest/source/cpp/bootstrapfixturebase.cxx b/unotest/source/cpp/bootstrapfixturebase.cxx index 74a28026fc3c..e14736bd066f 100644 --- a/unotest/source/cpp/bootstrapfixturebase.cxx +++ b/unotest/source/cpp/bootstrapfixturebase.cxx @@ -10,91 +10,28 @@ #include "sal/config.h" #include <unotest/bootstrapfixturebase.hxx> -#include <osl/file.hxx> -#include <rtl/strbuf.hxx> #include <rtl/bootstrap.hxx> -#include <cppuhelper/bootstrap.hxx> #include <comphelper/processfactory.hxx> #include <basic/sbstar.hxx> -#include <com/sun/star/lang/Locale.hpp> -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - using namespace ::com::sun::star; -namespace { - -OUString getFileURLFromSystemPath(OUString const & path) { - OUString url; - osl::FileBase::RC e = osl::FileBase::getFileURLFromSystemPath(path, url); - CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, e); - if (!url.endsWith("/")) { - url += "/"; - } - return url; -} - -} - // NB. this constructor is called before any tests are run, once for each // test function in a rather non-intuitive way. This is why all the 'real' // heavy lifting is deferred until setUp. setUp and tearDown are interleaved // between the tests as you might expect. test::BootstrapFixtureBase::BootstrapFixtureBase() { -#ifndef ANDROID - const char* pSrcRoot = getenv( "SRC_ROOT" ); - CPPUNIT_ASSERT_MESSAGE("SRC_ROOT env variable not set", pSrcRoot != nullptr && pSrcRoot[0] != 0); - const char* pWorkdirRoot = getenv( "WORKDIR_FOR_BUILD" ); - CPPUNIT_ASSERT_MESSAGE("$WORKDIR_FOR_BUILD env variable not set", pWorkdirRoot != nullptr && pWorkdirRoot[0] != 0); -#else - const char* pSrcRoot = "/assets"; - const char* pWorkdirRoot = "/assets"; -#endif - m_aSrcRootPath = OUString::createFromAscii( pSrcRoot ); - m_aSrcRootURL = getFileURLFromSystemPath(m_aSrcRootPath); - - m_aWorkdirRootPath = OUString::createFromAscii( pWorkdirRoot ); - m_aWorkdirRootURL = getFileURLFromSystemPath(m_aWorkdirRootPath); - } test::BootstrapFixtureBase::~BootstrapFixtureBase() { } -OUString test::BootstrapFixtureBase::getURLFromSrc( const char *pPath ) -{ - return m_aSrcRootURL + OUString::createFromAscii( pPath ); -} - -OUString test::BootstrapFixtureBase::getURLFromSrc( const OUString& rPath ) -{ - return m_aSrcRootURL + rPath; -} - -OUString test::BootstrapFixtureBase::getPathFromSrc( const char *pPath ) -{ - return m_aSrcRootPath + OUString::createFromAscii( pPath ); -} - -OUString test::BootstrapFixtureBase::getURLFromWorkdir( const char *pPath ) -{ - return m_aWorkdirRootURL + OUString::createFromAscii( pPath ); -} - -#ifdef _WIN32 // ifdef just to keep it out of unusedcode.easy -OUString test::BootstrapFixtureBase::getPathFromWorkdir( const char *pPath ) -{ - return m_aWorkdirRootPath + OUString::createFromAscii( pPath ); -} -#endif - void test::BootstrapFixtureBase::setUp() { // set UserInstallation to user profile dir in test/user-template - OUString sUserInstallURL = m_aWorkdirRootURL + "/unittest"; + OUString sUserInstallURL = m_directories.getURLFromWorkdir("/unittest"); rtl::Bootstrap::set("UserInstallation", sUserInstallURL); m_xContext = comphelper::getProcessComponentContext(); diff --git a/unotest/source/cpp/directories.cxx b/unotest/source/cpp/directories.cxx new file mode 100644 index 000000000000..177ed2c6f337 --- /dev/null +++ b/unotest/source/cpp/directories.cxx @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sal/config.h> + +#include <cppunit/TestAssert.h> +#include <osl/file.hxx> +#include <unotest/directories.hxx> + +namespace { + +OUString getFileURLFromSystemPath(OUString const & path) { + OUString url; + osl::FileBase::RC e = osl::FileBase::getFileURLFromSystemPath(path, url); + CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, e); + if (!url.endsWith("/")) { + url += "/"; + } + return url; +} + +} + +test::Directories::Directories() { +#ifndef ANDROID + const char* pSrcRoot = getenv( "SRC_ROOT" ); + CPPUNIT_ASSERT_MESSAGE("SRC_ROOT env variable not set", pSrcRoot != nullptr && pSrcRoot[0] != 0); + const char* pWorkdirRoot = getenv( "WORKDIR_FOR_BUILD" ); + CPPUNIT_ASSERT_MESSAGE("$WORKDIR_FOR_BUILD env variable not set", pWorkdirRoot != nullptr && pWorkdirRoot[0] != 0); +#else + const char* pSrcRoot = "/assets"; + const char* pWorkdirRoot = "/assets"; +#endif + m_aSrcRootPath = OUString::createFromAscii( pSrcRoot ); + m_aSrcRootURL = getFileURLFromSystemPath(m_aSrcRootPath); + + m_aWorkdirRootPath = OUString::createFromAscii( pWorkdirRoot ); + m_aWorkdirRootURL = getFileURLFromSystemPath(m_aWorkdirRootPath); +} + +OUString test::Directories::getURLFromSrc( const char *pPath ) +{ + return m_aSrcRootURL + OUString::createFromAscii( pPath ); +} + +OUString test::Directories::getURLFromSrc( const OUString& rPath ) +{ + return m_aSrcRootURL + rPath; +} + +OUString test::Directories::getPathFromSrc( const char *pPath ) +{ + return m_aSrcRootPath + OUString::createFromAscii( pPath ); +} + +OUString test::Directories::getURLFromWorkdir( const char *pPath ) +{ + return m_aWorkdirRootURL + OUString::createFromAscii( pPath ); +} + +#ifdef _WIN32 // ifdef just to keep it out of unusedcode.easy +OUString test::Directories::getPathFromWorkdir( const char *pPath ) +{ + return m_aWorkdirRootPath + OUString::createFromAscii( pPath ); +} +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qa/cppunit/blocklistparsertest.cxx b/vcl/qa/cppunit/blocklistparsertest.cxx index 3de95f0b3d82..93817fd21d5f 100644 --- a/vcl/qa/cppunit/blocklistparsertest.cxx +++ b/vcl/qa/cppunit/blocklistparsertest.cxx @@ -36,7 +36,7 @@ void BlocklistParserTest::testParse() { std::vector<wgl::DriverInfo> aDriveInfos; - WinBlocklistParser aBlocklistParser(getURLFromSrc("vcl/qa/cppunit/") + "test_blocklist_parse.xml", aDriveInfos); + WinBlocklistParser aBlocklistParser(m_directories.getURLFromSrc("vcl/qa/cppunit/") + "test_blocklist_parse.xml", aDriveInfos); aBlocklistParser.parse(); size_t const n = aDriveInfos.size(); @@ -105,7 +105,7 @@ void BlocklistParserTest::testEvaluate() { std::vector<wgl::DriverInfo> aDriveInfos; - WinBlocklistParser aBlocklistParser(getURLFromSrc("vcl/qa/cppunit/") + "test_blocklist_evaluate.xml", aDriveInfos); + WinBlocklistParser aBlocklistParser(m_directories.getURLFromSrc("vcl/qa/cppunit/") + "test_blocklist_evaluate.xml", aDriveInfos); aBlocklistParser.parse(); OUString vendorAMD = WinOpenGLDeviceInfo::GetDeviceVendor(wgl::VendorAMD); diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx index 76dfcf07121c..b478bde6427a 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx @@ -123,31 +123,31 @@ void VclFiltersTest::testCVEs() { #ifndef DISABLE_CVE_TESTS testDir(OUString(), - getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/wmf/")); + m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/wmf/")); testDir(OUString(), - getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/emf/")); + m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/emf/")); testDir(OUString(), - getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/sgv/")); + m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/sgv/")); testDir(OUString(), - getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/png/")); + m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/png/")); testDir(OUString(), - getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/jpg/")); + m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/jpg/")); testDir(OUString(), - getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/gif/")); + m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/gif/")); testDir(OUString(), - getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/bmp/")); + m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/bmp/")); testDir(OUString(), - getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/xbm/")); + m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/xbm/")); testDir(OUString(), - getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/xpm/")); + m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/xpm/")); #endif } diff --git a/vcl/qa/cppunit/wmf/wmfimporttest.cxx b/vcl/qa/cppunit/wmf/wmfimporttest.cxx index 176ff5dda15e..1d333f39ceec 100644 --- a/vcl/qa/cppunit/wmf/wmfimporttest.cxx +++ b/vcl/qa/cppunit/wmf/wmfimporttest.cxx @@ -31,7 +31,7 @@ class WmfTest : public test::BootstrapFixture, public XmlTestTools OUString getFullUrl(const OUString& sFileName) { - return getURLFromSrc(maDataUrl) + sFileName; + return m_directories.getURLFromSrc(maDataUrl) + sFileName; } public: diff --git a/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx b/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx index 775550f2c060..12110377b0f0 100644 --- a/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx +++ b/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx @@ -80,7 +80,7 @@ void RtfTest::test() { #ifndef DISABLE_CVE_TESTS testDir(OUString(), - getURLFromSrc("/writerfilter/qa/cppunittests/rtftok/data/")); + m_directories.getURLFromSrc("/writerfilter/qa/cppunittests/rtftok/data/")); #endif } diff --git a/writerperfect/qa/unit/DirectoryStreamTest.cxx b/writerperfect/qa/unit/DirectoryStreamTest.cxx index 8c4c70403518..1331932e1994 100644 --- a/writerperfect/qa/unit/DirectoryStreamTest.cxx +++ b/writerperfect/qa/unit/DirectoryStreamTest.cxx @@ -101,9 +101,9 @@ DirectoryStreamTest::DirectoryStreamTest() using ucbhelper::Content; - m_xDir = Content(getURLFromSrc(g_aDirPath), xCmdEnv, xContext).get(); - m_xFile = Content(getURLFromSrc(g_aNondirPath), xCmdEnv, xContext).get(); - m_xNonexistent = Content(getURLFromSrc(g_aNonexistentPath), xCmdEnv, xContext).get(); + m_xDir = Content(m_directories.getURLFromSrc(g_aDirPath), xCmdEnv, xContext).get(); + m_xFile = Content(m_directories.getURLFromSrc(g_aNondirPath), xCmdEnv, xContext).get(); + m_xNonexistent = Content(m_directories.getURLFromSrc(g_aNonexistentPath), xCmdEnv, xContext).get(); } void DirectoryStreamTest::testConstruction() diff --git a/writerperfect/qa/unit/WPXSvStreamTest.cxx b/writerperfect/qa/unit/WPXSvStreamTest.cxx index 2ac9f28af307..16d8ebc22b91 100644 --- a/writerperfect/qa/unit/WPXSvStreamTest.cxx +++ b/writerperfect/qa/unit/WPXSvStreamTest.cxx @@ -293,7 +293,7 @@ void WPXSvStreamTest::testStructured() { // OLE2 { - const shared_ptr<RVNGInputStream> pInput(lcl_createStreamForURL(getURLFromSrc(aOLEFile))); + const shared_ptr<RVNGInputStream> pInput(lcl_createStreamForURL(m_directories.getURLFromSrc(aOLEFile))); assert(bool(pInput)); CPPUNIT_ASSERT(pInput->isStructured()); @@ -314,7 +314,7 @@ void WPXSvStreamTest::testStructured() // Zip { - const shared_ptr<RVNGInputStream> pInput(lcl_createStreamForURL(getURLFromSrc(aZipFile))); + const shared_ptr<RVNGInputStream> pInput(lcl_createStreamForURL(m_directories.getURLFromSrc(aZipFile))); assert(bool(pInput)); CPPUNIT_ASSERT(pInput->isStructured()); diff --git a/writerperfect/qa/unit/WpftImportTestBase.cxx b/writerperfect/qa/unit/WpftImportTestBase.cxx index ac785038b60c..66bc021d992d 100644 --- a/writerperfect/qa/unit/WpftImportTestBase.cxx +++ b/writerperfect/qa/unit/WpftImportTestBase.cxx @@ -172,14 +172,14 @@ bool WpftImportTestBase::load(const OUString &, const OUString &rURL, const OUSt void WpftImportTestBase::doTest(const rtl::OUString &rFilter, const rtl::OUString &rPath) { m_xFilter.set(m_xFactory->createInstanceWithContext(rFilter, m_xContext), uno::UNO_QUERY_THROW); - testDir(OUString(), getURLFromSrc(rPath)); + testDir(OUString(), m_directories.getURLFromSrc(rPath)); } void WpftImportTestBase::doTest(const rtl::OUString &rFilter, const rtl::OUString &rPath, const WpftOptionalMap_t &rOptionalMap) { m_xFilter.set(m_xFactory->createInstanceWithContext(rFilter, m_xContext), uno::UNO_QUERY_THROW); m_pOptionalMap = &rOptionalMap; - testDir(OUString(), getURLFromSrc(rPath)); + testDir(OUString(), m_directories.getURLFromSrc(rPath)); m_pOptionalMap = nullptr; } diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx index 64f5aca89758..b576b3b060a3 100644 --- a/xmlsecurity/qa/unit/signing/signing.cxx +++ b/xmlsecurity/qa/unit/signing/signing.cxx @@ -123,7 +123,7 @@ uno::Reference<security::XCertificate> SigningTest::getCertificate(XMLSignatureH uno::Reference<xml::crypto::XSecurityEnvironment> xSecurityEnvironment = rSignatureHelper.GetSecurityEnvironment(); OUString aCertificate; { - SvFileStream aStream(getURLFromSrc(DATA_DIRECTORY) + "certificate.crt", StreamMode::READ); + SvFileStream aStream(m_directories.getURLFromSrc(DATA_DIRECTORY) + "certificate.crt", StreamMode::READ); OString aLine; bool bMore = aStream.ReadLine(aLine); while (bMore) @@ -209,7 +209,7 @@ void SigningTest::testOOXMLAppend() aTempFile.EnableKillingFile(); OUString aURL = aTempFile.GetURL(); CPPUNIT_ASSERT_EQUAL(osl::File::RC::E_None, - osl::File::copy(getURLFromSrc(DATA_DIRECTORY) + "partial.docx", aURL)); + osl::File::copy(m_directories.getURLFromSrc(DATA_DIRECTORY) + "partial.docx", aURL)); // Load the test document as a storage and read its single signature. DocumentSignatureManager aManager(mxComponentContext, SignatureModeDocumentContent); CPPUNIT_ASSERT(aManager.maSignatureHelper.Init()); @@ -238,7 +238,7 @@ void SigningTest::testOOXMLRemove() // Load the test document as a storage and read its signatures: purpose1 and purpose2. DocumentSignatureManager aManager(mxComponentContext, SignatureModeDocumentContent); CPPUNIT_ASSERT(aManager.maSignatureHelper.Init()); - OUString aURL = getURLFromSrc(DATA_DIRECTORY) + "multi.docx"; + OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "multi.docx"; uno::Reference <embed::XStorage> xStorage = comphelper::OStorageHelper::GetStorageOfFormatFromURL(ZIP_STORAGE_FORMAT_STRING, aURL, embed::ElementModes::READWRITE); CPPUNIT_ASSERT(xStorage.is()); aManager.mxStore = xStorage; @@ -265,7 +265,7 @@ void SigningTest::testOOXMLRemoveAll() aTempFile.EnableKillingFile(); OUString aURL = aTempFile.GetURL(); CPPUNIT_ASSERT_EQUAL(osl::File::RC::E_None, - osl::File::copy(getURLFromSrc(DATA_DIRECTORY) + "partial.docx", aURL)); + osl::File::copy(m_directories.getURLFromSrc(DATA_DIRECTORY) + "partial.docx", aURL)); // Load the test document as a storage and read its single signature. DocumentSignatureManager aManager(mxComponentContext, SignatureModeDocumentContent); CPPUNIT_ASSERT(aManager.maSignatureHelper.Init()); @@ -303,7 +303,7 @@ void SigningTest::testOOXMLRemoveAll() void SigningTest::testOOXMLPartial() { - createDoc(getURLFromSrc(DATA_DIRECTORY) + "partial.docx"); + createDoc(m_directories.getURLFromSrc(DATA_DIRECTORY) + "partial.docx"); SfxBaseModel* pBaseModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); CPPUNIT_ASSERT(pBaseModel); SfxObjectShell* pObjectShell = pBaseModel->GetObjectShell(); @@ -321,7 +321,7 @@ void SigningTest::testOOXMLPartial() void SigningTest::testOOXMLBroken() { - createDoc(getURLFromSrc(DATA_DIRECTORY) + "bad.docx"); + createDoc(m_directories.getURLFromSrc(DATA_DIRECTORY) + "bad.docx"); SfxBaseModel* pBaseModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); CPPUNIT_ASSERT(pBaseModel); SfxObjectShell* pObjectShell = pBaseModel->GetObjectShell(); |