diff options
author | Justin Luth <justin.luth@collabora.com> | 2021-02-19 08:37:44 +0200 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2021-02-23 06:14:03 +0100 |
commit | 873df086db969cadc66087a5abdb1ff33f2c99f1 (patch) | |
tree | bd5df24a9efee009594602a20b3157714388797d /sw/qa | |
parent | 576c6054d8d445cc977fc3789c572cfc2a3ccd83 (diff) |
tdf#135774, tdf#114799 Char highlight: apply to numbering
This is a partial revert of LO 7.0's
commit 315d56582f8a56d8f2d3ea6cda63ea4832249608
The character background is exported as either w:highlight
or w:shd, based on a user setting. w:shd does not affect
numbering in MS Word, only the 16 color w:highlight does.
(tools - options - Load/Save - Microsoft Office -
Character highlighting export as: Highlight or Shading)
I replaced tdf114799.docx with a version that uses w:highlight
instead of w:shd. The test was doing it backwards - MS Word
was NOT highlighting the numbering in the original unit test.
I added another test using the original unit test to ensure
that the numbering was not affected by the paragraph's
char shading.
There are many other "Char highlight:" patches in 7.2
that are not going to be backported.
See http://wiki.documentfoundation.org/Documentation/CharHighlight
for more details about this topic.
Change-Id: I38b6f700895e29f634f07430f6c7a13722ffa4f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111201
Tested-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/tiledrendering/data/tdf114799_highlight.docx | bin | 0 -> 29040 bytes | |||
-rw-r--r-- | sw/qa/extras/tiledrendering/data/tdf114799_shd.docx (renamed from sw/qa/extras/tiledrendering/data/tdf114799.docx) | bin | 29049 -> 29049 bytes | |||
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 29 |
3 files changed, 28 insertions, 1 deletions
diff --git a/sw/qa/extras/tiledrendering/data/tdf114799_highlight.docx b/sw/qa/extras/tiledrendering/data/tdf114799_highlight.docx Binary files differnew file mode 100644 index 000000000000..3a64d71d7cfd --- /dev/null +++ b/sw/qa/extras/tiledrendering/data/tdf114799_highlight.docx diff --git a/sw/qa/extras/tiledrendering/data/tdf114799.docx b/sw/qa/extras/tiledrendering/data/tdf114799_shd.docx Binary files differindex 730ef91dcef9..730ef91dcef9 100644 --- a/sw/qa/extras/tiledrendering/data/tdf114799.docx +++ b/sw/qa/extras/tiledrendering/data/tdf114799_shd.docx diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 41249cd9f3ac..54dd09b7d191 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -135,6 +135,7 @@ public: void testDeselectCustomShape(); void testSemiTransparent(); void testHighlightNumbering(); + void testHighlightNumbering_shd(); void testPilcrowRedlining(); void testClipText(); void testAnchorTypes(); @@ -212,6 +213,7 @@ public: CPPUNIT_TEST(testDeselectCustomShape); CPPUNIT_TEST(testSemiTransparent); CPPUNIT_TEST(testHighlightNumbering); + CPPUNIT_TEST(testHighlightNumbering_shd); CPPUNIT_TEST(testPilcrowRedlining); CPPUNIT_TEST(testClipText); CPPUNIT_TEST(testAnchorTypes); @@ -2441,7 +2443,7 @@ void SwTiledRenderingTest::testSemiTransparent() void SwTiledRenderingTest::testHighlightNumbering() { // Load a document where the top left tile contains a semi-transparent rectangle shape. - SwXTextDocument* pXTextDocument = createDoc("tdf114799.docx"); + SwXTextDocument* pXTextDocument = createDoc("tdf114799_highlight.docx"); // Render a larger area, and then get the color of the bottom right corner of our tile. size_t nCanvasWidth = 1024; @@ -2463,6 +2465,31 @@ void SwTiledRenderingTest::testHighlightNumbering() CPPUNIT_ASSERT_EQUAL(COL_YELLOW, aColor); } +void SwTiledRenderingTest::testHighlightNumbering_shd() +{ + // Load a document where the top left tile contains a semi-transparent rectangle shape. + SwXTextDocument* pXTextDocument = createDoc("tdf114799_shd.docx"); + + // Render a larger area, and then get the color of the bottom right corner of our tile. + size_t nCanvasWidth = 1024; + size_t nCanvasHeight = 512; + size_t nTileSize = 256; + 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(0, 0), Size(nTileSize, nTileSize)); + Bitmap::ScopedReadAccess pAccess(aBitmap); + + // No highlighting over numbering - w:shd does not apply to numbering. + Color aColor(pAccess->GetPixel(103, 148)); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, aColor); +} + void SwTiledRenderingTest::testPilcrowRedlining() { // Load a document where the top left tile contains |