sd/qa/unit/SVGExportTests.cxx | 58 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+)
New commits: commit bee3a7bdd0effd15f36e3debd1c6e20af12b4ea3 Author: Marco Cecchetti <marco.cecche...@collabora.com> AuthorDate: Wed Feb 17 23:46:23 2021 +0100 Commit: Marco Cecchetti <marco.cecche...@collabora.com> CommitDate: Tue Mar 9 15:37:29 2021 +0100 filter: svg: unit test for placeholder locale We set the language to it-IT and check that the exported placeholder text is still <number> instead of <numero> Change-Id: I7ec7e25e53075da38cb87d81e9f8268b37121bfe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111115 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111847 Tested-by: Jenkins Reviewed-by: Marco Cecchetti <marco.cecche...@collabora.com> diff --git a/sd/qa/unit/SVGExportTests.cxx b/sd/qa/unit/SVGExportTests.cxx index 7e7a8a2a620e..7bb9126d5d21 100644 --- a/sd/qa/unit/SVGExportTests.cxx +++ b/sd/qa/unit/SVGExportTests.cxx @@ -20,6 +20,9 @@ #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <comphelper/processfactory.hxx> +#include <unotools/syslocaleoptions.hxx> +#include <vcl/svapp.hxx> +#include <vcl/settings.hxx> #include <regex> @@ -69,6 +72,29 @@ bool isValidTiledBackgroundId(const OUString& sId) class SdSVGFilterTest : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools { + class Resetter + { + private: + std::function<void ()> m_Func; + + public: + Resetter(std::function<void ()> const& rFunc) + : m_Func(rFunc) + { + } + ~Resetter() + { + try + { + m_Func(); + } + catch (...) // has to be reliable + { + CPPUNIT_FAIL("resetter failed with exception"); + } + } + }; + uno::Reference<lang::XComponent> mxComponent; utl::TempFile maTempFile; @@ -283,6 +309,37 @@ public: CPPUNIT_ASSERT_EQUAL_MESSAGE("The href attribute for <use> does not match the tiled background id attribute: ", sBackgroundId, sRef); } + void testSVGPlaceholderLocale() + { + const OUString aLangISO("it-IT"); + SvtSysLocaleOptions aSysLocaleOptions; + aSysLocaleOptions.SetLocaleConfigString(aLangISO); + aSysLocaleOptions.SetUILocaleConfigString(aLangISO); + + auto aSavedSettings = Application::GetSettings(); + Resetter aResetter([&]() { Application::SetSettings(aSavedSettings); }); + AllSettings aSettings(aSavedSettings); + aSettings.SetLanguageTag(aLangISO, true); + Application::SetSettings(aSettings); + + executeExport("text-fields.odp"); + + xmlDocUniquePtr svgDoc = parseXml(maTempFile); + CPPUNIT_ASSERT(svgDoc); + + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2] ), "class", "Master_Slide"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2] ), "class", "BackgroundObjects"); + + // Slide Name Field + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[6] ), "class", "TextShape"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[6]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", "PlaceholderText"); + assertXPathContent(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[6]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "<slide-name>"); + // Slide Number Field + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[7] ), "class", "TextShape"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[7]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", "PlaceholderText"); + assertXPathContent(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[7]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "<number>"); + } + CPPUNIT_TEST_SUITE(SdSVGFilterTest); CPPUNIT_TEST(testSVGExportTextDecorations); CPPUNIT_TEST(testSVGExportJavascriptURL); @@ -290,6 +347,7 @@ public: CPPUNIT_TEST(testSVGExportTextFieldsInMasterPage); CPPUNIT_TEST(testSVGExportSlideBitmapBackground); CPPUNIT_TEST(testSVGExportSlideTileBitmapBackground); + CPPUNIT_TEST(testSVGPlaceholderLocale); CPPUNIT_TEST_SUITE_END(); }; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits