xmloff/qa/unit/draw.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
New commits: commit 017e23328a20837d8102eca0ec85297fe03cc5c6 Author: Jaume Pujantell <[email protected]> AuthorDate: Thu Jan 30 17:23:51 2025 +0100 Commit: Miklos Vajna <[email protected]> CommitDate: Fri Jan 31 15:43:44 2025 +0100 sd pdfium: improve testPdfExportAsOdg Remove ifdef and add more info. Change-Id: I69e2ce6ccdbc5a933462e64b29426a60cb8613df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180963 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx index 525c703c5eaa..028a76171de3 100644 --- a/xmloff/qa/unit/draw.cxx +++ b/xmloff/qa/unit/draw.cxx @@ -32,6 +32,7 @@ #include <docmodel/uno/UnoTheme.hxx> #include <docmodel/theme/Theme.hxx> #include <comphelper/scopeguard.hxx> +#include <osl/process.h> using namespace ::com::sun::star; @@ -820,18 +821,16 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testPdfExportAsOdg) return; } -// setenv only works on unix based systems -#ifndef _WIN32 // We need to enable PDFium import (and make sure to disable after the test) bool bResetEnvVar = false; if (getenv("LO_IMPORT_USE_PDFIUM") == nullptr) { bResetEnvVar = true; - setenv("LO_IMPORT_USE_PDFIUM", "1", false); + osl_setEnvironment(OUString("LO_IMPORT_USE_PDFIUM").pData, OUString("1").pData); } comphelper::ScopeGuard aPDFiumEnvVarGuard([&]() { if (bResetEnvVar) - unsetenv("LO_IMPORT_USE_PDFIUM"); + osl_clearEnvironment(OUString("LO_IMPORT_USE_PDFIUM").pData); }); loadFromFile(u"two-pages.pdf"); @@ -851,8 +850,10 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testPdfExportAsOdg) CPPUNIT_ASSERT(xShapeProps->getPropertyValue("Graphic") >>= xGraphic); Graphic aGraphic(xGraphic); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1 + // - Actual : -1 CPPUNIT_ASSERT_EQUAL(1, aGraphic.getPageNumber()); -#endif } CPPUNIT_PLUGIN_IMPLEMENT();
