[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sw/qa sw/source
László Németh (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 13 20:55:10 UTC 2020
sw/qa/extras/tiledrendering/data/tdf114799.docx |binary
sw/qa/extras/tiledrendering/tiledrendering.cxx | 27 ++++++++++++++++++++++++
sw/source/core/text/txtfld.cxx | 14 ++++++------
3 files changed, 34 insertions(+), 7 deletions(-)
New commits:
commit fe3418d684096ca19a0bb75ec9f35b386e8d1f65
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Tue Apr 28 16:48:09 2020 +0200
Commit: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Mon Jul 13 22:54:29 2020 +0200
tdf#114799 DOCX import: fix missing numbering highlight
opening a DOCX with shadowing (w:shd) instead of highlight
(w:highlight), for example, a DOCX saved in LibreOffice.
This reverts also commit aa02ed306f7c633bbffede16e44e8e736977ace4
(tdf#106991: Highlighting remains after select no fill).
Change-Id: I0935694e3c309b5a450cd424fd398a88d13f8b22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93082
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit 315d56582f8a56d8f2d3ea6cda63ea4832249608)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98640
Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
diff --git a/sw/qa/extras/tiledrendering/data/tdf114799.docx b/sw/qa/extras/tiledrendering/data/tdf114799.docx
new file mode 100644
index 000000000000..730ef91dcef9
Binary files /dev/null and b/sw/qa/extras/tiledrendering/data/tdf114799.docx differ
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 6b612cd0ac09..d50e2e4015b6 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -119,6 +119,7 @@ public:
void testVisCursorInvalidation();
void testDeselectCustomShape();
void testSemiTransparent();
+ void testHighlightNumbering();
void testClipText();
void testAnchorTypes();
void testLanguageStatus();
@@ -181,6 +182,7 @@ public:
CPPUNIT_TEST(testVisCursorInvalidation);
CPPUNIT_TEST(testDeselectCustomShape);
CPPUNIT_TEST(testSemiTransparent);
+ CPPUNIT_TEST(testHighlightNumbering);
CPPUNIT_TEST(testClipText);
CPPUNIT_TEST(testAnchorTypes);
CPPUNIT_TEST(testLanguageStatus);
@@ -2423,6 +2425,31 @@ void SwTiledRenderingTest::testSemiTransparent()
CPPUNIT_ASSERT_GREATEREQUAL(190, static_cast<int>(aColor.B));
}
+void SwTiledRenderingTest::testHighlightNumbering()
+{
+ // Load a document where the top left tile contains a semi-transparent rectangle shape.
+ SwXTextDocument* pXTextDocument = createDoc("tdf114799.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);
+
+ // Yellow highlighting over numbering
+ Color aColor(pAccess->GetPixel(103, 148));
+ CPPUNIT_ASSERT_EQUAL(COL_YELLOW, aColor);
+}
+
void SwTiledRenderingTest::testClipText()
{
// Load a document where the top left tile contains table text with
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 1930bfa99b30..aae0c03bed35 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -470,17 +470,17 @@ static void checkApplyParagraphMarkFormatToNumbering(SwFont* pNumFnt, SwTextForm
const SfxPoolItem* pItem = aIter.GetCurItem();
do
{
- if (SwTextNode::IsIgnoredCharFormatForNumbering(pItem->Which()))
- pCleanedSet->ClearItem(pItem->Which());
- else if (pFormat && pFormat->HasItem(pItem->Which()))
- pCleanedSet->ClearItem(pItem->Which());
+ if (pItem->Which() != RES_CHRATR_BACKGROUND)
+ {
+ if (SwTextNode::IsIgnoredCharFormatForNumbering(pItem->Which()))
+ pCleanedSet->ClearItem(pItem->Which());
+ else if (pFormat && pFormat->HasItem(pItem->Which()))
+ pCleanedSet->ClearItem(pItem->Which());
+ }
pItem = aIter.NextItem();
} while (pItem);
- // Highlightcolor also needed to be untouched, but we can't have that just by clearing the item
- Color nSaveHighlight = pNumFnt->GetHighlightColor();
pNumFnt->SetDiffFnt(pCleanedSet.get(), pIDSA);
- pNumFnt->SetHighlightColor(nSaveHighlight);
}
}
More information about the Libreoffice-commits
mailing list