svx/qa/unit/customshapes.cxx                            |   73 ++++++++++++++++
 svx/qa/unit/data/tdf148714_CurvedArrows.ppt             |binary
 svx/source/customshapes/EnhancedCustomShapeGeometry.cxx |   12 +-
 3 files changed, 81 insertions(+), 4 deletions(-)

New commits:
commit 4cfe46997eab3498cc519ef94c85ad2d644d3886
Author:     Regina Henschel <rb.hensc...@t-online.de>
AuthorDate: Thu Apr 28 23:35:44 2022 +0200
Commit:     Regina Henschel <rb.hensc...@t-online.de>
CommitDate: Fri Apr 29 07:27:48 2022 +0200

    tdf#148714 connect first and second arc with arcTo
    
    The curved*Arrows start with two arcs, which should be connected by a
    line. The used commands are double V and double B respectively. Both
    have an implicit moveTo, so that there should be no line between.
    Other applications show the shapes correctly without line. But because
    of bug 148714 LO shows a connecting line so that the error was not
    earlier detected.
    The patch changes the segment definition so that for the second
    command the variant with implicit lineTo is used. This does not change
    rendering in LO but makes other applications rendering the shapes
    like LO.
    
    Change-Id: I4f799f89497e52b1a7e00d8e5345a66ce21c00a1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133586
    Tested-by: Jenkins
    Reviewed-by: Regina Henschel <rb.hensc...@t-online.de>

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index fc671384e0c8..62e7728f7556 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -39,6 +39,8 @@
 
 #include <com/sun/star/awt/Rectangle.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
 #include <com/sun/star/drawing/GraphicExportFilter.hpp>
 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
 #include <com/sun/star/drawing/XDrawPage.hpp>
@@ -1304,6 +1306,77 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf148501_OctagonBevel)
     nColorDistance = aExpectedColor.GetColorError(aActualColor);
     CPPUNIT_ASSERT_LESS(sal_uInt16(6), nColorDistance);
 }
+
+bool lcl_getShapeSegments(uno::Sequence<drawing::EnhancedCustomShapeSegment>& 
rSegments,
+                          const uno::Reference<drawing::XShape>& xShape)
+{
+    uno::Reference<beans::XPropertySet> xShapeProps(xShape, 
uno::UNO_QUERY_THROW);
+    uno::Any anotherAny = xShapeProps->getPropertyValue("CustomShapeGeometry");
+    uno::Sequence<beans::PropertyValue> aCustomShapeGeometry;
+    if (!(anotherAny >>= aCustomShapeGeometry))
+        return false;
+    uno::Sequence<beans::PropertyValue> aPathProps;
+    for (beans::PropertyValue const& rProp : 
std::as_const(aCustomShapeGeometry))
+    {
+        if (rProp.Name == "Path")
+        {
+            rProp.Value >>= aPathProps;
+            break;
+        }
+    }
+
+    for (beans::PropertyValue const& rProp : std::as_const(aPathProps))
+    {
+        if (rProp.Name == "Segments")
+        {
+            rProp.Value >>= rSegments;
+            break;
+        }
+    }
+    if (rSegments.getLength() > 2)
+        return true;
+    else
+        return false;
+}
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf148714_CurvedArrows)
+{
+    // Error was, that the line between 1. and 2. arc was missing.
+    OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + 
"tdf148714_CurvedArrows.ppt";
+    mxComponent = loadFromDesktop(sURL, 
"com.sun.star.presentation.PresentationDocument");
+
+    for (sal_Int32 nShapeIndex = 0; nShapeIndex < 4; nShapeIndex++)
+    {
+        uno::Reference<drawing::XShape> xShape(getShape(nShapeIndex));
+        uno::Sequence<drawing::EnhancedCustomShapeSegment> aSegments;
+        CPPUNIT_ASSERT(lcl_getShapeSegments(aSegments, xShape));
+
+        if (nShapeIndex == 0 || nShapeIndex == 3)
+        {
+            // curvedDownArrow or curvedLeftArrow. Segments should start with 
VW. Without fix it was
+            // V with count 2, which means VV.
+            CPPUNIT_ASSERT_EQUAL(
+                
sal_Int16(drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC),
+                aSegments[0].Command);
+            CPPUNIT_ASSERT_EQUAL(sal_Int16(1), aSegments[0].Count);
+            CPPUNIT_ASSERT_EQUAL(
+                
sal_Int16(drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO),
+                aSegments[1].Command);
+            CPPUNIT_ASSERT_EQUAL(sal_Int16(1), aSegments[1].Count);
+        }
+        else
+        {
+            // curvedUpArrow or curvedRightArrow. Segments should start with 
BA. Without fix is was
+            // B with count 2, which means BB.
+            
CPPUNIT_ASSERT_EQUAL(sal_Int16(drawing::EnhancedCustomShapeSegmentCommand::ARC),
+                                 aSegments[0].Command);
+            CPPUNIT_ASSERT_EQUAL(sal_Int16(1), aSegments[0].Count);
+            
CPPUNIT_ASSERT_EQUAL(sal_Int16(drawing::EnhancedCustomShapeSegmentCommand::ARCTO),
+                                 aSegments[1].Command);
+            CPPUNIT_ASSERT_EQUAL(sal_Int16(1), aSegments[1].Count);
+        }
+    }
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf148714_CurvedArrows.ppt 
b/svx/qa/unit/data/tdf148714_CurvedArrows.ppt
new file mode 100644
index 000000000000..23e4ed0ad3eb
Binary files /dev/null and b/svx/qa/unit/data/tdf148714_CurvedArrows.ppt differ
diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx 
b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
index 7539bfd8015e..0f999ed42209 100644
--- a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
@@ -1199,7 +1199,8 @@ const SvxMSDffVertPair mso_sptCurvedRightVert[] =
 };
 const sal_uInt16 mso_sptCurvedRightSegm[] =
 {
-    0xa408,
+    0xa404,
+    0xa304,
     0x0003,
     0xa508,
     0x6000,
@@ -1309,7 +1310,8 @@ const SvxMSDffVertPair mso_sptCurvedDownVert[] =
 };
 const sal_uInt16 mso_sptCurvedDownSegm[] =
 {
-    0xa608,
+    0xa604,
+    0xa504,
     0x0003,
     0xa308,
     0x6000,
@@ -1364,7 +1366,8 @@ const SvxMSDffVertPair mso_sptCurvedUpVert[] =
 };
 const sal_uInt16 mso_sptCurvedUpSegm[] =
 {
-   0xa408,
+   0xa404,
+   0xa304,
    0x0003,
    0xa508,
    0x6000,
@@ -1470,7 +1473,8 @@ const SvxMSDffVertPair mso_sptCurvedLeftVert[] =
 };
 const sal_uInt16 mso_sptCurvedLeftSegm[] =
 {
-   0xa608,
+   0xa604,
+   0xa504,
    0x0003,
    0xa308,
    0x6000,

Reply via email to