summaryrefslogtreecommitdiff
path: root/emfio
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2018-03-02 01:07:57 +0100
committerAndras Timar <andras.timar@collabora.com>2018-04-12 10:54:36 +0200
commitf6f1076a6906b6518775e76f282deb9e34b537ee (patch)
treeed41cac55f1de286064152c86c0f1c5252eb4ed7 /emfio
parentd0e5163d9f587a7fc4a6df5d3661f3baafa8c314 (diff)
tdf#114738 Add support for transparency for EMF+ records
With current EMF+ implementation all filled figures, does not support transparency. This patch add transparency support for following EMF+ records: - DrawDriverString - DrawString - FillEllipse - FillRects - FillPolygon - FillPie - FillPath - FillRegion Change-Id: I1e59ea90bdf5fafc07ff9417fccace44872bbecd Reviewed-on: https://gerrit.libreoffice.org/52021 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl> (cherry picked from commit aee1904446cd0508cdf06fd23155373b5018dfed)
Diffstat (limited to 'emfio')
-rw-r--r--emfio/qa/cppunit/emf/EmfImportTest.cxx26
-rw-r--r--emfio/qa/cppunit/emf/data/TestDrawStringTransparent.emfbin0 -> 480 bytes
2 files changed, 26 insertions, 0 deletions
diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index bc14c4bd3062..1aae38f3bd5f 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -40,6 +40,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools
void testWorking();
void TestDrawString();
+ void TestDrawStringTransparent();
void TestDrawLine();
Primitive2DSequence parseEmf(const OUString& aSource);
@@ -48,6 +49,7 @@ public:
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testWorking);
CPPUNIT_TEST(TestDrawString);
+ CPPUNIT_TEST(TestDrawStringTransparent);
CPPUNIT_TEST(TestDrawLine);
CPPUNIT_TEST_SUITE_END();
};
@@ -113,6 +115,30 @@ void Test::TestDrawString()
assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "familyname", "CALIBRI");
}
+void Test::TestDrawStringTransparent()
+{
+ // This unit checks for a correct import of an EMF+ file with one DrawString Record with transparency
+
+ // first, get the sequence of primitives and dump it
+ Primitive2DSequence aSequence = parseEmf("/emfio/qa/cppunit/emf/data/TestDrawStringTransparent.emf");
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
+ Primitive2dXmlDump dumper;
+ xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
+ CPPUNIT_ASSERT (pDocument);
+
+ //TODO Strange that transparency is set to 0 even if it is not fully transparent
+ // check correct import of the DrawString: transparency, height, position, text, color and font
+ assertXPath(pDocument, "/primitive2D/metafile/transform/unifiedtransparence", "transparence", "0");
+
+ //TODO Where was textsimpleportion gone?
+ //assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "height", "276");
+ //assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "x", "25");
+ //assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "y", "323");
+ //assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "text", "Transparent Text");
+ //assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "fontcolor", "#000000");
+ //assertXPath(pDocument, "/primitive2D/metafile/transform/textsimpleportion", "familyname", "CALIBRI");
+}
+
void Test::TestDrawLine()
{
// This unit checks for a correct import of an EMF+ file with only one DrawLine Record
diff --git a/emfio/qa/cppunit/emf/data/TestDrawStringTransparent.emf b/emfio/qa/cppunit/emf/data/TestDrawStringTransparent.emf
new file mode 100644
index 000000000000..73954c4902c7
--- /dev/null
+++ b/emfio/qa/cppunit/emf/data/TestDrawStringTransparent.emf
Binary files differ