svgio/qa/cppunit/SvgImportTest.cxx     |    2 +-
 svgio/qa/cppunit/data/textXmlSpace.svg |    4 ++--
 svgio/source/svgreader/svgtools.cxx    |    8 +++-----
 3 files changed, 6 insertions(+), 8 deletions(-)

New commits:
commit f5af51332344b35bc5d7a2588e785c01116277a8
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Sep 23 13:25:06 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Sep 26 11:02:45 2022 +0200

    tdf#151118: don't trim leading/trailing spaces in 'preserve' case
    
    Thanks again to Mike Kaganski for spotting
    
    Change-Id: Ifd8dcf15d7714ebc4f19083fefe0d78d27d46b4c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140483
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit 5e6b02055a887bc49c5252c1ae359ae96947e80c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140500

diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 49f88768d148..28a6d0b8784a 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -409,7 +409,7 @@ void Test::testTextXmlSpace()
     assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", 
"text", "a b");
     assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", 
"text", "a b");
     assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", 
"text", "ab");
-    assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[5]", 
"text", "a  b");
+    assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[5]", 
"text", " a  b ");
     assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[6]", 
"text", "a b");
     assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[7]", 
"text", "a   b");
     assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[8]", 
"text", "a b");
diff --git a/svgio/qa/cppunit/data/textXmlSpace.svg 
b/svgio/qa/cppunit/data/textXmlSpace.svg
index f200d74dd3f3..fe1bc8ceeb79 100644
--- a/svgio/qa/cppunit/data/textXmlSpace.svg
+++ b/svgio/qa/cppunit/data/textXmlSpace.svg
@@ -1,12 +1,12 @@
 <svg xmlns="http://www.w3.org/2000/svg"; version="1.1"
    viewBox="0 0 250 250">
-  <text y="10" xml:space="default">a  b</text>
+  <text y="10" xml:space="default"> a  b </text>
   <text y="30" xml:space="default">a   b</text>
   <text y="50" xml:space="default">a
   b</text>
   <text y="70" xml:space="default">a
 b</text>
-  <text y="90" xml:space="preserve">a  b</text>
+  <text y="90" xml:space="preserve"> a  b </text>
   <text y="110" xml:space="preserve">a b</text>
   <text y="130" xml:space="preserve">a
   b</text>
diff --git a/svgio/source/svgreader/svgtools.cxx 
b/svgio/source/svgreader/svgtools.cxx
index e4303bbb8fc8..0da6e4f8219a 100644
--- a/svgio/source/svgreader/svgtools.cxx
+++ b/svgio/source/svgreader/svgtools.cxx
@@ -1512,13 +1512,11 @@ namespace svgio::svgreader
             // convert tab to space
             aRetval = convert(aRetval, aTab, aSpace, false);
 
-            // strip of all leading and trailing spaces
-            aRetval = aRetval.trim();
-
             if(bIsDefault)
             {
-                // consolidate contiguous space
-                aRetval = consolidateContiguousSpace(aRetval);
+                // strip of all leading and trailing spaces
+                // and consolidate contiguous space
+                aRetval = consolidateContiguousSpace(aRetval.trim());
             }
 
             return aRetval;

Reply via email to