summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToma┼ż Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-07-13 12:16:48 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-07-17 10:35:02 +0200
commit9a35a05b23251f86267eb73b5e67fd05a0d75925 (patch)
tree2202dd451319ab436ecfcb2908f2878016c27384
parent50383c547f440ee28680d5e10c074884648747dc (diff)
Prepare test for SVG export of semi-transparent text, not enabled
This prepares the test for semi-transparent text, but the assert is not yet enabled until the bug gets fixed. (cherry picked from commit ebb7cd91ec2bbbba3e4d2ce106b24933b23f4d14) Change-Id: I31a241910fd7bdf27579f291a497b76292eac775
-rw-r--r--filter/qa/unit/data/TransparentText.odgbin0 -> 9354 bytes
-rw-r--r--filter/qa/unit/svg.cxx33
2 files changed, 33 insertions, 0 deletions
diff --git a/filter/qa/unit/data/TransparentText.odg b/filter/qa/unit/data/TransparentText.odg
new file mode 100644
index 000000000000..d3027d17d657
--- /dev/null
+++ b/filter/qa/unit/data/TransparentText.odg
Binary files differ
diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx
index ee582d52e982..f856cf01d257 100644
--- a/filter/qa/unit/svg.cxx
+++ b/filter/qa/unit/svg.cxx
@@ -93,6 +93,39 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentLine)
CPPUNIT_ASSERT_EQUAL(30, nPercent);
}
+CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentText)
+{
+ // Two shapes, one with transparent text and the other one with
+ // opaque text. We expect both to be exported to the SVG with the
+ // correct transparency factor applied for the first shape.
+
+ // Load draw document with transparent text in one box
+ load("TransparentText.odg");
+
+ // Export to SVG.
+ uno::Reference<frame::XStorable> xStorable(getComponent(), uno::UNO_QUERY_THROW);
+
+ SvMemoryStream aStream;
+ uno::Reference<io::XOutputStream> xOut = new utl::OOutputStreamWrapper(aStream);
+ utl::MediaDescriptor aMediaDescriptor;
+ aMediaDescriptor["FilterName"] <<= OUString("draw_svg_Export");
+ aMediaDescriptor["OutputStream"] <<= xOut;
+ xStorable->storeToURL("private:stream", aMediaDescriptor.getAsConstPropertyValueList());
+ aStream.Seek(STREAM_SEEK_TO_BEGIN);
+
+ xmlDocPtr pXmlDoc = parseXmlStream(&aStream);
+ (void)pXmlDoc;
+
+ // We expect 2 groups of class "com.sun.star.drawing.TextShape" that
+ // have some svg:text node inside.
+
+ // TODO: fix the bug
+
+ // assertXPath(pXmlDoc, "//svg:g[@class='com.sun.star.drawing.TextShape']//svg:text", 2);
+
+ // TODO: assert we the text has correctly transparent text (20%)
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */