diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2021-04-27 11:44:48 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2021-04-29 16:05:53 +0200 |
commit | b71d9a6d15cfb8a50afdea5ac064f40d84c561f8 (patch) | |
tree | 3a9bd3205754d28f411257e0207295a781451d6d /sd/qa/unit | |
parent | 5d4e450a7d64d3dc1caf34544dbfa35f4641d5c3 (diff) |
do not apply line dashing in drawinglayer (tdf#136957)
basegfx::utils::applyLineDashing() is not as good as the actual
VCL backend dashing, and there are some rounding errors because of
all the canvas transformation matrices or whatever, which leads
to the drawing problem. So use LineInfo to carry the dashing
information.
As a part of this change, also make LineInfo use doubles instead
of ints. The use of transformation matrices means that the values
may be fractional and less than one.
Change-Id: Ia5ac7d266cab344b7137052c81fbd96c1ce28003
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114710
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sd/qa/unit')
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 6 | ||||
-rw-r--r-- | sd/qa/unit/uiimpress.cxx | 24 |
2 files changed, 8 insertions, 22 deletions
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 7d3acad7ab04..6c12ac08928c 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -2854,10 +2854,10 @@ void SdOOXMLExportTest2::testTdf126741() CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_DASH, rStyleItem.GetValue()); CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), rDashItem.GetDashValue().GetDots()); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(800), rDashItem.GetDashValue().GetDotLen()); + CPPUNIT_ASSERT_EQUAL(800.0, rDashItem.GetDashValue().GetDotLen()); CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), rDashItem.GetDashValue().GetDashes()); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(100), rDashItem.GetDashValue().GetDashLen()); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(300), rDashItem.GetDashValue().GetDistance()); + CPPUNIT_ASSERT_EQUAL(100.0, rDashItem.GetDashValue().GetDashLen()); + CPPUNIT_ASSERT_EQUAL(300.0, rDashItem.GetDashValue().GetDistance()); xDocShRef->DoClose(); } diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index 9a1ab0a52c82..7d0045646876 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -31,6 +31,7 @@ #include <svx/xfillit0.hxx> #include <svx/xflclit.hxx> #include <svx/xflgrit.hxx> +#include <svx/xlndsit.hxx> #include <SlideSorterViewShell.hxx> #include <SlideSorter.hxx> #include <controller/SlideSorterController.hxx> @@ -632,27 +633,12 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf134053) SdrObject* pShape = pActualPage->GetObj(0); CPPUNIT_ASSERT_MESSAGE("No Shape", pShape); - // Break line into single dash and dot objects - SdrView* pView = pViewShell->GetView(); - pView->MarkObj(pShape, pView->GetSdrPageView()); - dispatchCommand(mxComponent, ".uno:ConvertIntoMetafile", {}); - dispatchCommand(mxComponent, ".uno:Break", {}); - - // Measure the rendered length of dash, dot and distance - SdrObject* pDash = pActualPage->GetObj(0); - const tools::Rectangle& rBoundDashRect = pDash->GetCurrentBoundRect(); - const double fDashLength(rBoundDashRect.GetWidth()); - SdrObject* pDot = pActualPage->GetObj(1); - const tools::Rectangle& rBoundDotRect = pDot->GetCurrentBoundRect(); - const double fDotLength(rBoundDotRect.GetWidth()); - const double fDistance(rBoundDotRect.Left() - rBoundDashRect.Right()); + XDash dash = pShape->GetMergedItem(XATTR_LINEDASH).GetDashValue(); // Because 0% is not possible as dash length (as of June 2020) 1% is used in the fix. - // For that a larger delta is here allowed to the ideal value than needed for - // rounding errors. - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Distance", 2117, fDistance, 12); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Dot length", 706, fDotLength, 12); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Dash length", 2822, fDashLength, 12); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Distance", 399.0, dash.GetDistance()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Dot length", 301.0, dash.GetDotLen()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Dash length", 1.0, dash.GetDashLen()); } CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testSpellOnlineParameter) |