sw/qa/extras/tiledrendering/data/double-underline_and_strike-out.fodt | 70 ++++++++++ sw/qa/extras/tiledrendering/tiledrendering.cxx | 46 ++++++ 2 files changed, 114 insertions(+), 2 deletions(-)
New commits: commit 48e1375045a9170a5a377ede2f062803eafedf63 Author: László Németh <nem...@numbertext.org> AuthorDate: Mon Nov 28 11:31:49 2022 +0100 Commit: László Németh <nem...@numbertext.org> CommitDate: Mon Nov 28 18:31:22 2022 +0100 tdf#152214 vcl: add unit test for double lines in small zoom To avoid of losing them completely or showing them as single lines on small zoom levels. This was a regression of visualization of tracked text moving, where green double strike out and double underline character formatting are associated to the removed and inserted text. Regression from commit ba03e033d1be4bc49f2a8d6afbeecd381507b242 "vcl: Use font’s underline/strike position and size", which was fixed in <https://gerrit.libreoffice.org/c/core/+/143321> and commit 55858a50cfb12cb6a4207bf906df676e799c1213 "tdf#152214: make sure underlines are shown on small zoom levels". Change-Id: Iffa9e92ef472e95ff27c89473bcbe2ffafa4525e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143384 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/tiledrendering/data/double-underline_and_strike-out.fodt b/sw/qa/extras/tiledrendering/data/double-underline_and_strike-out.fodt new file mode 100644 index 000000000000..881143bdaedb --- /dev/null +++ b/sw/qa/extras/tiledrendering/data/double-underline_and_strike-out.fodt @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:meta="u rn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext: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:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms -interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:settings> + <config:config-item-set config:name="ooo:view-settings"> + <config:config-item config:name="ViewAreaTop" config:type="long">0</config:config-item> + <config:config-item config:name="ViewAreaLeft" config:type="long">0</config:config-item> + <config:config-item config:name="ViewAreaWidth" config:type="long">35008</config:config-item> + <config:config-item config:name="ViewAreaHeight" config:type="long">27855</config:config-item> + <config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item> + <config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item> + <config:config-item-map-indexed config:name="Views"> + <config:config-item-map-entry> + <config:config-item config:name="ViewId" config:type="string">view2</config:config-item> + <config:config-item config:name="ViewLeft" config:type="long">18905</config:config-item> + <config:config-item config:name="ViewTop" config:type="long">3475</config:config-item> + <config:config-item config:name="VisibleLeft" config:type="long">0</config:config-item> + <config:config-item config:name="VisibleTop" config:type="long">0</config:config-item> + <config:config-item config:name="VisibleRight" config:type="long">35006</config:config-item> + <config:config-item config:name="VisibleBottom" config:type="long">27854</config:config-item> + <config:config-item config:name="ZoomType" config:type="short">0</config:config-item> + <config:config-item config:name="ViewLayoutColumns" config:type="short">0</config:config-item> + <config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item> + <config:config-item config:name="ZoomFactor" config:type="short">87</config:config-item> + <config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item> + <config:config-item config:name="KeepRatio" config:type="boolean">false</config:config-item> + <config:config-item config:name="HideWhitespace" config:type="boolean">false</config:config-item> + <config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item> + </config:config-item-map-entry> + </config:config-item-map-indexed> + </config:config-item-set> + </office:settings> + <office:styles> + <style:style style:name="Standard" style:family="paragraph" style:class="text"/> + <style:default-style style:family="paragraph"> + <style:text-properties fo:language="en" fo:country="US"/> + </style:default-style> + </office:styles> + <office:body> + <office:text> + <text:tracked-changes text:track-changes="false"> + <text:changed-region xml:id="ct94876403824720" text:id="ct94876403824720"> + <text:deletion> + <office:change-info> + <dc:creator>Unknown Author</dc:creator> + <dc:date>2022-11-28T10:18:08</dc:date> + </office:change-info> + </text:deletion> + </text:changed-region> + <text:changed-region xml:id="ct94876402741808" text:id="ct94876402741808"> + <text:insertion> + <office:change-info> + <dc:creator>Unknown Author</dc:creator> + <dc:date>2022-11-28T10:18:08</dc:date> + </office:change-info> + </text:insertion> + </text:changed-region> + </text:tracked-changes> + <text:sequence-decls> + <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/> + <text:sequence-decl text:display-outline-level="0" text:name="Table"/> + <text:sequence-decl text:display-outline-level="0" text:name="Text"/> + <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/> + <text:sequence-decl text:display-outline-level="0" text:name="Figure"/> + </text:sequence-decls> + <text:p text:style-name="Standard"><text:change-start text:change-id="ct94876403824720"/><text:tab/><text:tab/><text:tab/><text:tab/><text:tab/><text:tab/><text:span text:style-name="T1">Lorem ipsum…</text:span><text:change-end text:change-id="ct94876403824720"/></text:p> + <text:p text:style-name="P1"><text:tab/><text:tab/><text:tab/><text:tab/><text:tab/><text:tab/><text:span text:style-name="T1">Dolor…</text:span></text:p> + <text:p text:style-name="P1"><text:change-start text:change-id="ct94876402741808"/><text:tab/><text:tab/><text:tab/><text:tab/><text:tab/><text:tab/><text:span text:style-name="T1">Lorem ipsum…</text:span><text:change-end text:change-id="ct94876402741808"/></text:p> + </office:text> + </office:body> +</office:document> diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 664abbfaa238..e39dc418f8a2 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -2777,7 +2777,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testPilcrowRedlining) "Delete line break (empty line)" }; - // Check redlining (strikeout and underline) over the paragraph and line break symbols + // Check redlining (strike out and underline) over the paragraph and line break symbols for (int nLine = 0; nLine < 8; ++nLine) { bool bHasRedlineColor = false; @@ -2790,7 +2790,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testPilcrowRedlining) Color aColor2(pAccess->GetPixel(nY+1, j)); Color aColor3(pAccess->GetPixel(nY, j+1)); Color aColor4(pAccess->GetPixel(nY+1, j+1)); - // 4-pixel same color square sign strikeout or underline of redlining + // 4-pixel same color square sign strike out or underline of redlining // if its color is not white, black or non-printing character color if ( aColor == aColor2 && aColor == aColor3 && aColor == aColor4 && aColor != COL_WHITE && aColor != COL_BLACK && @@ -2808,6 +2808,48 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testPilcrowRedlining) comphelper::dispatchCommand(".uno:ControlCodes", {}); } +CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testDoubleUnderlineAndStrikeOut) +{ + // Load a document where the tracked text moving is visible with + // double underline and strike out character formatting + SwXTextDocument* pXTextDocument = createDoc("double-underline_and_strike-out.fodt"); + + // Render a larger area, and then get the color of the bottom right corner of our tile. + size_t nCanvasWidth = 700; + size_t nCanvasHeight = 350; + size_t nTileSize = 350; + std::vector<unsigned char> aPixmap(nCanvasWidth * nCanvasHeight * 4, 0); + ScopedVclPtrInstance<VirtualDevice> pDevice(DeviceFormat::DEFAULT); + pDevice->SetBackground(Wallpaper(COL_TRANSPARENT)); + pDevice->SetOutputSizePixelScaleOffsetAndLOKBuffer(Size(nCanvasWidth, nCanvasHeight), + Fraction(1.0), Point(), aPixmap.data()); + pXTextDocument->paintTile(*pDevice, nCanvasWidth, nCanvasHeight, /*nTilePosX=*/0, + /*nTilePosY=*/0, /*nTileWidth=*/15360, /*nTileHeight=*/7680); + pDevice->EnableMapMode(false); + Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, nTileSize)); + Bitmap::ScopedReadAccess pAccess(aBitmap); + bool bGreenLine = false; + size_t nGreenLine = 0; + // count green horizontal lines by tracking a column of pixels counting the + // separated continuous green pixel sequences. + for (size_t nLine = 0; nLine < nTileSize; ++nLine) + { + Color aColor(pAccess->GetPixel(nLine, 100)); + if ( aColor == COL_GREEN ) + { + if ( bGreenLine == false ) + { + ++nGreenLine; + bGreenLine = true; + } + } + else + bGreenLine = false; + } + // tdf#152214 this was 0 (missing double underline and double strike out) + CPPUNIT_ASSERT_EQUAL(size_t(4), nGreenLine); +} + CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testTdf43244_SpacesOnMargin) { // Load a document where the top left tile contains