summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2020-03-03 18:12:36 +0100
committerRegina Henschel <rb.henschel@t-online.de>2020-03-04 14:22:49 +0100
commita33484276ed16af7599a59653677f21f051c97e8 (patch)
treed2ccb2230de33eabee9a6b2bdbb1c4f5a99ceae0 /sd
parentbd1ef206d37eee556f5b4a0b1437b5c1b2d1a037 (diff)
tdf#131033 consider 20° tilt of 3D in 2D projection
Error was, that the default 20° tilt of a newly created 3D scene was not applied to the rectangle for the 2D projection and therefore the projection was not high enough. The used method is the same as used when dragging a scene to tilt it. I don't know whether there exists a simpler way. Change-Id: Ic9745cc17ed520cd9e00b123e235fe0e93100073 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89901 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/tdf131033_3D_SceneSizeIn2d.odgbin0 -> 9744 bytes
-rw-r--r--sd/qa/unit/misc-tests.cxx26
2 files changed, 26 insertions, 0 deletions
diff --git a/sd/qa/unit/data/tdf131033_3D_SceneSizeIn2d.odg b/sd/qa/unit/data/tdf131033_3D_SceneSizeIn2d.odg
new file mode 100644
index 000000000000..f6cfc96e6b12
--- /dev/null
+++ b/sd/qa/unit/data/tdf131033_3D_SceneSizeIn2d.odg
Binary files differ
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index 6871b2d432e3..3e23752aa477 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -81,6 +81,7 @@ public:
void testTdf120527();
void testTdf98839_ShearVFlipH();
void testTdf130988();
+ void testTdf131033();
CPPUNIT_TEST_SUITE(SdMiscTest);
CPPUNIT_TEST(testTdf96206);
@@ -100,6 +101,7 @@ public:
CPPUNIT_TEST(testTdf120527);
CPPUNIT_TEST(testTdf98839_ShearVFlipH);
CPPUNIT_TEST(testTdf130988);
+ CPPUNIT_TEST(testTdf131033);
CPPUNIT_TEST_SUITE_END();
virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -828,6 +830,30 @@ void SdMiscTest::testTdf130988()
xDocShRef->DoClose();
}
+void SdMiscTest::testTdf131033()
+{
+ const OUString sURL("sd/qa/unit/data/tdf131033_3D_SceneSizeIn2d.odg");
+ sd::DrawDocShellRef xDocShRef = Load(m_directories.getURLFromSrc(sURL), ODG);
+
+ // The document contains a polygon, so that emulate command .uno:ConvertInto3DLathe
+ // by direct call of ConvertMarkedObjTo3D works.
+ // It produces a rotation around a vertical axis, which is far away from the
+ // generating shape.
+ sd::ViewShell* pViewShell = xDocShRef->GetViewShell();
+ E3dView* pView = dynamic_cast<E3dView*>(pViewShell->GetView());
+ pView->MarkNextObj();
+ pView->ConvertMarkedObjTo3D(false, basegfx::B2DPoint(11000.0, -5000.0), basegfx::B2DPoint(11000.0, -9000.0));
+ E3dScene* pObj = dynamic_cast<E3dScene*>(pView->GetMarkedObjectByIndex(0));
+ CPPUNIT_ASSERT(pObj);
+
+ // Error was, that the 2D representation of the scene did not contain the default 20°
+ // rotation of the new scene around x-axis and therefore was not high enough.
+ const double fSnapRectHeight = pObj->GetSnapRect().getHeight();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("2D height", 7096.0, fSnapRectHeight, 1.0);
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdMiscTest);
CPPUNIT_PLUGIN_IMPLEMENT();