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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Feb 7 17:22:05 UTC 2019


 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |    8 ++++++
 sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx     |binary
 sd/qa/unit/import-tests-smartart.cxx                |   23 ++++++++++++++++++++
 3 files changed, 31 insertions(+)

New commits:
commit e3c6f249c10f7f1bcc528e643f5723288c514b29
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Feb 7 16:26:31 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Feb 7 18:21:39 2019 +0100

    oox smartart, cycle matrix: fix counting presentation children
    
    The markup is:
    
    <dgm:if name="Name6" axis="ch ch" ptType="node node" st="1 1" cnt="1 0" func="cnt" op="gte" val="1">
    
    Where PowerPoint evaluated the condition to true, but Impress evaluated
    to false. This means that the undocumented relation between the child
    lists is "OR" (not "AND").
    
    Also, our code assumed that "node" has to be a data node (not
    presentation node), but it seems the only way this condition can be true
    if presentation children is also counted. (The presentation node in
    question is not a presentation of anything.)
    
    Change-Id: I094b44351aeb8058cd50753f46fcdac7a88b35cd
    Reviewed-on: https://gerrit.libreoffice.org/67510
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index edc87ca7b0ce..2b17bee2a65d 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -370,6 +370,14 @@ sal_Int32 ConditionAtom::getNodeCount() const
                 if (aCxn.mnType == XML_parOf && aCxn.msSourceId == sNodeId)
                     nCount++;
         }
+        else
+        {
+            // No presentation child is a presentation of a model node: just
+            // count presentation children.
+            for (const auto& aCxn : mrLayoutNode.getDiagram().getData()->getConnections())
+                if (aCxn.mnType == XML_presParOf && aCxn.msSourceId == pPoint->msModelId)
+                    nCount++;
+        }
     }
     return nCount;
 }
diff --git a/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx b/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx
new file mode 100644
index 000000000000..0815df945b6d
Binary files /dev/null and b/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx differ
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 54dd57bc8615..22eda8b7f74d 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -66,6 +66,7 @@ public:
     void testAccentProcess();
     void testContinuousBlockProcess();
     void testOrgChart();
+    void testCycleMatrix();
 
     CPPUNIT_TEST_SUITE(SdImportTestSmartArt);
 
@@ -97,6 +98,7 @@ public:
     CPPUNIT_TEST(testAccentProcess);
     CPPUNIT_TEST(testContinuousBlockProcess);
     CPPUNIT_TEST(testOrgChart);
+    CPPUNIT_TEST(testCycleMatrix);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -812,6 +814,27 @@ void SdImportTestSmartArt::testOrgChart()
     xDocShRef->DoClose();
 }
 
+void SdImportTestSmartArt::testCycleMatrix()
+{
+    sd::DrawDocShellRef xDocShRef = loadURL(
+        m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx"), PPTX);
+    uno::Reference<drawing::XShape> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xGroup.is());
+
+    uno::Reference<text::XText> xA1(getChildShape(getChildShape(xGroup, 1), 0), uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xA1.is());
+    CPPUNIT_ASSERT_EQUAL(OUString("A1"), xA1->getString());
+
+    // Without the accompanying fix in place, this test would have failed: the
+    // content of the "A2" shape was lost.
+    uno::Reference<text::XText> xA2(getChildShape(getChildShape(getChildShape(xGroup, 0), 0), 1),
+                                    uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xA2.is());
+    CPPUNIT_ASSERT_EQUAL(OUString("A2"), xA2->getString());
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list