summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dave@treblig.org>2022-02-19 15:13:01 +0000
committerXisco Fauli <xiscofauli@libreoffice.org>2022-03-10 10:25:56 +0100
commitcc86bc599c8b3ce786e05246e82559888817ab12 (patch)
treed0b32a6b3f714d8204328408bba8a395ac84521a /vcl
parent0e6e1f37ee1d9fb6de41f6f18759b12d17344310 (diff)
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 <sbergman@redhat.com> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131258
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qa/cppunit/pdfexport/pdfexport.cxx73
1 files changed, 44 insertions, 29 deletions
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);