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@t-online.de>
This commit is contained in:
Regina Henschel
2021-03-17 00:06:57 +01:00
parent 5aef0085ca
commit fa8d00560b
4 changed files with 39 additions and 1 deletions
+1
View File
@@ -39,6 +39,7 @@ $(eval $(call gb_CppunitTest_use_libraries,svx_unit, \
editeng \
sal \
sfx \
svl \
svxcore \
svx \
tl \
+37
View File
@@ -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
Binary file not shown.
+1 -1
View File
@@ -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;