diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2021-03-14 16:26:22 +0100 |
---|---|---|
committer | Regina Henschel <rb.henschel@t-online.de> | 2021-03-17 00:06:57 +0100 |
commit | fa8d00560bbfededec7f2c328f04eb2b369c00e2 (patch) | |
tree | 748b8266b56841b018a6121ca0385a8533c94453 | |
parent | 5aef0085cadb03c5c6b64747cf0ea76657a3a2ca (diff) |
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>
-rw-r--r-- | svx/CppunitTest_svx_unit.mk | 1 | ||||
-rw-r--r-- | svx/qa/unit/customshapes.cxx | 37 | ||||
-rw-r--r-- | svx/qa/unit/data/tdf141021_ExtrusionNorth.odp | bin | 0 -> 14261 bytes | |||
-rw-r--r-- | svx/source/toolbars/extrusionbar.cxx | 2 |
4 files changed, 39 insertions, 1 deletions
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 Binary files differnew file mode 100644 index 000000000000..559b2c0d58e0 --- /dev/null +++ b/svx/qa/unit/data/tdf141021_ExtrusionNorth.odp 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; |