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

nd101 (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 1 08:21:00 UTC 2020


 oox/source/ppt/pptshape.cxx         |    4 +++-
 sd/qa/unit/data/pptx/tdf131554.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   11 +++++++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 69b83dc2d3014dd9b18402534e15c937dc082464
Author:     nd101 <Fong at nd.com.cn>
AuthorDate: Wed Mar 25 13:17:48 2020 +0800
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Wed Apr 1 10:20:26 2020 +0200

    tdf#131554 placeholder iteration fails to stop when a match is found
    
    Wrong placeholder is returned due to iteration not stopping
    when a match is found. It causes a text element position
    to be incorrectly set.
    
    Change-Id: I58be6825cec7a61f48b46418bdf28964c1afe4ce
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91023
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    Tested-by: Jenkins

diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 4f1350a7c7e8..a736afd66e27 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -420,6 +420,8 @@ namespace
 // 3. ph with nSecondSubType and the same oSubTypeIndex
 // 4. ph with nSecondSubType
 // 5. ph with the same oSubTypeIndex
+// It appears 3 and 1 has the same highest prority.
+
 oox::drawingml::ShapePtr PPTShape::findPlaceholder( sal_Int32 nFirstSubType, sal_Int32 nSecondSubType,
     const OptValue< sal_Int32 >& oSubTypeIndex, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly )
 {
@@ -469,7 +471,7 @@ oox::drawingml::ShapePtr PPTShape::findPlaceholder( sal_Int32 nFirstSubType, sal
                     aChoiceShapePtr3 = aChoiceShapePtr4;
             }
         }
-        if (aShapePtr.get())
+        if (aShapePtr.get() || aChoiceShapePtr2.get())
             break;
         ++aRevIter;
     }
diff --git a/sd/qa/unit/data/pptx/tdf131554.pptx b/sd/qa/unit/data/pptx/tdf131554.pptx
new file mode 100644
index 000000000000..a65f423add39
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf131554.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 2befeb024d9b..fa555e9c57b5 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -183,6 +183,7 @@ public:
     void testTdf127379();
     void testTdf98603();
     void testShapeGlowEffect();
+    void testTdf131554();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -284,6 +285,7 @@ public:
     CPPUNIT_TEST(testTdf127379);
     CPPUNIT_TEST(testTdf98603);
     CPPUNIT_TEST(testShapeGlowEffect);
+    CPPUNIT_TEST(testTdf131554);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -2651,6 +2653,15 @@ void SdOOXMLExportTest2::testShapeGlowEffect()
     CPPUNIT_ASSERT_EQUAL(Color(0xFFC000), nColor);
 }
 
+void SdOOXMLExportTest2::testTdf131554()
+{
+    ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf131554.pptx"), PPTX);
+    xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
+    uno::Reference<drawing::XShape> xShape(getShapeFromPage(1, 0, xDocShRef), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(5622), xShape->getPosition().X);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(13251), xShape->getPosition().Y);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list