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

Grzegorz Araminowicz g.araminowicz at gmail.com
Fri Aug 11 16:19:45 UTC 2017


 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |    6 +++++-
 sd/qa/unit/data/pptx/smartart-text.pptx             |binary
 sd/qa/unit/import-tests.cxx                         |   17 +++++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 4b149e04ca37056642badab9d18c51857d52e946
Author: Grzegorz Araminowicz <g.araminowicz at gmail.com>
Date:   Wed Aug 9 12:27:36 2017 +0200

    SmartArt: fix duplicated text
    
    in some diagrams there are two shapes for the same node - tx and sp
    sp should be just space, so remove text from it
    
    Change-Id: I832651918294bd458148a23d6cc1e59c545adc13
    Reviewed-on: https://gerrit.libreoffice.org/40913
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 79390b1a3792..c3cc7a0dc977 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -280,8 +280,12 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
         }
 
         case XML_sp:
-            // HACK. Handled one level higher. Or rather, planned to
+        {
+            // HACK: Handled one level higher. Or rather, planned to
+            // HACK: text should appear only in tx node; we're assigning it earlier, so let's remove it here
+            rShape->setTextBody(TextBodyPtr());
             break;
+        }
 
         case XML_tx:
         {
diff --git a/sd/qa/unit/data/pptx/smartart-text.pptx b/sd/qa/unit/data/pptx/smartart-text.pptx
new file mode 100755
index 000000000000..9656e4fab64d
Binary files /dev/null and b/sd/qa/unit/data/pptx/smartart-text.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 392369234d0a..ba1a44485f25 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -165,6 +165,7 @@ public:
     void testTdf109067();
     void testSmartArt1();
     void testSmartArtChildren();
+    void testSmartArtText();
     void testTdf109223();
     void testActiveXCheckbox();
     void testTdf109187();
@@ -240,6 +241,7 @@ public:
     CPPUNIT_TEST(testTdf109067);
     CPPUNIT_TEST(testSmartArt1);
     CPPUNIT_TEST(testSmartArtChildren);
+    CPPUNIT_TEST(testSmartArtText);
     CPPUNIT_TEST(testTdf109223);
     CPPUNIT_TEST(testActiveXCheckbox);
     CPPUNIT_TEST(testTdf109187);
@@ -2301,6 +2303,21 @@ void SdImportTest::testSmartArtChildren()
     xDocShRef->DoClose();
 }
 
+void SdImportTest::testSmartArtText()
+{
+    sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/smartart-text.pptx"), PPTX);
+    uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShapes> xShapeGroup2(xShapeGroup->getByIndex(0), uno::UNO_QUERY_THROW);
+
+    uno::Reference<text::XText> xText0(xShapeGroup2->getByIndex(0), uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT(xText0->getString().isEmpty());
+
+    uno::Reference<text::XText> xText1(xShapeGroup2->getByIndex(1), uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_EQUAL(OUString("test"), xText1->getString());
+
+    xDocShRef->DoClose();
+}
+
 void SdImportTest::testTdf109223()
 {
     // In the test document flipV attribute is defined for a group shape


More information about the Libreoffice-commits mailing list