summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-04-16 10:11:26 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-04-16 11:53:59 +0200
commitd9420a64fbb288020d33b681f40a858db49afca7 (patch)
tree7e05e67570e4bd9729ada7c433ea5488591e4c35 /sw/qa/extras
parentceb4bc418cd4c03a4e78f4a84ae2d56a71799a31 (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>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/layout/data/tdf117028.docxbin0 -> 13619 bytes
-rw-r--r--sw/qa/extras/layout/layout.cxx24
2 files changed, 24 insertions, 0 deletions
diff --git a/sw/qa/extras/layout/data/tdf117028.docx b/sw/qa/extras/layout/data/tdf117028.docx
new file mode 100644
index 000000000000..877264b4db33
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf117028.docx
Binary files differ
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();