diff options
-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 e3a5e0ac92a3..db7808a16f2f 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> @@ -117,6 +124,36 @@ void lcl_AssertRectEqualWithTolerance(const OString& sInfo, const tools::Rectang 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 5297f304b7bf..cffcaa3836fa 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; |