[Libreoffice-commits] core.git: sd/qa svx/source
Regina Henschel (via logerrit)
logerrit at kemper.freedesktop.org
Sat Feb 29 12:10:56 UTC 2020
sd/qa/unit/data/tdf130988_3D_create_lathe.odg |binary
sd/qa/unit/misc-tests.cxx | 26 ++++++++++++++++++++++++++
svx/source/engine3d/view3d.cxx | 5 +++++
3 files changed, 31 insertions(+)
New commits:
commit 946eb391028284ca1b0b9927891a8e21c1c478f9
Author: Regina Henschel <rb.henschel at t-online.de>
AuthorDate: Fri Feb 28 18:09:34 2020 +0100
Commit: Regina Henschel <rb.henschel at t-online.de>
CommitDate: Sat Feb 29 13:10:24 2020 +0100
tdf#130988 add y-axis up<->down in create 3D obj
Creating the matrix aLatheMat uses a coordinate system with y-axis
pointing up, but aPolyPoly2D and ctor of E3dLatheObj uses y-axis
pointing down. Converting was missing. The error was inherited
from OOo2.
Change-Id: Id5b2f769b8f940bd0028d0386d7ce8b80bf17b97
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89730
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel at t-online.de>
diff --git a/sd/qa/unit/data/tdf130988_3D_create_lathe.odg b/sd/qa/unit/data/tdf130988_3D_create_lathe.odg
new file mode 100644
index 000000000000..e2b37ef60235
Binary files /dev/null and b/sd/qa/unit/data/tdf130988_3D_create_lathe.odg differ
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index 852cdc03ece6..6871b2d432e3 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -55,6 +55,8 @@
#include <vcl/keycodes.hxx>
#include <svx/svdoashp.hxx>
#include <tools/gen.hxx>
+#include <svx/view3d.hxx>
+#include <svx/scene3d.hxx>
using namespace ::com::sun::star;
@@ -78,6 +80,7 @@ public:
void testTdf119956();
void testTdf120527();
void testTdf98839_ShearVFlipH();
+ void testTdf130988();
CPPUNIT_TEST_SUITE(SdMiscTest);
CPPUNIT_TEST(testTdf96206);
@@ -96,6 +99,7 @@ public:
CPPUNIT_TEST(testTdf119956);
CPPUNIT_TEST(testTdf120527);
CPPUNIT_TEST(testTdf98839_ShearVFlipH);
+ CPPUNIT_TEST(testTdf130988);
CPPUNIT_TEST_SUITE_END();
virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -802,6 +806,28 @@ void SdMiscTest::testTdf98839_ShearVFlipH()
xDocShRef->DoClose();
}
+void SdMiscTest::testTdf130988()
+{
+ const OUString sURL("sd/qa/unit/data/tdf130988_3D_create_lathe.odg");
+ sd::DrawDocShellRef xDocShRef = Load(m_directories.getURLFromSrc(sURL), ODG);
+
+ //emulate command .uno:ConvertInto3DLathe
+ sd::ViewShell* pViewShell = xDocShRef->GetViewShell();
+ E3dView* pView = dynamic_cast<E3dView*>(pViewShell->GetView());
+ pView->MarkNextObj();
+ pView->ConvertMarkedObjTo3D(false, basegfx::B2DPoint(8000.0, -3000.0), basegfx::B2DPoint(3000.0, -8000.0));
+ E3dScene* pObj = dynamic_cast<E3dScene*>(pView->GetMarkedObjectByIndex(0));
+ CPPUNIT_ASSERT(pObj);
+
+ // Error was, that the created 3D object had a wrong path. Instead examining
+ // the path directly, I use the scene distance, because that is easier. The
+ // scene distance is calculated from the object while creating.
+ const double fDistance = pObj->GetDistance();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("D3DSceneDistance", 7071.0, fDistance, 0.5);
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdMiscTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index 4d7e13897166..c756c90439c8 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -737,8 +737,13 @@ void E3dView::ImpCreateSingle3DObjectFlat(E3dScene* pScene, SdrObject* pObj, boo
}
else
{
+ // rLatheMat expects coordinates with y-axis up, pPath uses y-axis down
+ basegfx::B2DHomMatrix aFlipVerticalMat(1.0, 0.0, 0.0, 0.0, -1.0, 0.0);
basegfx::B2DPolyPolygon aPolyPoly2D(pPath->GetPathPoly());
+ aPolyPoly2D.transform(aFlipVerticalMat);
aPolyPoly2D.transform(rLatheMat);
+ // ctor E3dLatheObj expects coordinates with y-axis down
+ aPolyPoly2D.transform(aFlipVerticalMat);
p3DObj = new E3dLatheObj(pObj->getSdrModelFromSdrObject(), aDefault, aPolyPoly2D);
}
More information about the Libreoffice-commits
mailing list