diff options
author | Sarper Akdemir <sarper.akdemir@collabora.com> | 2023-04-06 13:01:02 +0300 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2023-04-12 23:28:26 +0200 |
commit | 37006e138407017366c3a0cb62ee71a6f7418c5d (patch) | |
tree | 114d3848b8717843e30d786e7b7152c2052a4461 /svx/qa | |
parent | 6263b7bbff3bdbe1bba0f168fb363b07f60377cf (diff) |
pptx import/export: consider TextClipVerticalOverflow for vertOverflow
Also adds a unit test that tests TextClipVerticalOverflow on
4 different scenarios.
Change-Id: I6232935765641c796046d90fe2207d67ae4b3eb5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150107
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150237
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'svx/qa')
-rw-r--r-- | svx/qa/unit/data/clip-vertical-overflow.pptx | bin | 0 -> 32324 bytes | |||
-rw-r--r-- | svx/qa/unit/svdraw.cxx | 45 |
2 files changed, 45 insertions, 0 deletions
diff --git a/svx/qa/unit/data/clip-vertical-overflow.pptx b/svx/qa/unit/data/clip-vertical-overflow.pptx Binary files differnew file mode 100644 index 000000000000..703f92e54b30 --- /dev/null +++ b/svx/qa/unit/data/clip-vertical-overflow.pptx diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx index 04cdb43f0584..a5ff20135aaf 100644 --- a/svx/qa/unit/svdraw.cxx +++ b/svx/qa/unit/svdraw.cxx @@ -537,6 +537,51 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testPageViewDrawLayerClip) // i.e. the 2nd page had a line shape from the first page's footer. CPPUNIT_ASSERT_EQUAL(2, pPage2->getObjectCount()); } + +CPPUNIT_TEST_FIXTURE(SvdrawTest, testClipVerticalTextOverflow) +{ + // File contains a slide with 4 rectangle shapes with text inside + // each have <a:bodyPr vertOverflow="clip"> + // 1-) Text overflowing the rectangle + // 2-) Text not overflowing the rectangle + // 3-) (Vertical text) Text overflowing the rectangle + // 4-) (Vertical text) Text not overflowing the rectangle + OUString aURL = m_directories.getURLFromSrc(u"svx/qa/unit/data/clip-vertical-overflow.pptx"); + mxComponent = loadFromDesktop(aURL, "com.sun.star.presentation.PresentationDocument"); + + SdrPage* pSdrPage = getFirstDrawPageWithAssert(); + xmlDocUniquePtr pDocument = lcl_dumpAndParseFirstObjectWithAssert(pSdrPage); + + // Test vertically overflowing text + // Without the accompanying fix in place, this test would have failed with: + // equality assertion failed + // - Expected: 6 + // - Actual : 13 + // - In <>, XPath contents of child does not match + // i.e. the vertically overflowing text wasn't clipped & overflowing text + // was drawn anyways. + assertXPathContent(pDocument, "count((//sdrblocktext)[4]//textsimpleportion)", "6"); + + // make sure text is aligned correctly after the overflowing text is clipped + assertXPath(pDocument, "((//sdrblocktext)[4]//textsimpleportion)[1]", "y", "3749"); + assertXPath(pDocument, "((//sdrblocktext)[4]//textsimpleportion)[6]", "y", "7559"); + + // make sure the text that isn't overflowing is still aligned properly + assertXPathContent(pDocument, "count((//sdrblocktext)[5]//textsimpleportion)", "3"); + assertXPath(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[1]", "y", "5073"); + assertXPath(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[3]", "y", "6597"); + + // Test vertically overflowing text, with vertical text direction + assertXPathContent(pDocument, "count((//sdrblocktext)[6]//textsimpleportion)", "12"); + // make sure text is aligned correctly after the overflowing text is clipped + assertXPath(pDocument, "((//sdrblocktext)[6]//textsimpleportion)[1]", "x", "13093"); + assertXPath(pDocument, "((//sdrblocktext)[6]//textsimpleportion)[12]", "x", "4711"); + + // make sure the text that isn't overflowing is still aligned properly + assertXPathContent(pDocument, "count((//sdrblocktext)[7]//textsimpleportion)", "3"); + assertXPath(pDocument, "((//sdrblocktext)[7]//textsimpleportion)[1]", "x", "25417"); + assertXPath(pDocument, "((//sdrblocktext)[7]//textsimpleportion)[3]", "x", "23893"); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |