summaryrefslogtreecommitdiffstats
path: root/sd/qa/unit
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 11:48:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 11:48:25 +0000
commit9c0049cfae49c8e4ddef9125a69db2ad134c10c6 (patch)
tree812a86c0eee63dfc5ace12f2622ed3ce9cd3d680 /sd/qa/unit
parentReleasing progress-linux version 4:24.2.3-2~progress7.99u1. (diff)
downloadlibreoffice-9c0049cfae49c8e4ddef9125a69db2ad134c10c6.tar.xz
libreoffice-9c0049cfae49c8e4ddef9125a69db2ad134c10c6.zip
Merging upstream version 4:24.2.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sd/qa/unit')
-rw-r--r--sd/qa/unit/PNGExportTests.cxx8
-rw-r--r--sd/qa/unit/data/odg/adjust-to-contour.fodg52
-rw-r--r--sd/qa/unit/layout-tests.cxx48
3 files changed, 104 insertions, 4 deletions
diff --git a/sd/qa/unit/PNGExportTests.cxx b/sd/qa/unit/PNGExportTests.cxx
index 855c3becfd..69343b8b20 100644
--- a/sd/qa/unit/PNGExportTests.cxx
+++ b/sd/qa/unit/PNGExportTests.cxx
@@ -483,21 +483,21 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157793)
CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize);
Bitmap aBMP = aBMPEx.GetBitmap();
BitmapScopedReadAccess pReadAccess(aBMP);
- int nLightGrayCount = 0;
+ int nWhiteCount = 0;
for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX)
{
for (tools::Long nY = 1; nY < aSize.Height() - 1; ++nY)
{
const Color aColor = pReadAccess->GetColor(nY, nX);
- if (aColor == 0xfefefe)
- ++nLightGrayCount;
+ if (aColor == 0xffffff)
+ ++nWhiteCount;
}
}
// Without the fix in place, this test would have failed with
// - Expected greater than: 7800
// - Actual : 0
- CPPUNIT_ASSERT_GREATER(7800, nLightGrayCount);
+ CPPUNIT_ASSERT_GREATER(7800, nWhiteCount);
}
CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157635)
diff --git a/sd/qa/unit/data/odg/adjust-to-contour.fodg b/sd/qa/unit/data/odg/adjust-to-contour.fodg
new file mode 100644
index 0000000000..a5ec6fed74
--- /dev/null
+++ b/sd/qa/unit/data/odg/adjust-to-contour.fodg
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.graphics">
+ <office:font-face-decls>
+ <style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="roman" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:default-style style:family="graphic">
+ <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf"/>
+ <style:paragraph-properties style:text-autospace="ideograph-alpha" style:punctuation-wrap="simple" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+ <style:tab-stops/>
+ </style:paragraph-properties>
+ </style:default-style>
+ <style:style style:name="standard" style:family="graphic">
+ <style:graphic-properties draw:stroke="solid" svg:stroke-width="0cm" draw:marker-start-width="0.2cm" draw:marker-start-center="false" draw:marker-end-width="0.2cm" draw:marker-end-center="false" draw:fill="solid" draw:textarea-horizontal-align="justify" fo:padding-top="0" fo:padding-bottom="0" fo:padding-left="0" fo:padding-right="0" fo:wrap-option="wrap" draw:shadow="hidden" draw:shadow-offset-x="0.2cm" draw:shadow-offset-y="0.2cm" draw:shadow-color="#808080"/>
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%" fo:text-indent="0cm"/>
+ <style:text-properties fo:font-variant="normal" fo:text-transform="none" style:use-window-font-color="true" style:text-outline="false" style:text-line-through-style="none" style:text-line-through-type="none" style:font-name="Liberation Sans" fo:font-size="18pt" fo:font-style="normal" fo:text-shadow="none" style:text-underline-style="none" fo:font-weight="normal" style:letter-kerning="true" style:text-emphasize="none" style:font-relief="none" style:text-overline-style="none" style:text-overline-color="font-color"/>
+ </style:style>
+ </office:styles>
+ <office:automatic-styles>
+ <style:page-layout style:name="PM0">
+ <style:page-layout-properties fo:margin-top="0" fo:margin-bottom="0" fo:margin-left="0" fo:margin-right="0" fo:page-width="21cm" fo:page-height="29.7cm" style:print-orientation="portrait"/>
+ </style:page-layout>
+ <style:style style:name="dp1" style:family="drawing-page"/>
+ <style:style style:name="gr1" style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:textarea-vertical-align="middle" draw:fit-to-contour="true"/>
+ </style:style>
+ <style:style style:name="P1" style:family="paragraph">
+ <style:paragraph-properties fo:text-align="center"/>
+ <style:text-properties fo:language="zxx" fo:country="none"/>
+ </style:style>
+ </office:automatic-styles>
+ <office:master-styles>
+ <draw:layer-set>
+ <draw:layer draw:name="layout"/>
+ <draw:layer draw:name="background"/>
+ <draw:layer draw:name="backgroundobjects"/>
+ <draw:layer draw:name="controls"/>
+ <draw:layer draw:name="measurelines"/>
+ </draw:layer-set>
+ <style:master-page style:name="Default" style:page-layout-name="PM0" draw:style-name="dp1"/>
+ </office:master-styles>
+ <office:body>
+ <office:drawing>
+ <draw:page draw:name="page1" draw:style-name="dp1" draw:master-page-name="Default">
+ <draw:ellipse draw:style-name="gr1" draw:layer="layout" svg:width="13cm" svg:height="13cm" svg:x="4cm" svg:y="8cm">
+ <text:p text:style-name="P1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat mi quis pretium semper. Proin luctus orci ac neque venenatis, quis commodo dolor posuere. Curabitur dignissim sapien quis cursus egestas. Donec blandit auctor arcu, nec pellentesque eros molestie eget. In consectetur aliquam hendrerit. Sed cursus mauris vitae ligula pellentesque, non pellentesque urna aliquet. Fusce placerat mauris enim, nec rutrum purus semper vel. Praesent tincidunt neque eu pellentesque pharetra. Fusce pellentesque est orci.</text:p>
+ </draw:ellipse>
+ </draw:page>
+ </office:drawing>
+ </office:body>
+</office:document> \ No newline at end of file
diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx
index a93584b62f..9be1ce154b 100644
--- a/sd/qa/unit/layout-tests.cxx
+++ b/sd/qa/unit/layout-tests.cxx
@@ -380,6 +380,54 @@ CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf112594)
u"11\u202f\u1824"_ustr);
}
+CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf152906_AdjustToContour)
+{
+ // Test that the text adjusts to contour properly
+
+ constexpr OUString sText
+ = u"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat mi quis "
+ "pretium semper. Proin luctus orci ac neque venenatis, quis commodo dolor posuere. "
+ "Curabitur dignissim sapien quis cursus egestas. Donec blandit auctor arcu, nec "
+ "pellentesque eros molestie eget. In consectetur aliquam hendrerit. Sed cursus mauris "
+ "vitae ligula pellentesque, non pellentesque urna aliquet. Fusce placerat mauris enim, "
+ "nec rutrum purus semper vel. Praesent tincidunt neque eu pellentesque pharetra. Fusce "
+ "pellentesque est orci."_ustr;
+
+ // index, length, x, y
+ const std::tuple<int, int, int, int> strings[] = {
+ { 0, 6, 9600, 8647 }, // Lorem
+ { 6, 22, 7572, 9358 }, // ipsum dolor sit amet,
+ { 28, 29, 6776, 10069 }, // consectetur adipiscing elit.
+ { 57, 29, 6300, 10780 }, // Vestibulum consequat mi quis
+ { 86, 37, 5453, 11491 }, // pretium semper. Proin luctus orci ac
+ { 123, 36, 5136, 12202 }, // neque venenatis, quis commodo dolor
+ { 159, 41, 4765, 12913 }, // posuere. Curabitur dignissim sapien quis
+ { 200, 43, 4482, 13624 }, // cursus egestas. Donec blandit auctor arcu,
+ { 243, 40, 4977, 14335 }, // nec pellentesque eros molestie eget. In
+ { 283, 42, 4554, 15046 }, // consectetur aliquam hendrerit. Sed cursus
+ { 325, 38, 5364, 15757 }, // mauris vitae ligula pellentesque, non
+ { 363, 42, 4693, 16468 }, // pellentesque urna aliquet. Fusce placerat
+ { 405, 37, 5049, 17179 }, // mauris enim, nec rutrum purus semper
+ { 442, 33, 5963, 17890 }, // vel. Praesent tincidunt neque eu
+ { 475, 29, 6389, 18601 }, // pellentesque pharetra. Fusce
+ { 504, 22, 7500, 19312 }, // pellentesque est orci.
+ };
+
+ xmlDocUniquePtr pXmlDoc = load("odg/adjust-to-contour.fodg");
+
+ assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray"_ostr, std::size(strings));
+ for (size_t i = 0; i < std::size(strings); ++i)
+ {
+ const auto & [ index, length, x, y ] = strings[i];
+ OString sXPath = "/metafile/push[1]/push[1]/textarray[" + OString::number(i + 1) + "]";
+ assertXPathContent(pXmlDoc, sXPath + "/text", sText);
+ assertXPath(pXmlDoc, sXPath, "index"_ostr, OUString::number(index));
+ assertXPath(pXmlDoc, sXPath, "length"_ostr, OUString::number(length));
+ assertXPath(pXmlDoc, sXPath, "x"_ostr, OUString::number(x));
+ assertXPath(pXmlDoc, sXPath, "y"_ostr, OUString::number(y));
+ }
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */