[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - include/unotest test/source unotest/source

Christian Lohmaier lohmaier+LibreOffice at googlemail.com
Thu Dec 22 14:19:04 UTC 2016


 include/unotest/directories.hxx    |    2 --
 test/source/screenshot_test.cxx    |   10 +++++-----
 unotest/source/cpp/directories.cxx |    2 --
 3 files changed, 5 insertions(+), 9 deletions(-)

New commits:
commit e95e05795d192275fa3c44a87377ce8353ae32d8
Author: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Date:   Thu Nov 24 11:26:21 2016 +0100

    screenshots: builddir is not neccessarily same as srcdir
    
    Change-Id: Ic7d3d7854eeb5511d5e94e7329fcffa8a3ccba34
    Reviewed-on: https://gerrit.libreoffice.org/31160
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit bc13c1c2bab46135ef7c05fa1a772989f8ff4460)
    Reviewed-on: https://gerrit.libreoffice.org/31868
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/include/unotest/directories.hxx b/include/unotest/directories.hxx
index 3e44558..ae105d9 100644
--- a/include/unotest/directories.hxx
+++ b/include/unotest/directories.hxx
@@ -40,10 +40,8 @@ public:
     // 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
 };
 
 }
diff --git a/test/source/screenshot_test.cxx b/test/source/screenshot_test.cxx
index b4e8633..dcd0bef 100644
--- a/test/source/screenshot_test.cxx
+++ b/test/source/screenshot_test.cxx
@@ -36,7 +36,7 @@ using namespace css;
 using namespace css::uno;
 
 ScreenshotTest::ScreenshotTest()
-:   m_aScreenshotDirectory("/workdir/screenshots/"),
+:   m_aScreenshotDirectory("/screenshots/"),
     maKnownDialogs()
 {
     SvtSysLocaleOptions localeOptions;
@@ -54,8 +54,8 @@ void ScreenshotTest::setUp()
     mxDesktop = css::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) );
     CPPUNIT_ASSERT_MESSAGE("no desktop!", mxDesktop.is());
 
-    osl::FileBase::RC err = osl::Directory::create( m_directories.getURLFromSrc( m_aScreenshotDirectory ) );
-    CPPUNIT_ASSERT_MESSAGE( "Failed to create screenshot directory", (err == osl::FileBase::E_None || err == osl::FileBase::E_EXIST) );
+    osl::FileBase::RC err = osl::Directory::create( m_directories.getURLFromWorkdir( OUStringToOString(m_aScreenshotDirectory, RTL_TEXTENCODING_UTF8).getStr())) ;
+    CPPUNIT_ASSERT_MESSAGE(OUStringToOString("Failed to create screenshot directory - " + m_directories.getURLFromWorkdir( OUStringToOString(m_aScreenshotDirectory, RTL_TEXTENCODING_UTF8).getStr()), RTL_TEXTENCODING_UTF8).getStr(), (err == osl::FileBase::E_None || err == osl::FileBase::E_EXIST) );
 
     // initialize maKnownDialogs
     if (maKnownDialogs.empty())
@@ -70,11 +70,11 @@ void ScreenshotTest::implSaveScreenshot(const Bitmap& rScreenshot, const OString
     splitHelpId(rScreenshotId, aDirname, aBasename);
     aDirname = m_aScreenshotDirectory + maCurrentLanguage + "/" + aDirname;
 
-    osl::FileBase::RC err = osl::Directory::createPath(m_directories.getURLFromSrc(aDirname));
+    osl::FileBase::RC err = osl::Directory::createPath(m_directories.getURLFromWorkdir(OUStringToOString(aDirname,RTL_TEXTENCODING_UTF8).getStr()));
     CPPUNIT_ASSERT_MESSAGE(OUStringToOString("Failed to create " + aDirname, RTL_TEXTENCODING_UTF8).getStr(),
         (err == osl::FileBase::E_None || err == osl::FileBase::E_EXIST));
 
-    OUString aFullPath = m_directories.getSrcRootPath() + aDirname + "/" + aBasename + ".png";
+    OUString aFullPath = m_directories.getPathFromWorkdir(OUStringToOString(aDirname + "/" + aBasename + ".png",RTL_TEXTENCODING_UTF8).getStr());
     SvFileStream aNew(aFullPath, StreamMode::WRITE | StreamMode::TRUNC);
     CPPUNIT_ASSERT_MESSAGE(OUStringToOString("Failed to open " + OUString::number(aNew.GetErrorCode()), RTL_TEXTENCODING_UTF8).getStr(), aNew.IsOpen());
 
diff --git a/unotest/source/cpp/directories.cxx b/unotest/source/cpp/directories.cxx
index 55084a2..508af53 100644
--- a/unotest/source/cpp/directories.cxx
+++ b/unotest/source/cpp/directories.cxx
@@ -59,11 +59,9 @@ 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: */


More information about the Libreoffice-commits mailing list