diff options
author | Attila Szűcs <attila.szucs@collabora.com> | 2023-01-13 04:49:33 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-01-20 07:56:29 +0000 |
commit | f9d6dd788e82a1964dab9cc0d0436c8c54b775c0 (patch) | |
tree | ed2d99c3771c43530f5883c2fa4e4102bd187854 /svx/qa | |
parent | 14da39fcfffe8006a79971ac0b670e12d0d7a0ea (diff) |
tdf#148000 impress: Handle linebreaks on fontwork.
Split text lines in a paragraph, right before polygons are created
for rendering, so eol will brake line in fontwork just like eop.
Change-Id: Ie9e6764f9f91c2e19afd43dc9a212bd18c41c99d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145425
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'svx/qa')
-rw-r--r-- | svx/qa/unit/data/tdf148000_EOLinCurvedText.pptx | bin | 0 -> 29206 bytes | |||
-rw-r--r-- | svx/qa/unit/data/tdf148000_EOLinCurvedText_Legacy.odp | bin | 0 -> 13692 bytes | |||
-rw-r--r-- | svx/qa/unit/data/tdf148000_EOLinCurvedText_New.odp | bin | 0 -> 13750 bytes | |||
-rw-r--r-- | svx/qa/unit/svdraw.cxx | 42 |
4 files changed, 42 insertions, 0 deletions
diff --git a/svx/qa/unit/data/tdf148000_EOLinCurvedText.pptx b/svx/qa/unit/data/tdf148000_EOLinCurvedText.pptx Binary files differnew file mode 100644 index 000000000000..137fc816697a --- /dev/null +++ b/svx/qa/unit/data/tdf148000_EOLinCurvedText.pptx diff --git a/svx/qa/unit/data/tdf148000_EOLinCurvedText_Legacy.odp b/svx/qa/unit/data/tdf148000_EOLinCurvedText_Legacy.odp Binary files differnew file mode 100644 index 000000000000..13e7cc4e5c8a --- /dev/null +++ b/svx/qa/unit/data/tdf148000_EOLinCurvedText_Legacy.odp diff --git a/svx/qa/unit/data/tdf148000_EOLinCurvedText_New.odp b/svx/qa/unit/data/tdf148000_EOLinCurvedText_New.odp Binary files differnew file mode 100644 index 000000000000..7ebdb9431b72 --- /dev/null +++ b/svx/qa/unit/data/tdf148000_EOLinCurvedText_New.odp diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx index c2a7f244b8ab..7bf1ceb9d4a1 100644 --- a/svx/qa/unit/svdraw.cxx +++ b/svx/qa/unit/svdraw.cxx @@ -382,6 +382,48 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testFontWorks) "32"); } +CPPUNIT_TEST_FIXTURE(SvdrawTest, testTdf148000_EOLinCurvedText) +{ + std::vector<OUString> aFilenames + = { u"tdf148000_EOLinCurvedText.pptx", u"tdf148000_EOLinCurvedText_New.odp", + u"tdf148000_EOLinCurvedText_Legacy.odp" }; + + for (int i = 0; i < 3; i++) + { + loadFromURL(aFilenames[i]); + + SdrPage* pSdrPage = getFirstDrawPageWithAssert(); + + xmlDocUniquePtr pXmlDoc = lcl_dumpAndParseFirstObjectWithAssert(pSdrPage); + + OString aBasePath + = "/primitive2D/objectinfo[4]/unhandled/unhandled/polypolygoncolor/polypolygon/"; + + // The text is: "O" + eop + "O" + eol + "O" + // It should be displayed as 3 line of text. (1 "O" letter in every line) + sal_Int32 nY1 = getXPath(pXmlDoc, aBasePath + "polygon[1]/point[1]", "y").toInt32(); + sal_Int32 nY2 = getXPath(pXmlDoc, aBasePath + "polygon[3]/point[1]", "y").toInt32(); + sal_Int32 nY3 = getXPath(pXmlDoc, aBasePath + "polygon[5]/point[1]", "y").toInt32(); + + sal_Int32 nDiff21 = nY2 - nY1; + sal_Int32 nDiff32 = nY3 - nY2; + + // the 2. "O" must be positioned much lower as the 1. "O". (the eop break the line) + CPPUNIT_ASSERT_GREATER(sal_Int32(300), nDiff21); + if (i < 2) + { + // the 3. "O" must be positioned even lower with 1 line. (the eol must break the line as well) + CPPUNIT_ASSERT_LESS(sal_Int32(50), abs(nDiff32 - nDiff21)); + } + else + { + // In legacy mode, the 3. "O" must be positioned about the same high as the 2. "O" + // the eol not break the line. + CPPUNIT_ASSERT_LESS(sal_Int32(50), nDiff32); + } + } +} + CPPUNIT_TEST_FIXTURE(SvdrawTest, testSurfaceMetal) { loadFromURL(u"tdf140321_metal.odp"); |