vcl/qa/cppunit/text.cxx |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 52bd9c25d1e1150cb5f5a8890c4d5dcce4e32954
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Mon May 9 14:57:36 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Mon May 9 17:57:29 2022 +0200

    SvFileStream needs an absolute file URL
    
    ...and fail loudly if writing the file fails for any reason
    
    Change-Id: I1e6d2e3da4d2ef643f4d27067845184dbf2e40a8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134076
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/vcl/qa/cppunit/text.cxx b/vcl/qa/cppunit/text.cxx
index 899217347085..668e84ef2aad 100644
--- a/vcl/qa/cppunit/text.cxx
+++ b/vcl/qa/cppunit/text.cxx
@@ -7,11 +7,14 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <osl/file.hxx>
+#include <osl/process.h>
 #include <test/bootstrapfixture.hxx>
 #include <sal/log.hxx>
 #include <tools/stream.hxx>
 
 #include <vcl/BitmapReadAccess.hxx>
+#include <vcl/errcode.hxx>
 #include <vcl/graphicfilter.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
@@ -32,8 +35,14 @@ class VclTextTest : public test::BootstrapFixture
         if (mbExportBitmap)
         {
             BitmapEx aBitmapEx(device->GetBitmapEx(Point(0, 0), 
device->GetOutputSizePixel()));
-            SvFileStream aStream(filename, StreamMode::WRITE | 
StreamMode::TRUNC);
-            GraphicFilter::GetGraphicFilter().compressAsPNG(aBitmapEx, 
aStream);
+            OUString cwd;
+            CPPUNIT_ASSERT_EQUAL(osl_Process_E_None, 
osl_getProcessWorkingDir(&cwd.pData));
+            OUString url;
+            CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None,
+                                 osl::FileBase::getAbsoluteFileURL(cwd, 
filename, url));
+            SvFileStream aStream(url, StreamMode::WRITE | StreamMode::TRUNC);
+            CPPUNIT_ASSERT_EQUAL(
+                ERRCODE_NONE, 
GraphicFilter::GetGraphicFilter().compressAsPNG(aBitmapEx, aStream));
         }
     }
 

Reply via email to