vcl/qa/cppunit/pdfexport/pdfexport.cxx |   73 +++++++++++++++++++--------------
 1 file changed, 44 insertions(+), 29 deletions(-)

New commits:
commit cc86bc599c8b3ce786e05246e82559888817ab12
Author:     Dr. David Alan Gilbert <d...@treblig.org>
AuthorDate: Sat Feb 19 15:13:01 2022 +0000
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Mar 10 10:25:56 2022 +0100

    pdfwriter: Add check without relativeFsys
    
    Set relativeFsys on a per-test basis and add a test with
    relativeFsys off.
    
    Change-Id: I43b1d82200aca37b2cf8ac71d77a4aa61df543ba
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130197
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131258

diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 62f4c56efcb9..b6e251509d06 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -2950,28 +2950,43 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testURIs)
     {
         OUString in;
         OString out;
-    } URIs[] = { {
-                     "http://example.com/";,
-                     "http://example.com/";,
-                 },
-                 {
-                     "file://localfile.odt/",
-                     "file://localfile.odt/",
-                 },
-                 {
-                     "git://git.example.org/project/example",
-                     "git://git.example.org/project/example",
-                 },
-                 {
-                     // The odt/pdf gets substituted due to 
'ConvertOOoTargetToPDFTarget'
-                     "filebypath.odt",
-                     "filebypath.pdf",
-                 },
-                 {
-                     // This also gets made relative due to 
'ExportLinksRelativeFsys'
-                     utl::TempFile::GetTempNameBaseDirectory() + 
"fileintempdir.odt",
-                     "fileintempdir.pdf",
-                 } };
+        bool relativeFsys;
+    } URIs[]
+        = { {
+                "http://example.com/";,
+                "http://example.com/";,
+                true,
+            },
+            {
+                "file://localfile.odt/",
+                "file://localfile.odt/",
+                true,
+            },
+            {
+                "git://git.example.org/project/example",
+                "git://git.example.org/project/example",
+                true,
+            },
+            {
+                // The odt/pdf gets substituted due to 
'ConvertOOoTargetToPDFTarget'
+                "filebypath.odt",
+                "filebypath.pdf",
+                true,
+            },
+            {
+                // The odt/pdf gets substituted due to 
'ConvertOOoTargetToPDFTarget'
+                // but this time with ExportLinksRelativeFsys off the path is 
added
+                "filebypath.odt",
+                OUStringToOString(utl::TempFile::GetTempNameBaseDirectory(), 
RTL_TEXTENCODING_UTF8)
+                    + "filebypath.pdf",
+                false,
+            },
+            {
+                // This also gets made relative due to 
'ExportLinksRelativeFsys'
+                utl::TempFile::GetTempNameBaseDirectory() + 
"fileintempdir.odt",
+                "fileintempdir.pdf",
+                true,
+            } };
 
     // Create an empty document.
     // Note: The test harness gets very upset if we try and create multiple
@@ -2986,15 +3001,15 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testURIs)
     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
     xModel->attachResource(maTempFile.GetURL(), xModel->getArgs());
 
-    // Test the filename rewriting
-    uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence({
-        { "ExportLinksRelativeFsys", uno::makeAny(true) },
-        { "ConvertOOoTargetToPDFTarget", uno::makeAny(true) },
-    }));
-    aMediaDescriptor["FilterData"] <<= aFilterData;
-
     for (unsigned int i = 0; i < (sizeof(URIs) / sizeof(URIs[0])); i++)
     {
+        // Test the filename rewriting
+        uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence({
+            { "ExportLinksRelativeFsys", uno::makeAny(URIs[i].relativeFsys) },
+            { "ConvertOOoTargetToPDFTarget", uno::makeAny(true) },
+        }));
+        aMediaDescriptor["FilterData"] <<= aFilterData;
+
         // Add a link (based on testNestedHyperlink in rtfexport3)
         xCursor->gotoStart(/*bExpand=*/false);
         xCursor->gotoEnd(/*bExpand=*/true);

Reply via email to