tdf#139968 first shear then rotate point of arc
All internal calculation for transformation use the order resize, shear, rotate, translate. Thus the transformation of the points determining the angles of non-full SdrCircObj need to use that order too. Change-Id: If05310c64813bcffa410a328cf831b3f0b4c07e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198630 Reviewed-by: Regina Henschel <rb.henschel@t-online.de> Tested-by: Jenkins
This commit is contained in:
@@ -10,6 +10,9 @@
|
||||
#include <test/unoapi_test.hxx>
|
||||
#include <rtl/ustring.hxx>
|
||||
#include <editeng/unoprnms.hxx>
|
||||
#include <svx/svdocirc.hxx>
|
||||
#include <sfx2/viewsh.hxx>
|
||||
#include <svx/svdview.hxx>
|
||||
|
||||
#include <cppunit/TestAssert.h>
|
||||
|
||||
@@ -187,5 +190,30 @@ CPPUNIT_TEST_FIXTURE(ClassicshapesTest, testTdf130076Flip)
|
||||
26000.0, nAngle2);
|
||||
}
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(ClassicshapesTest, testTdf139968ShearRotateArcFlip)
|
||||
{
|
||||
// The document contains an arc that is rotated and sheared. When horizonally flipped, start and
|
||||
// end angles had got wrong values.
|
||||
loadFromFile(u"tdf139968_shear45_rot30.odg");
|
||||
|
||||
// get shape and flip it
|
||||
uno::Reference<drawing::XShape> xShape(getShape(0, 0));
|
||||
SdrCircObj* pSdrCircObj(static_cast<SdrCircObj*>(SdrObject::getSdrObjectFromXShape(xShape)));
|
||||
SfxViewShell* pViewShell = SfxViewShell::Current();
|
||||
CPPUNIT_ASSERT(pViewShell);
|
||||
SdrView* pSdrView = pViewShell->GetDrawView();
|
||||
pSdrView->MarkObj(pSdrCircObj, pSdrView->GetSdrPageView());
|
||||
dispatchCommand(mxComponent, u".uno:FlipHorizontal"_ustr, {});
|
||||
|
||||
// make sure start and end angle are correct.
|
||||
double fAngleS(0.0), fAngleE(0.0);
|
||||
uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY);
|
||||
CPPUNIT_ASSERT(xShapeProps->getPropertyValue(u"CircleStartAngle"_ustr) >>= fAngleS);
|
||||
CPPUNIT_ASSERT(xShapeProps->getPropertyValue(u"CircleEndAngle"_ustr) >>= fAngleE);
|
||||
// without fix, start angle was 19419, end angle was 18176. Tolerance for to ignore round errors.
|
||||
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("StartAngle wrong", 22500.0, fAngleS, 2.0);
|
||||
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("EndAngle wrong", 18000.0, fAngleE, 2.0);
|
||||
}
|
||||
}
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
Binary file not shown.
@@ -901,16 +901,16 @@ void SdrCircObj::NbcMirror(const Point& rRef1, const Point& rRef2)
|
||||
if (nWdt==0) aTmpPt2.setX(0 );
|
||||
if (nHgt==0) aTmpPt2.setY(0 );
|
||||
aTmpPt2+=aCenter;
|
||||
if (maGeo.m_nRotationAngle)
|
||||
{
|
||||
RotatePoint(aTmpPt1, getRectangle().TopLeft(), maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle);
|
||||
RotatePoint(aTmpPt2, getRectangle().TopLeft(), maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle);
|
||||
}
|
||||
if (maGeo.m_nShearAngle)
|
||||
{
|
||||
ShearPoint(aTmpPt1, getRectangle().TopLeft(), maGeo.mfTanShearAngle);
|
||||
ShearPoint(aTmpPt2, getRectangle().TopLeft(), maGeo.mfTanShearAngle);
|
||||
}
|
||||
if (maGeo.m_nRotationAngle)
|
||||
{
|
||||
RotatePoint(aTmpPt1, getRectangle().TopLeft(), maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle);
|
||||
RotatePoint(aTmpPt2, getRectangle().TopLeft(), maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle);
|
||||
}
|
||||
}
|
||||
SdrTextObj::NbcMirror(rRef1,rRef2);
|
||||
if (meCircleKind!=SdrCircKind::Full) { // adapt starting and finishing angle
|
||||
|
||||
Reference in New Issue
Block a user