[Libreoffice-commits] core.git: sw/qa
László Németh (via logerrit)
logerrit at kemper.freedesktop.org
Wed Nov 4 12:19:39 UTC 2020
sw/qa/extras/tiledrendering/data/pilcrow-redlining.fodt | 62 ++++++++++++++
sw/qa/extras/tiledrendering/tiledrendering.cxx | 70 ++++++++++++++++
2 files changed, 132 insertions(+)
New commits:
commit d842f8cdab1ceec151fdc9b5b0c5b55553fc46c8
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Tue Nov 3 15:09:29 2020 +0100
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Wed Nov 4 13:19:03 2020 +0100
tdf#105967 sw: add unit test for redlining of break symbols
Pilcrow and line break symbols have got strikeout and
underline of change tracking.
Follow-up of commit 72ec44bc294dd814c0ba8657337b6b2646382b02
(tdf#105967 sw change tracking: fix line break symbol in empty line).
Change-Id: I06d0fb40a8226ecada6e5452e611e9da1b556b61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105254
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
diff --git a/sw/qa/extras/tiledrendering/data/pilcrow-redlining.fodt b/sw/qa/extras/tiledrendering/data/pilcrow-redlining.fodt
new file mode 100644
index 000000000000..5f7bd0316807
--- /dev/null
+++ b/sw/qa/extras/tiledrendering/data/pilcrow-redlining.fodt
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office: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:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle: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:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oas
is:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:
experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:body>
+ <office:text>
+ <text:tracked-changes text:track-changes="false">
+ <text:changed-region xml:id="ct94231417949824" text:id="ct94231417949824">
+ <text:insertion>
+ <office:change-info>
+ <dc:creator>NL</dc:creator>
+ <dc:date>2020-11-03T09:00:05</dc:date>
+ </office:change-info>
+ </text:insertion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94231385489296" text:id="ct94231385489296">
+ <text:insertion>
+ <office:change-info>
+ <dc:creator>NL</dc:creator>
+ <dc:date>2020-11-03T08:56:53</dc:date>
+ </office:change-info>
+ </text:insertion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94231417752384" text:id="ct94231417752384">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>NL</dc:creator>
+ <dc:date>2020-11-03T09:00:02</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94231417929984" text:id="ct94231417929984">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>NL</dc:creator>
+ <dc:date>2020-11-03T08:57:37</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94231418119440" text:id="ct94231418119440">
+ <text:insertion>
+ <office:change-info>
+ <dc:creator>NL</dc:creator>
+ <dc:date>2020-11-03T09:00:18</dc:date>
+ </office:change-info>
+ </text:insertion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94231417325888" text:id="ct94231417325888">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>NL</dc:creator>
+ <dc:date>2020-11-03T09:00:21</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ </text:tracked-changes>
+ <text:p text:style-name="P1"><text:span text:style-name="T1">insert paragraph breaks</text:span><text:change-start text:change-id="ct94231417949824"/></text:p>
+ <text:p text:style-name="P1"><text:change-end text:change-id="ct94231417949824"/><text:change-start text:change-id="ct94231385489296"/></text:p>
+ <text:p text:style-name="P1"><text:change-end text:change-id="ct94231385489296"/><text:span text:style-name="T1">delete paragraph breaks</text:span><text:change-start text:change-id="ct94231417752384"/></text:p>
+ <text:p text:style-name="P1"><text:change-end text:change-id="ct94231417752384"/><text:change-start text:change-id="ct94231417929984"/></text:p>
+ <text:p text:style-name="P2"><text:change-end text:change-id="ct94231417929984"/>insert line breaks<text:change-start text:change-id="ct94231418119440"/><text:line-break/><text:line-break/><text:change-end text:change-id="ct94231418119440"/>delete line breaks<text:change-start text:change-id="ct94231417325888"/><text:line-break/><text:line-break/><text:change-end text:change-id="ct94231417325888"/></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 955d830fcb1b..0b790648d50c 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -58,6 +58,7 @@
#include <basesh.hxx>
#include <unotxdoc.hxx>
#include <docsh.hxx>
+#include <txtfrm.hxx>
char const DATA_DIRECTORY[] = "/sw/qa/extras/tiledrendering/data/";
@@ -132,6 +133,7 @@ public:
void testDeselectCustomShape();
void testSemiTransparent();
void testHighlightNumbering();
+ void testPilcrowRedlining();
void testClipText();
void testAnchorTypes();
void testLanguageStatus();
@@ -202,6 +204,7 @@ public:
CPPUNIT_TEST(testDeselectCustomShape);
CPPUNIT_TEST(testSemiTransparent);
CPPUNIT_TEST(testHighlightNumbering);
+ CPPUNIT_TEST(testPilcrowRedlining);
CPPUNIT_TEST(testClipText);
CPPUNIT_TEST(testAnchorTypes);
CPPUNIT_TEST(testLanguageStatus);
@@ -2438,6 +2441,73 @@ void SwTiledRenderingTest::testHighlightNumbering()
CPPUNIT_ASSERT_EQUAL(COL_YELLOW, aColor);
}
+void SwTiledRenderingTest::testPilcrowRedlining()
+{
+ // Load a document where the top left tile contains
+ // paragraph and line break symbols with redlining.
+ SwXTextDocument* pXTextDocument = createDoc("pilcrow-redlining.fodt");
+
+ // show non printing characters, including pilcrow and
+ // line break symbols with redlining
+ comphelper::dispatchCommand(".uno:ControlCodes", {});
+
+ // Render a larger area, and then get the color of the bottom right corner of our tile.
+ size_t nCanvasWidth = 2048;
+ size_t nCanvasHeight = 1024;
+ size_t nTileSize = 512;
+ std::vector<unsigned char> aPixmap(nCanvasWidth * nCanvasHeight * 4, 0);
+ ScopedVclPtrInstance<VirtualDevice> pDevice(DeviceFormat::DEFAULT);
+ pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
+ pDevice->SetOutputSizePixelScaleOffsetAndBuffer(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(100, 100), Size(nTileSize, nTileSize));
+ Bitmap::ScopedReadAccess pAccess(aBitmap);
+
+ const char* aTexts[] = {
+ "Insert paragraph break",
+ "Insert paragraph break (empty line)",
+ "Delete paragraph break",
+ "Delete paragraph break (empty line)",
+ "Insert line break",
+ "Insert line break (empty line)",
+ "Delete line break",
+ "Delete line break (empty line)"
+ };
+
+ // Check redlining (strikeout and underline) over the paragraph and line break symbols
+ for (int nLine = 0; nLine < 8; ++nLine)
+ {
+ bool bHasRedlineColor = false;
+ for (int i = 0; i < 36 && !bHasRedlineColor; ++i)
+ {
+ int nY = 96 + nLine * 36 + i;
+ for (sal_uInt32 j = 0; j < nTileSize - 1; ++j)
+ {
+ Color aColor(pAccess->GetPixel(nY, j));
+ 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
+ // 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 &&
+ aColor != NON_PRINTING_CHARACTER_COLOR )
+ {
+ bHasRedlineColor = true;
+ break;
+ }
+ }
+ }
+
+ CPPUNIT_ASSERT_MESSAGE(aTexts[nLine], bHasRedlineColor);
+ }
+
+ comphelper::dispatchCommand(".uno:ControlCodes", {});
+}
+
void SwTiledRenderingTest::testClipText()
{
// Load a document where the top left tile contains table text with
More information about the Libreoffice-commits
mailing list