[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.4' - oox/source sd/qa

Andras Timar andras.timar at collabora.com
Wed Sep 2 07:01:38 PDT 2015


 oox/source/drawingml/transform2dcontext.cxx |    3 ++-
 sd/qa/unit/data/pptx/tdf93830.pptx          |binary
 sd/qa/unit/import-tests.cxx                 |   25 +++++++++++++++++++++++++
 3 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit ce4a43f6be7ad71acc9ab513cc5db20d5cf5f36a
Author: Andras Timar <andras.timar at collabora.com>
Date:   Tue Sep 1 10:46:42 2015 +0200

    tdf#93830 txXfrm offset workaround works in rounded rectangle case as well
    
    Reviewed-on: https://gerrit.libreoffice.org/18226
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    (cherry picked from commit cc88a88caad591270760d947848ad0a032d32bdb)
    
    Conflicts:
    	sd/qa/unit/import-tests.cxx
    
    Change-Id: I5d8df5c0d55e8dfd7c978b16b2b220c127f3dac9

diff --git a/oox/source/drawingml/transform2dcontext.cxx b/oox/source/drawingml/transform2dcontext.cxx
index 10bd727..3f4b35f 100644
--- a/oox/source/drawingml/transform2dcontext.cxx
+++ b/oox/source/drawingml/transform2dcontext.cxx
@@ -66,7 +66,8 @@ ContextHandlerRef Transform2DContext::onCreateContext( sal_Int32 aElementToken,
                     {
                         const OUString sXValue = rAttribs.getString( XML_x ).get();
                         const OUString sYValue = rAttribs.getString( XML_y ).get();
-                        if( !sXValue.isEmpty() && nType == XML_rect )
+
+                        if( !sXValue.isEmpty() )
                             mrShape.getTextBody()->getTextProperties().moTextOffLeft = GetCoordinate( sXValue.toInt32() - mrShape.getPosition().X );
                         if( !sYValue.isEmpty() )
                             mrShape.getTextBody()->getTextProperties().moTextOffUpper = GetCoordinate( sYValue.toInt32() - mrShape.getPosition().Y );
diff --git a/sd/qa/unit/data/pptx/tdf93830.pptx b/sd/qa/unit/data/pptx/tdf93830.pptx
new file mode 100644
index 0000000..8415daf
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf93830.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 6b2612c..b58aa3c 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -101,6 +101,7 @@ public:
     void testPDFImportSkipImages();
 #endif
     void testBnc910045();
+    void testTdf93830();
 
     CPPUNIT_TEST_SUITE(SdImportTest);
 
@@ -138,6 +139,7 @@ public:
     CPPUNIT_TEST(testPDFImportSkipImages);
 #endif
     CPPUNIT_TEST(testBnc910045);
+    CPPUNIT_TEST(testTdf93830);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -1147,6 +1149,29 @@ void SdImportTest::testBnc910045()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(5210557), nColor);
 }
 
+void SdImportTest::testTdf93830()
+{
+    // Text shape offset was ignored
+    sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/tdf93830.pptx"), PPTX);
+
+    uno::Reference< drawing::XDrawPagesSupplier > xDoc(
+        xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
+
+    uno::Reference< drawing::XDrawPage > xPage(
+        xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
+
+    // Get the first text box from group shape
+    uno::Reference< container::XIndexAccess > xShape( xPage->getByIndex(0), uno::UNO_QUERY );
+    uno::Reference< beans::XPropertySet > xPropSet( xShape->getByIndex(2), uno::UNO_QUERY );
+    CPPUNIT_ASSERT_MESSAGE( "no textbox shape", xPropSet.is() );
+
+    sal_Int32 nTextLeftDistance = 0;
+    xPropSet->getPropertyValue( "TextLeftDistance" ) >>= nTextLeftDistance;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(4152), nTextLeftDistance);
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list