Kaydet (Commit) e95e0579 authored tarafından Christian Lohmaier's avatar Christian Lohmaier

screenshots: builddir is not neccessarily same as srcdir

Change-Id: Ic7d3d7854eeb5511d5e94e7329fcffa8a3ccba34
Reviewed-on: https://gerrit.libreoffice.org/31160Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
(cherry picked from commit bc13c1c2)
Reviewed-on: https://gerrit.libreoffice.org/31868Reviewed-by: 's avatarChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>
üst 371f0f67
...@@ -40,10 +40,8 @@ public: ...@@ -40,10 +40,8 @@ public:
// return a URL to a given c-str path from the workdir directory // return a URL to a given c-str path from the workdir directory
OUString getURLFromWorkdir( const char *pPath ); OUString getURLFromWorkdir( const char *pPath );
#ifdef _WIN32
// return a Path to a given c-str path from the workdir directory // return a Path to a given c-str path from the workdir directory
OUString getPathFromWorkdir( const char *pPath ); OUString getPathFromWorkdir( const char *pPath );
#endif
}; };
} }
......
...@@ -36,7 +36,7 @@ using namespace css; ...@@ -36,7 +36,7 @@ using namespace css;
using namespace css::uno; using namespace css::uno;
ScreenshotTest::ScreenshotTest() ScreenshotTest::ScreenshotTest()
: m_aScreenshotDirectory("/workdir/screenshots/"), : m_aScreenshotDirectory("/screenshots/"),
maKnownDialogs() maKnownDialogs()
{ {
SvtSysLocaleOptions localeOptions; SvtSysLocaleOptions localeOptions;
...@@ -54,8 +54,8 @@ void ScreenshotTest::setUp() ...@@ -54,8 +54,8 @@ void ScreenshotTest::setUp()
mxDesktop = css::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) ); mxDesktop = css::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) );
CPPUNIT_ASSERT_MESSAGE("no desktop!", mxDesktop.is()); CPPUNIT_ASSERT_MESSAGE("no desktop!", mxDesktop.is());
osl::FileBase::RC err = osl::Directory::create( m_directories.getURLFromSrc( m_aScreenshotDirectory ) ); osl::FileBase::RC err = osl::Directory::create( m_directories.getURLFromWorkdir( OUStringToOString(m_aScreenshotDirectory, RTL_TEXTENCODING_UTF8).getStr())) ;
CPPUNIT_ASSERT_MESSAGE( "Failed to create screenshot directory", (err == osl::FileBase::E_None || err == osl::FileBase::E_EXIST) ); 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 // initialize maKnownDialogs
if (maKnownDialogs.empty()) if (maKnownDialogs.empty())
...@@ -70,11 +70,11 @@ void ScreenshotTest::implSaveScreenshot(const Bitmap& rScreenshot, const OString ...@@ -70,11 +70,11 @@ void ScreenshotTest::implSaveScreenshot(const Bitmap& rScreenshot, const OString
splitHelpId(rScreenshotId, aDirname, aBasename); splitHelpId(rScreenshotId, aDirname, aBasename);
aDirname = m_aScreenshotDirectory + maCurrentLanguage + "/" + aDirname; 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(), CPPUNIT_ASSERT_MESSAGE(OUStringToOString("Failed to create " + aDirname, RTL_TEXTENCODING_UTF8).getStr(),
(err == osl::FileBase::E_None || err == osl::FileBase::E_EXIST)); (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); SvFileStream aNew(aFullPath, StreamMode::WRITE | StreamMode::TRUNC);
CPPUNIT_ASSERT_MESSAGE(OUStringToOString("Failed to open " + OUString::number(aNew.GetErrorCode()), RTL_TEXTENCODING_UTF8).getStr(), aNew.IsOpen()); CPPUNIT_ASSERT_MESSAGE(OUStringToOString("Failed to open " + OUString::number(aNew.GetErrorCode()), RTL_TEXTENCODING_UTF8).getStr(), aNew.IsOpen());
......
...@@ -59,11 +59,9 @@ OUString test::Directories::getURLFromWorkdir( const char *pPath ) ...@@ -59,11 +59,9 @@ OUString test::Directories::getURLFromWorkdir( const char *pPath )
return m_aWorkdirRootURL + OUString::createFromAscii( 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 ) OUString test::Directories::getPathFromWorkdir( const char *pPath )
{ {
return m_aWorkdirRootPath + OUString::createFromAscii( pPath ); return m_aWorkdirRootPath + OUString::createFromAscii( pPath );
} }
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment