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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jul 25 13:01:20 UTC 2018


 oox/source/ppt/timenodelistcontext.cxx |   44 ++++++++++++++++++++++-----------
 sd/qa/unit/data/pptx/tdf50499.pptx     |binary
 sd/qa/unit/export-tests-ooxml2.cxx     |    2 -
 sd/qa/unit/export-tests.cxx            |   17 ++++++++++++
 4 files changed, 48 insertions(+), 15 deletions(-)

New commits:
commit d459f4c92e7bbb7e031b8cbba395d4767ecf344e
Author:     Mark Hung <marklh9 at gmail.com>
AuthorDate: Sat Jul 14 13:57:13 2018 +0800
Commit:     Mark Hung <marklh9 at gmail.com>
CommitDate: Wed Jul 25 15:00:52 2018 +0200

    tdf#50499 convert by, from, and to of AnimContext.
    
    Also change testTdf104788 because the expected value
    is taken as a double and decimal places are omitted
    if there isn't any.
    
    Change-Id: I16cb363b1ce0ff09da2df361849d47819bf9ced4
    Reviewed-on: https://gerrit.libreoffice.org/57413
    Tested-by: Jenkins
    Reviewed-by: Mark Hung <marklh9 at gmail.com>

diff --git a/oox/source/ppt/timenodelistcontext.cxx b/oox/source/ppt/timenodelistcontext.cxx
index b286acdd6d94..3268ba2c15df 100644
--- a/oox/source/ppt/timenodelistcontext.cxx
+++ b/oox/source/ppt/timenodelistcontext.cxx
@@ -543,27 +543,40 @@ namespace oox { namespace ppt {
                     }
                     aProps[ NP_CALCMODE ] <<= nEnum;
                 }
-                OUString aStr;
-                aStr = xAttribs->getOptionalValue( XML_from );
-                if( !aStr.isEmpty() )
+
+                msFrom = xAttribs->getOptionalValue(XML_from);
+                msTo = xAttribs->getOptionalValue(XML_to);
+                msBy = xAttribs->getOptionalValue(XML_by);
+
+                mnValueType = xAttribs->getOptionalValueToken( XML_valueType, 0 );
+            }
+
+        virtual ~AnimContext() throw () override
+            {
+                if (!msFrom.isEmpty())
                 {
-                    pNode->setFrom( makeAny( aStr ) );
+                    css::uno::Any aAny;
+                    aAny <<= msFrom;
+                    convertAnimationValueWithTimeNode(mpNode, aAny);
+                    mpNode->setFrom(aAny);
                 }
-                aStr = xAttribs->getOptionalValue( XML_by );
-                if( !aStr.isEmpty() )
+
+                if (!msTo.isEmpty())
                 {
-                    pNode->setBy( makeAny( aStr ) );
+                    css::uno::Any aAny;
+                    aAny <<= msTo;
+                    convertAnimationValueWithTimeNode(mpNode, aAny);
+                    mpNode->setTo(aAny);
                 }
-                aStr = xAttribs->getOptionalValue( XML_to );
-                if( !aStr.isEmpty() )
+
+                if (!msBy.isEmpty())
                 {
-                    pNode->setTo( makeAny( aStr ) );
+                    css::uno::Any aAny;
+                    aAny <<= msBy;
+                    convertAnimationValueWithTimeNode(mpNode, aAny);
+                    mpNode->setBy(aAny);
                 }
-                mnValueType = xAttribs->getOptionalValueToken( XML_valueType, 0 );
-            }
 
-        virtual ~AnimContext() throw () override
-            {
                 int nKeyTimes = maTavList.size();
                 if( nKeyTimes > 0)
                 {
@@ -613,6 +626,9 @@ namespace oox { namespace ppt {
     private:
         sal_Int32              mnValueType;
         TimeAnimationValueList maTavList;
+        OUString msFrom;
+        OUString msTo;
+        OUString msBy;
     };
 
     /** CT_TLAnimateScaleBehavior */
diff --git a/sd/qa/unit/data/pptx/tdf50499.pptx b/sd/qa/unit/data/pptx/tdf50499.pptx
new file mode 100755
index 000000000000..2cdcbfa98434
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf50499.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 6201053df0ad..26b5c4a8937c 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -1291,7 +1291,7 @@ void SdOOXMLExportTest2::testTdf104788()
     xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide6.xml");
 
     OUString sVal = getXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[2]/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:anim[2]", "to");
-    CPPUNIT_ASSERT_EQUAL(OUString("-1.0"), sVal);
+    CPPUNIT_ASSERT_EQUAL(-1.0, sVal.toDouble());
 
     OUString sAttributeName = getXPathContent(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[2]/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:anim[2]/p:cBhvr/p:attrNameLst/p:attrName");
     CPPUNIT_ASSERT_EQUAL(OUString("xshear"), sAttributeName);
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 71509ca61eea..b34cbb9aca9f 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -95,6 +95,7 @@ public:
     void testEmbeddedText();
     void testTdf98477();
     void testAuthorField();
+    void testTdf50499();
     void testTdf100926();
     void testPageWithTransparentBackground();
     void testTextRotation();
@@ -122,6 +123,7 @@ public:
     CPPUNIT_TEST(testEmbeddedText);
     CPPUNIT_TEST(testTdf98477);
     CPPUNIT_TEST(testAuthorField);
+    CPPUNIT_TEST(testTdf50499);
     CPPUNIT_TEST(testTdf100926);
     CPPUNIT_TEST(testPageWithTransparentBackground);
     CPPUNIT_TEST(testTextRotation);
@@ -880,6 +882,21 @@ void SdExportTest::testAuthorField()
     xDocShRef->DoClose();
 }
 
+void SdExportTest::testTdf50499()
+{
+    utl::TempFile tempFile;
+    sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf50499.pptx"), PPTX);
+
+    xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile);
+
+    xmlDocPtr pXmlDoc = parseExport(tempFile, "content.xml");
+    assertXPath(pXmlDoc, "//anim:animate[1]", "from", "(-width/2)");
+    assertXPath(pXmlDoc, "//anim:animate[1]", "to", "(x)");
+    assertXPath(pXmlDoc, "//anim:animate[3]", "by", "(height/3+width*0.1)");
+
+    xDocShRef->DoClose();
+}
+
 void SdExportTest::testTdf100926()
 {
     sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf100926_ODP.pptx"), PPTX);


More information about the Libreoffice-commits mailing list