[Libreoffice-commits] core.git: chart2/qa emfio/qa include/unotest sc/qa sd/qa svgio/qa sw/qa test/source unotest/source vcl/qa xmlsecurity/qa

Stephan Bergmann sbergman at redhat.com
Thu Aug 24 07:32:30 UTC 2017


 chart2/qa/extras/charttest.hxx                 |    8 ++++----
 emfio/qa/cppunit/emf/EmfImportTest.cxx         |    4 ++--
 include/unotest/directories.hxx                |   14 ++++++--------
 sc/qa/extras/htmlexporttest.cxx                |    2 +-
 sc/qa/unit/tiledrendering/tiledrendering.cxx   |    2 +-
 sd/qa/unit/SVGExportTests.cxx                  |    2 +-
 sd/qa/unit/import-tests.cxx                    |    2 +-
 sd/qa/unit/tiledrendering/tiledrendering.cxx   |    2 +-
 svgio/qa/cppunit/SvgImportTest.cxx             |    4 ++--
 sw/qa/extras/globalfilter/globalfilter.cxx     |    4 ++--
 sw/qa/extras/inc/swmodeltestbase.hxx           |    6 +++---
 sw/qa/extras/tiledrendering/tiledrendering.cxx |    2 +-
 sw/qa/extras/uiwriter/uiwriter.cxx             |    2 +-
 test/source/screenshot_test.cxx                |    7 +++----
 unotest/source/cpp/directories.cxx             |   18 ++++--------------
 vcl/qa/cppunit/pdfexport/pdfexport.cxx         |    2 +-
 xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx  |    2 +-
 xmlsecurity/qa/unit/signing/signing.cxx        |    2 +-
 18 files changed, 36 insertions(+), 49 deletions(-)

New commits:
commit 66604baf08c47cc0c77ab3b9ee7e77f987c64722
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Aug 23 18:11:38 2017 +0200

    Consistently use OUString in test::Directories
    
    Change-Id: Ia5fd8af34ee9d2f37e4450ab241f6bb9a06445b2
    Reviewed-on: https://gerrit.libreoffice.org/41466
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx
index b75dac6d25b5..438565222db4 100644
--- a/chart2/qa/extras/charttest.hxx
+++ b/chart2/qa/extras/charttest.hxx
@@ -76,10 +76,10 @@ public:
     void load( const OUString& rDir, const OUString& rFileName );
     std::shared_ptr<utl::TempFile> save( const OUString& rFileName );
     std::shared_ptr<utl::TempFile> reload( const OUString& rFileName );
-    uno::Sequence < OUString > getImpressChartColumnDescriptions( const char* pDir, const char* pName );
+    uno::Sequence < OUString > getImpressChartColumnDescriptions( const OUString& pDir, const char* pName );
     OUString getFileExtension( const OUString& rFileName );
 
-    uno::Reference< chart::XChartDocument > getChartDocFromImpress( const char* pDir, const char* pName );
+    uno::Reference< chart::XChartDocument > getChartDocFromImpress( const OUString& pDir, const char* pName );
 
     uno::Reference<chart::XChartDocument> getChartDocFromDrawImpress( sal_Int32 nPage, sal_Int32 nShape );
 
@@ -497,7 +497,7 @@ std::vector<uno::Sequence<uno::Any> > getDataSeriesLabelsFromChartType( const Re
     return aRet;
 }
 
-uno::Reference< chart::XChartDocument > ChartTest::getChartDocFromImpress( const char* pDir, const char* pName )
+uno::Reference< chart::XChartDocument > ChartTest::getChartDocFromImpress( const OUString& pDir, const char* pName )
 {
     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 );
@@ -562,7 +562,7 @@ uno::Reference<chart::XChartDocument> ChartTest::getChartDocFromWriter( sal_Int3
     return xChartDoc;
 }
 
-uno::Sequence < OUString > ChartTest::getImpressChartColumnDescriptions( const char* pDir, const char* pName )
+uno::Sequence < OUString > ChartTest::getImpressChartColumnDescriptions( const OUString& pDir, const char* pName )
 {
     uno::Reference< chart::XChartDocument > xChartDoc = getChartDocFromImpress( pDir, pName );
     uno::Reference< chart::XChartDataArray > xChartData ( xChartDoc->getData(), uno::UNO_QUERY_THROW);
diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index a78aaeabeba2..ca766b8b67f3 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -40,7 +40,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools
 
     void testWorking();
 
-    Primitive2DSequence parseEmf(const char* aSource);
+    Primitive2DSequence parseEmf(const OUString& aSource);
 
 public:
     CPPUNIT_TEST_SUITE(Test);
@@ -48,7 +48,7 @@ public:
     CPPUNIT_TEST_SUITE_END();
 };
 
-Primitive2DSequence Test::parseEmf(const char* aSource)
+Primitive2DSequence Test::parseEmf(const OUString& aSource)
 {
     const Reference<XEmfParser> xEmfParser = EmfTools::create(m_xContext);
 
diff --git a/include/unotest/directories.hxx b/include/unotest/directories.hxx
index 04ee9287fe68..c1eaac83bafa 100644
--- a/include/unotest/directories.hxx
+++ b/include/unotest/directories.hxx
@@ -30,19 +30,17 @@ public:
     const OUString& getSrcRootURL()       { return m_aSrcRootURL; }
     const OUString& getSrcRootPath()      { return m_aSrcRootPath; }
 
-    // return a URL to a given c-str path from the source directory
-    OUString getURLFromSrc( const char *pPath );
+    // return a URL to a given path from the source directory
     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 Path to a given path from the source directory
     OUString getPathFromSrc( const OUString& rPath );
 
-    // return a URL to a given c-str path from the workdir directory
-    OUString getURLFromWorkdir( const char *pPath );
+    // return a URL to a given path from the workdir directory
+    OUString getURLFromWorkdir( const OUString &rPath );
 
-    // return a Path to a given c-str path from the workdir directory
-    OUString getPathFromWorkdir( const char *pPath );
+    // return a Path to a given path from the workdir directory
+    OUString getPathFromWorkdir( const OUString &rPath );
 };
 
 }
diff --git a/sc/qa/extras/htmlexporttest.cxx b/sc/qa/extras/htmlexporttest.cxx
index ed5dae9f2d88..b366f0e32e91 100644
--- a/sc/qa/extras/htmlexporttest.cxx
+++ b/sc/qa/extras/htmlexporttest.cxx
@@ -36,7 +36,7 @@ class ScHTMLExportTest : public test::BootstrapFixture, public unotest::MacrosTe
     Reference<XComponent> mxComponent;
     OUString              maFilterOptions;
 
-    void load(const char* pDir, const char* pName)
+    void load(const OUString& pDir, const char* pName)
     {
         if (mxComponent.is())
             mxComponent->dispose();
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 531171e4f23a..b05817af6c5c 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -51,7 +51,7 @@ std::ostream& operator<<(std::ostream& os, ViewShellId const & id)
 namespace
 {
 
-const char* const DATA_DIRECTORY = "/sc/qa/unit/tiledrendering/data/";
+char const DATA_DIRECTORY[] = "/sc/qa/unit/tiledrendering/data/";
 
 class ScTiledRenderingTest : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools
 {
diff --git a/sd/qa/unit/SVGExportTests.cxx b/sd/qa/unit/SVGExportTests.cxx
index c976436a6f89..9afc5cb42a01 100644
--- a/sd/qa/unit/SVGExportTests.cxx
+++ b/sd/qa/unit/SVGExportTests.cxx
@@ -37,7 +37,7 @@ protected:
         xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("svg"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"));
     }
 
-    void load(const char* pDir, const char* pName)
+    void load(const OUString& pDir, const char* pName)
     {
         return loadURL(m_directories.getURLFromSrc(pDir) + OUString::createFromAscii(pName), pName);
     }
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 8040997bc8a7..e4258b161730 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -1370,7 +1370,7 @@ void SdImportTest::testTdf93124()
 
 void SdImportTest::testTdf99729()
 {
-    const char* filenames[] = { "/sd/qa/unit/data/odp/tdf99729-new.odp", "/sd/qa/unit/data/odp/tdf99729-legacy.odp" };
+    const OUString filenames[] = { "/sd/qa/unit/data/odp/tdf99729-new.odp", "/sd/qa/unit/data/odp/tdf99729-legacy.odp" };
     int nonwhitecounts[] = { 0, 0 };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(filenames); ++i)
     {
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index b5c2e0107639..7f85c8892d9e 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -52,7 +52,7 @@
 
 using namespace css;
 
-static const char* const DATA_DIRECTORY = "/sd/qa/unit/tiledrendering/data/";
+static char const DATA_DIRECTORY[] = "/sd/qa/unit/tiledrendering/data/";
 
 static std::ostream& operator<<(std::ostream& os, ViewShellId id)
 {
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index 566ee420d41e..d91e6331fcef 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -63,7 +63,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools
     void testTdf99994();
     void testTdf101237();
 
-    Primitive2DSequence parseSvg(const char* aSource);
+    Primitive2DSequence parseSvg(const OUString& aSource);
 
 public:
     CPPUNIT_TEST_SUITE(Test);
@@ -94,7 +94,7 @@ public:
     CPPUNIT_TEST_SUITE_END();
 };
 
-Primitive2DSequence Test::parseSvg(const char* aSource)
+Primitive2DSequence Test::parseSvg(const OUString& aSource)
 {
     const Reference<XSvgParser> xSvgParser = SvgTools::create(m_xContext);
 
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx
index cc152f422c2f..51f021c5c83a 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -771,10 +771,10 @@ void Test::testSkipImages()
             uno::Sequence<beans::PropertyValue> args( comphelper::InitPropertySequence({
                     { "FilterOptions", uno::Any(OUString::createFromAscii(aFilterNames[nFilter][1])) }
             }));
-            mxComponent = loadFromDesktop(m_directories.getURLFromSrc(aFilterNames[nFilter][0]), "com.sun.star.text.TextDocument", args);
+            mxComponent = loadFromDesktop(m_directories.getURLFromSrc(OUString::createFromAscii(aFilterNames[nFilter][0])), "com.sun.star.text.TextDocument", args);
             sFailedMessage = sFailedMessage + " - " + aFilterNames[nFilter][1];
         } else
-            mxComponent = loadFromDesktop(m_directories.getURLFromSrc(aFilterNames[nFilter][0]), "com.sun.star.text.TextDocument");
+            mxComponent = loadFromDesktop(m_directories.getURLFromSrc(OUString::createFromAscii(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 7f258ab1baf7..80874da95810 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -142,7 +142,7 @@ protected:
     rtl::Reference<TestInteractionHandler> xInteractionHandler;
 
     xmlBufferPtr mpXmlBuffer;
-    const char* mpTestDocumentPath;
+    const OUString mpTestDocumentPath;
     const char* mpFilter;
 
     sal_uInt32 mnStartTime;
@@ -183,7 +183,7 @@ public:
         maFilterOptions = rFilterOptions;
     }
 
-    SwModelTestBase(const char* pTestDocumentPath = "", const char* pFilter = "")
+    SwModelTestBase(const OUString& pTestDocumentPath = OUString(), const char* pFilter = "")
         : mpXmlBuffer(nullptr)
         , mpTestDocumentPath(pTestDocumentPath)
         , mpFilter(pFilter)
@@ -614,7 +614,7 @@ protected:
         std::cout << "File tested,Execution Time (ms)" << std::endl;
     }
 
-    void load(const char* pDir, const char* pName, const char* pPassword = nullptr)
+    void load(const OUString& pDir, const char* pName, const char* pPassword = nullptr)
     {
         return loadURL(m_directories.getURLFromSrc(pDir) + OUString::createFromAscii(pName), pName, pPassword);
     }
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index e3541c4898c7..b83881d0d1da 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -35,7 +35,7 @@
 #include <IDocumentRedlineAccess.hxx>
 #include <vcl/scheduler.hxx>
 
-static const char* const DATA_DIRECTORY = "/sw/qa/extras/tiledrendering/data/";
+static char const DATA_DIRECTORY[] = "/sw/qa/extras/tiledrendering/data/";
 
 static std::ostream& operator<<(std::ostream& os, ViewShellId id)
 {
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index cb01dfc812d9..340cb2ac99cf 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -111,7 +111,7 @@
 #include <sfx2/watermarkitem.hxx>
 #include <fmthdft.hxx>
 
-static const char* const DATA_DIRECTORY = "/sw/qa/extras/uiwriter/data/";
+static char const DATA_DIRECTORY[] = "/sw/qa/extras/uiwriter/data/";
 
 class SwUiWriterTest : public SwModelTestBase
 {
diff --git a/test/source/screenshot_test.cxx b/test/source/screenshot_test.cxx
index b0c73b3b5573..5c53e96738e5 100644
--- a/test/source/screenshot_test.cxx
+++ b/test/source/screenshot_test.cxx
@@ -54,7 +54,7 @@ void ScreenshotTest::setUp()
     mxDesktop = css::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) );
     CPPUNIT_ASSERT_MESSAGE("no desktop!", mxDesktop.is());
 
-    osl::Directory::create( m_directories.getURLFromWorkdir( OUStringToOString(m_aScreenshotDirectory, RTL_TEXTENCODING_UTF8).getStr())) ;
+    osl::Directory::create( m_directories.getURLFromWorkdir( m_aScreenshotDirectory)) ;
 
     // initialize maKnownDialogs
     if (maKnownDialogs.empty())
@@ -70,8 +70,7 @@ void ScreenshotTest::implSaveScreenshot(const Bitmap& rScreenshot, const OString
     aDirname = m_aScreenshotDirectory + "/" + aDirname +
                ( (maCurrentLanguage == "en-US") ? OUString() : "/" + maCurrentLanguage );
 
-    auto const path = m_directories.getURLFromWorkdir(
-        OUStringToOString(aDirname, RTL_TEXTENCODING_UTF8).getStr());
+    auto const path = m_directories.getURLFromWorkdir(aDirname);
     auto const e = osl::Directory::createPath(path);
     if (e != osl::FileBase::E_EXIST) {
         CPPUNIT_ASSERT_EQUAL_MESSAGE(
@@ -80,7 +79,7 @@ void ScreenshotTest::implSaveScreenshot(const Bitmap& rScreenshot, const OString
             osl::FileBase::E_None, e);
     }
 
-    OUString aFullPath = m_directories.getPathFromWorkdir(OUStringToOString("/" + aDirname + "/" + aBasename + ".png",RTL_TEXTENCODING_UTF8).getStr());
+    OUString aFullPath = m_directories.getPathFromWorkdir("/" + aDirname + "/" + aBasename + ".png");
     SvFileStream aNew(aFullPath, StreamMode::WRITE | StreamMode::TRUNC);
     CPPUNIT_ASSERT_MESSAGE(OUStringToOString("Failed to open <" + aFullPath + ">: " + OUString::number(sal_uInt32(aNew.GetErrorCode())), RTL_TEXTENCODING_UTF8).getStr(), aNew.IsOpen());
 
diff --git a/unotest/source/cpp/directories.cxx b/unotest/source/cpp/directories.cxx
index d559dffc2e90..2970b92306f3 100644
--- a/unotest/source/cpp/directories.cxx
+++ b/unotest/source/cpp/directories.cxx
@@ -41,34 +41,24 @@ test::Directories::Directories() {
     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::getPathFromSrc(const OUString& rPath)
 {
     return m_aSrcRootPath + rPath;;
 }
 
-OUString test::Directories::getURLFromWorkdir( const char *pPath )
+OUString test::Directories::getURLFromWorkdir( const OUString& rPath )
 {
-    return m_aWorkdirRootURL + OUString::createFromAscii( pPath );
+    return m_aWorkdirRootURL + rPath;
 }
 
-OUString test::Directories::getPathFromWorkdir( const char *pPath )
+OUString test::Directories::getPathFromWorkdir( const OUString& rPath )
 {
-    return m_aWorkdirRootPath + OUString::createFromAscii( pPath );
+    return m_aWorkdirRootPath + rPath;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 42f39c961dda..f00f21afff55 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -120,7 +120,7 @@ void PdfExportTest::tearDown()
 
 #if HAVE_FEATURE_PDFIUM
 
-const char* const DATA_DIRECTORY = "/vcl/qa/cppunit/pdfexport/data/";
+char const DATA_DIRECTORY[] = "/vcl/qa/cppunit/pdfexport/data/";
 
 void PdfExportTest::load(const OUString& rFile, vcl::filter::PDFDocument& rDocument)
 {
diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
index 89ba2751062d..37faa04aada7 100644
--- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
+++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
@@ -23,7 +23,7 @@ using namespace com::sun::star;
 
 namespace
 {
-const char* const DATA_DIRECTORY = "/xmlsecurity/qa/unit/pdfsigning/data/";
+char const DATA_DIRECTORY[] = "/xmlsecurity/qa/unit/pdfsigning/data/";
 }
 
 /// Testsuite for the PDF signing feature.
diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx
index 729670dab027..e17ccff09ef4 100644
--- a/xmlsecurity/qa/unit/signing/signing.cxx
+++ b/xmlsecurity/qa/unit/signing/signing.cxx
@@ -49,7 +49,7 @@ using namespace com::sun::star;
 
 namespace
 {
-const char* const DATA_DIRECTORY = "/xmlsecurity/qa/unit/signing/data/";
+char const DATA_DIRECTORY[] = "/xmlsecurity/qa/unit/signing/data/";
 }
 
 /// Testsuite for the document signing feature.


More information about the Libreoffice-commits mailing list