[Libreoffice-commits] core.git: filter/qa

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 13 17:32:35 UTC 2020


 filter/qa/unit/data/TransparentText.odg |binary
 filter/qa/unit/svg.cxx                  |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

New commits:
commit ebb7cd91ec2bbbba3e4d2ce106b24933b23f4d14
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Jul 13 12:16:48 2020 +0200
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Jul 13 19:31:48 2020 +0200

    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.
    
    Change-Id: I31a241910fd7bdf27579f291a497b76292eac775
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98628
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/filter/qa/unit/data/TransparentText.odg b/filter/qa/unit/data/TransparentText.odg
new file mode 100644
index 000000000000..d3027d17d657
Binary files /dev/null and b/filter/qa/unit/data/TransparentText.odg differ
diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx
index 9651881826c9..4589b417a0c2 100644
--- a/filter/qa/unit/svg.cxx
+++ b/filter/qa/unit/svg.cxx
@@ -122,6 +122,38 @@ 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);
+
+    xmlDocUniquePtr pXmlDoc = parseXmlStream(&aStream);
+
+    // 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: */


More information about the Libreoffice-commits mailing list