summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir@collabora.com>2023-04-06 13:01:02 +0300
committerTomaž Vajngerl <quikee@gmail.com>2023-04-10 08:52:51 +0200
commit60bce1af8aab2115d603781193bb659b35d1aedb (patch)
treed8eb9bfad0f39f2931e1d37a030e082a1e7567de /svx
parent1934698260222f6727ac43118933094fa84dcdea (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>
Diffstat (limited to 'svx')
-rw-r--r--svx/qa/unit/data/clip-vertical-overflow.pptxbin0 -> 32324 bytes
-rw-r--r--svx/qa/unit/svdraw.cxx44
2 files changed, 44 insertions, 0 deletions
diff --git a/svx/qa/unit/data/clip-vertical-overflow.pptx b/svx/qa/unit/data/clip-vertical-overflow.pptx
new file mode 100644
index 000000000000..703f92e54b30
--- /dev/null
+++ b/svx/qa/unit/data/clip-vertical-overflow.pptx
Binary files differ
diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index 0001a7f4d66a..de6ba067fe1f 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -669,6 +669,50 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testRotatePoint)
CPPUNIT_ASSERT_EQUAL(Point(300, 300), aPoint);
}
}
+
+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
+ loadFromURL(u"clip-vertical-overflow.pptx");
+
+ 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: */