summaryrefslogtreecommitdiff
path: root/sw/qa/extras/layout/layout.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-04-16 10:11:26 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2018-05-07 15:25:15 +0200
commitf99fc4a3dbb9bc01d619b93e9759e744d146bdde (patch)
tree100a33d555362135fd447b2136c4482633155bad /sw/qa/extras/layout/layout.cxx
parent75967a849ceae371b4548178ec74e461f9e1aa70 (diff)
tdf#117028 sw: conditionally consider fill of shape for in-textbox auto color
Commit f966767e1ccfa432da33e1a0fd6de69e17a36bc3 (tdf#116925 sw: consider fill styles of shape for in-textbox auto color, 2018-04-10) did this unconditionally, but there are two cases: 1) Shape (with textbox) has a fill, in that case auto text color of textbox should consider the shape fill. 2) Shape has no fill, in that case the shape fill should not be considered when counting the background of a transparent fly frame. Fix 2) without breaking 1) by making the change to SwFrame::GetBackgroundBrush() opt-in, and only use it for auto font color, not in other cases. Change-Id: I761a1b7d6ecf47586edbe5641ec012f22f6a53d7 Reviewed-on: https://gerrit.libreoffice.org/52941 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit d9420a64fbb288020d33b681f40a858db49afca7) Reviewed-on: https://gerrit.libreoffice.org/52986 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit b981c148ef82d0a519e270974db01c9c5879a52c) Reviewed-on: https://gerrit.libreoffice.org/53742 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'sw/qa/extras/layout/layout.cxx')
-rw-r--r--sw/qa/extras/layout/layout.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 3709e306f53d..9a73e2025147 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -18,10 +18,12 @@ class SwLayoutWriter : public SwModelTestBase
public:
void testTdf116830();
void testTdf116925();
+ void testTdf117028();
CPPUNIT_TEST_SUITE(SwLayoutWriter);
CPPUNIT_TEST(testTdf116830);
CPPUNIT_TEST(testTdf116925);
+ CPPUNIT_TEST(testTdf117028);
CPPUNIT_TEST_SUITE_END();
private:
@@ -84,6 +86,28 @@ void SwLayoutWriter::testTdf116925()
"/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/push[3]/textcolor[@color='#ffffff']", 1);
}
+void SwLayoutWriter::testTdf117028()
+{
+ SwDoc* pDoc = createDoc("tdf117028.docx");
+ SwDocShell* pShell = pDoc->GetDocShell();
+
+ // Dump the rendering of the first page as an XML file.
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+ MetafileXmlDump dumper;
+ xmlDocPtr pXmlDoc = dumper.dumpAndParse(*xMetaFile);
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ // The only polypolygon in the rendering result was the white background we
+ // want to avoid.
+ xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polypolygon");
+ xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+ CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes));
+ xmlXPathFreeObject(pXmlObj);
+
+ // Make sure the text is still rendered.
+ assertXPathContent(pXmlDoc, "//textarray/text", "Hello");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
CPPUNIT_PLUGIN_IMPLEMENT();