[Libreoffice-commits] core.git: oox/source sw/qa

Regényi Balázs (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 9 07:52:48 UTC 2020


 oox/source/drawingml/textcharacterpropertiescontext.cxx              |    6 +-
 sw/qa/extras/ooxmlexport/data/tdf131776_StrikeoutGroupShapeText.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx                           |   28 ++++++++--
 3 files changed, 28 insertions(+), 6 deletions(-)

New commits:
commit 3bf68bfa4a6376857ed65e768722607ee7287dfa
Author:     Regényi Balázs <regenyi.balazs+gerrit at gmail.com>
AuthorDate: Tue Apr 7 09:12:07 2020 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Thu Apr 9 09:52:13 2020 +0200

    tdf#131776 DOCX grouped shape import: fix regression for strikeouts
    
    Because of previous commit we applied strikeout
    on shape text if its attribute "val" was false.
    
    Regression from commit 143e6641cea7a06faeec8b3b65aa09b153a6490f
    (tdf#131776 DOCX DrawingML shape import: fix missing strikeout).
    
    Co-Author: Szabolcs Toth
    
    Change-Id: Iff2331cc183be59aee66a7f6f0ad65af89b13093
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91796
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx
index cd98b9564825..4533a96e1cca 100644
--- a/oox/source/drawingml/textcharacterpropertiescontext.cxx
+++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx
@@ -211,10 +211,12 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl
         case W_TOKEN( bCs ):
             break;
         case W_TOKEN( strike ):
-            mrTextCharacterProperties.moStrikeout = XML_sngStrike;
+            if (rAttribs.getBool(W_TOKEN(val), true))
+                mrTextCharacterProperties.moStrikeout = XML_sngStrike;
             break;
         case W_TOKEN( dstrike ):
-            mrTextCharacterProperties.moStrikeout = XML_dblStrike;
+            if (rAttribs.getBool(W_TOKEN(val), true))
+                mrTextCharacterProperties.moStrikeout = XML_dblStrike;
             break;
         case W_TOKEN( color ):
             if (rAttribs.getInteger(W_TOKEN(val)).has())
diff --git a/sw/qa/extras/ooxmlexport/data/tdf131776_StrikeoutGroupShapeText.docx b/sw/qa/extras/ooxmlexport/data/tdf131776_StrikeoutGroupShapeText.docx
index b464f35e2f7e..3fd4ab1f5f59 100644
Binary files a/sw/qa/extras/ooxmlexport/data/tdf131776_StrikeoutGroupShapeText.docx and b/sw/qa/extras/ooxmlexport/data/tdf131776_StrikeoutGroupShapeText.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index e88b902aee0a..ba54c33e115a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -780,17 +780,37 @@ DECLARE_OOXMLEXPORT_TEST(testStrikeoutGroupShapeText, "tdf131776_StrikeoutGroupS
     if (!pXml)
         return;
 
-    // double strike
+    // double strike (dstrike)
+    //   no "val" attribute
     assertXPath(pXml, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
         "wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:dstrike");
     assertXPathNoAttribute(pXml, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
         "wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:dstrike", "val");
+    //   "val" attribute is true, this is used in this test file. However, LO is going to export this element without the "val" attribute
+    //   because if the element appears, but without an attribute its "val" true by default.
+    assertXPath(pXml, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
+        "wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:dstrike");
+    assertXPathNoAttribute(pXml, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
+        "wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:dstrike", "val");
+    //   "val" attribute is false (this was missing, resulting the regression)
+    assertXPath(pXml, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
+        "wps:wsp[3]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:dstrike", "val", "false");
 
-    // simple strike
+    // simple strike (strike)
+        //   no "val" attribute
     assertXPath(pXml, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
-        "wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike");
+        "wps:wsp[4]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike");
     assertXPathNoAttribute(pXml, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
-        "wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike", "val");
+        "wps:wsp[4]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike", "val");
+    //   "val" attribute is true, this is used in this test file. However, LO is going to export this element without the "val" attribute
+    //   because if the element appears, but without an attribute its "val" true by default.
+    assertXPath(pXml, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
+        "wps:wsp[5]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike");
+    assertXPathNoAttribute(pXml, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
+        "wps:wsp[5]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike", "val");
+    //   "val" attribute is false
+    assertXPath(pXml, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
+        "wps:wsp[6]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike", "val", "false");
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list