summaryrefslogtreecommitdiff
path: root/sw/qa/core
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/core')
-rw-r--r--sw/qa/core/text/text.cxx32
1 files changed, 32 insertions, 0 deletions
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 8074cbc9f45e..4e6d4fcdb14e 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -8,6 +8,9 @@
*/
#include <swmodeltestbase.hxx>
+
+#include <vcl/gdimtf.hxx>
+
#include <wrtsh.hxx>
static char const DATA_DIRECTORY[] = "/sw/qa/core/text/data/";
@@ -46,6 +49,35 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testFootnoteConnect)
pWrtShell->DelLeft();
}
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testSemiTransparentText)
+{
+ // Create an in-memory empty document.
+ loadURL("private:factory/swriter", nullptr);
+
+ // Set text to half-transparent and type a character.
+ uno::Reference<beans::XPropertySet> xParagraph(getParagraph(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xParagraph.is());
+ sal_Int16 nTransparence = 50;
+ xParagraph->setPropertyValue("CharTransparence", uno::makeAny(nTransparence));
+ uno::Reference<text::XTextRange> xTextRange(xParagraph, uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xTextRange.is());
+ xTextRange->setString("x");
+
+ // Render the document to a metafile.
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+ SwDocShell* pDocShell = pTextDoc->GetDocShell();
+ CPPUNIT_ASSERT(pDocShell);
+ std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile();
+ CPPUNIT_ASSERT(xMetaFile);
+
+ // Make sure that DrawTransparent() was used during rendering.
+ MetafileXmlDump dumper;
+ xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+ CPPUNIT_ASSERT(pXmlDoc);
+ assertXPath(pXmlDoc, "//floattransparent");
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */