[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sd/qa svx/source

Mike Kaganski mike.kaganski at collabora.com
Sat Nov 5 07:22:19 UTC 2016


 sd/qa/unit/data/pptx/tdf103473.pptx |binary
 sd/qa/unit/import-tests.cxx         |   18 ++++++++++++++++++
 svx/source/svdraw/svdotext.cxx      |   14 +++++++-------
 3 files changed, 25 insertions(+), 7 deletions(-)

New commits:
commit 92d0b2bc79033e8f2cd70c298ad746b38b4eea03
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Sat Oct 29 15:31:29 2016 +0300

    tdf#103473: Ensure positive rectangle size
    
    Also remove conversion of both negative scales into rotation,
    because it is handled by flip; use strict comparison instead of
    approximate float less because it's correct here, and also because
    basegfx::fTools::less ultimately uses rtl_math_approxEqual, which
    description states: attention
    approxEqual( value!=0.0, 0.0 ) _never_ yields true.
    
    Unit test included.
    
    Change-Id: Ia878fce360cf8aed539d95f2d4a1a3ad94379978
    Reviewed-on: https://gerrit.libreoffice.org/30373
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    (cherry picked from commit 1c708eee636c0cdf3da2ec62849618f3262044bc)
    Reviewed-on: https://gerrit.libreoffice.org/30378

diff --git a/sd/qa/unit/data/pptx/tdf103473.pptx b/sd/qa/unit/data/pptx/tdf103473.pptx
new file mode 100644
index 0000000..5b31b76
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf103473.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 93dca4c..da809a2 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -122,6 +122,7 @@ public:
     void testTdf95932();
     void testTdf99030();
     void testTdf49561();
+    void testTdf103473();
 
     CPPUNIT_TEST_SUITE(SdImportTest);
 
@@ -172,6 +173,7 @@ public:
     CPPUNIT_TEST(testTdf95932);
     CPPUNIT_TEST(testTdf99030);
     CPPUNIT_TEST(testTdf49561);
+    CPPUNIT_TEST(testTdf103473);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -1406,6 +1408,22 @@ void SdImportTest::testTdf49561()
     xDocShRef->DoClose();
 }
 
+void SdImportTest::testTdf103473()
+{
+    sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf103473.pptx"), PPTX);
+
+    const SdrPage *pPage = GetPage(1, xDocShRef);
+    SdrTextObj *const pObj = dynamic_cast<SdrTextObj *const>(pPage->GetObj(0));
+    CPPUNIT_ASSERT(pObj);
+    Rectangle aRect = pObj->GetGeoRect();
+    CPPUNIT_ASSERT_EQUAL(3629L, aRect.Left());
+    CPPUNIT_ASSERT_EQUAL(4431L, aRect.Top());
+    CPPUNIT_ASSERT_EQUAL(8353L, aRect.Right());
+    CPPUNIT_ASSERT_EQUAL(9155L, aRect.Bottom());
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 151ff79..b7ef71a 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1703,17 +1703,17 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
     double fShearX(0.0);
     rMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
 
-    // #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings
-    // in X and Y which equal a 180 degree rotation. Recognize it and react accordingly
-    if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0))
+    // flip?
+    bool bFlipX = aScale.getX() < 0.0,
+         bFlipY = aScale.getY() < 0.0;
+    if (bFlipX)
     {
         aScale.setX(fabs(aScale.getX()));
+    }
+    if (bFlipY)
+    {
         aScale.setY(fabs(aScale.getY()));
-        fRotate = fmod(fRotate + F_PI, F_2PI);
     }
-    // flip?
-    bool bFlipX = basegfx::fTools::less(aScale.getX(), 0.0),
-         bFlipY = basegfx::fTools::less(aScale.getY(), 0.0);
 
     // reset object shear and rotations
     aGeo.nRotationAngle = 0;


More information about the Libreoffice-commits mailing list