[Libreoffice-commits] core.git: svx/CppunitTest_svx_unit.mk svx/qa svx/source
Regina Henschel (via logerrit)
logerrit at kemper.freedesktop.org
Tue Mar 16 23:07:45 UTC 2021
svx/CppunitTest_svx_unit.mk | 1
svx/qa/unit/customshapes.cxx | 37 ++++++++++++++++++++++++++
svx/qa/unit/data/tdf141021_ExtrusionNorth.odp |binary
svx/source/toolbars/extrusionbar.cxx | 2 -
4 files changed, 39 insertions(+), 1 deletion(-)
New commits:
commit fa8d00560bbfededec7f2c328f04eb2b369c00e2
Author: Regina Henschel <rb.henschel at t-online.de>
AuthorDate: Sun Mar 14 16:26:22 2021 +0100
Commit: Regina Henschel <rb.henschel at t-online.de>
CommitDate: Wed Mar 17 00:06:57 2021 +0100
tdf#141021 Correct sign in Origin in Extrusion North
This is about customs shapes in 3D mode using direction floater.
Shapes, which were created with older versions, keep their values until
the direction is newly assigned. So the change will not automatically
change existing documents.
Change-Id: Ib1ce511de0f524bf59279fb4e976f66ed65bc080
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112474
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel at t-online.de>
diff --git a/svx/CppunitTest_svx_unit.mk b/svx/CppunitTest_svx_unit.mk
index 892490265261..598d788392b4 100644
--- a/svx/CppunitTest_svx_unit.mk
+++ b/svx/CppunitTest_svx_unit.mk
@@ -39,6 +39,7 @@ $(eval $(call gb_CppunitTest_use_libraries,svx_unit, \
editeng \
sal \
sfx \
+ svl \
svxcore \
svx \
tl \
diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 271a7aad6f19..4e3f76db74ec 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -18,9 +18,16 @@
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/point/b2dpoint.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/viewsh.hxx>
+#include <svl/intitem.hxx>
#include <svx/EnhancedCustomShape2d.hxx>
+#include <svx/extrusionbar.hxx>
#include <svx/svdoashp.hxx>
#include <svx/svdopath.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svxids.hrc>
#include <svx/unoapi.hxx>
#include <unotools/mediadescriptor.hxx>
#include <unotools/tempfile.hxx>
@@ -120,6 +127,36 @@ void lcl_AssertRectEqualWithTolerance(std::string_view sInfo, const tools::Recta
std::abs(rExpected.GetHeight() - rActual.GetHeight()) <= nTolerance);
}
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf141021ExtrusionNorth)
+{
+ // tdf#141021 Setting extrusion direction in projection method 'perspective' to
+ // 'Extrusion North' had used a wrong origin for the ViewPoint and thus the
+ // side faces were wrong calculated.
+
+ // Load document and get shape. It is a custom shape in 3D mode.
+ OUString aURL = m_directories.getURLFromSrc(sDataDirectory) + "tdf141021_ExtrusionNorth.odp";
+ mxComponent = loadFromDesktop(aURL, "com.sun.star.comp.presentation.PresentationDocument");
+ CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
+ uno::Reference<drawing::XShape> xShape(getShape(0));
+ SdrObjCustomShape& rSdrCustomShape(
+ static_cast<SdrObjCustomShape&>(*GetSdrObjectFromXShape(xShape)));
+
+ // Mark Object
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ SdrView* pSdrView = pViewShell->GetDrawView();
+ pSdrView->MarkObj(&rSdrCustomShape, pSdrView->GetSdrPageView());
+
+ // Set direction
+ SfxRequest aReq(pViewShell->GetViewFrame(), SID_EXTRUSION_DIRECTION);
+ SfxInt32Item aItem(SID_EXTRUSION_DIRECTION, 90);
+ aReq.AppendItem(aItem);
+ svx::ExtrusionBar::execute(pSdrView, aReq, SfxViewFrame::Current()->GetBindings());
+
+ // Verify height. Without the fix in place the height would 4001.
+ tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect());
+ CPPUNIT_ASSERT_EQUAL(tools::Long(5895), aBoundRect.GetHeight());
+}
+
CPPUNIT_TEST_FIXTURE(CustomshapesTest, testResizeRotatedShape)
{
// tdf#138945 Setting width or height for a rotated or sheared shape in the Position&Size dialog
diff --git a/svx/qa/unit/data/tdf141021_ExtrusionNorth.odp b/svx/qa/unit/data/tdf141021_ExtrusionNorth.odp
new file mode 100644
index 000000000000..559b2c0d58e0
Binary files /dev/null and b/svx/qa/unit/data/tdf141021_ExtrusionNorth.odp differ
diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx
index 011da2175e93..82d42ddb81ef 100644
--- a/svx/source/toolbars/extrusionbar.cxx
+++ b/svx/source/toolbars/extrusionbar.cxx
@@ -197,7 +197,7 @@ static void impl_execute( SfxRequest const & rReq, SdrCustomShapeGeometryItem& r
aViewPoint.PositionX = 0;
aViewPoint.PositionY = 3472;
fOriginX = 0;
- fOriginY = -0.50;
+ fOriginY = 0.50;
break;
case 45:
aViewPoint.PositionX = -3472;
More information about the Libreoffice-commits
mailing list