[Libreoffice-commits] core.git: vcl/qa
panoskorovesis (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jun 28 11:56:16 UTC 2021
vcl/qa/cppunit/svm/data/floattransparent.svm |binary
vcl/qa/cppunit/svm/svmtest.cxx | 58 ++++++++++++++++++++++++++-
2 files changed, 56 insertions(+), 2 deletions(-)
New commits:
commit 0aa7ee7827fc77b5b4c0479402bfbd9a4e5d9e84
Author: panoskorovesis <panoskorovesis at outlook.com>
AuthorDate: Wed Jun 23 10:54:23 2021 +0300
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Jun 28 13:55:44 2021 +0200
Add FloatTransparent cppunit test to vcl.
The test draws a transparent, along with a second metafile
and tests their attributes.
Change-Id: I42b6ff6eec29fecdafc7f634551c894a16b63173
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117694
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/vcl/qa/cppunit/svm/data/floattransparent.svm b/vcl/qa/cppunit/svm/data/floattransparent.svm
new file mode 100644
index 000000000000..802fa7078219
Binary files /dev/null and b/vcl/qa/cppunit/svm/data/floattransparent.svm differ
diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx
index abe76a85e606..953f97d0b8b6 100644
--- a/vcl/qa/cppunit/svm/svmtest.cxx
+++ b/vcl/qa/cppunit/svm/svmtest.cxx
@@ -180,7 +180,7 @@ class SvmTest : public test::BootstrapFixture, public XmlTestTools
void checkTransparent(const GDIMetaFile& rMetaFile);
void testTransparent();
- //void checkFloatTransparent(const GDIMetaFile& rMetaFile);
+ void checkFloatTransparent(const GDIMetaFile& rMetaFile);
void testFloatTransparent();
void checkEPS(const GDIMetaFile& rMetaFile);
@@ -2032,8 +2032,62 @@ void SvmTest::testTransparent()
checkTransparent(readFile(u"transparent.svm"));
}
+void SvmTest::checkFloatTransparent(const GDIMetaFile& rMetaFile)
+{
+ xmlDocUniquePtr pDoc = dumpMeta(rMetaFile);
+
+ assertXPathAttrs(pDoc, "/metafile/floattransparent[1]", {
+ {"x", "1"},
+ {"y", "2"},
+ {"width", "3"},
+ {"height", "4"},
+ {"transparent", "true"}
+ });
+
+ assertXPathAttrs(pDoc, "/metafile/floattransparent[1]/gradient[1]", {
+ {"style", "Linear"},
+ {"startcolor", "#ffffff"},
+ {"endcolor", "#000000"},
+ {"angle", "0"},
+ {"border", "0"},
+ {"offsetx", "50"},
+ {"offsety", "50"},
+ {"startintensity", "100"},
+ {"endintensity", "100"},
+ {"steps", "0"}
+ });
+
+ assertXPathAttrs(pDoc, "/metafile/floattransparent[1]/metafile[1]/point[1]", {
+ {"x", "1"},
+ {"y", "8"}
+ });
+
+ assertXPathAttrs(pDoc, "/metafile/floattransparent[1]/metafile[1]/point[2]", {
+ {"x", "2"},
+ {"y", "7"}
+ });
+}
+
void SvmTest::testFloatTransparent()
-{}
+{
+ GDIMetaFile aGDIMetaFile;
+ ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
+ setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile);
+
+ GDIMetaFile aGDIMetaFile1;
+ ScopedVclPtrInstance<VirtualDevice> pVirtualDev1;
+ setupBaseVirtualDevice(*pVirtualDev1, aGDIMetaFile1);
+
+ pVirtualDev1->DrawPixel(Point(1, 8));
+ pVirtualDev1->DrawPixel(Point(2, 7));
+
+ Gradient aGradient(GradientStyle::Linear, COL_WHITE, COL_BLACK);
+
+ pVirtualDev->DrawTransparent(aGDIMetaFile1, Point(1, 2), Size(3, 4), aGradient);
+
+ checkFloatTransparent(writeAndReadStream(aGDIMetaFile));
+ checkFloatTransparent(readFile(u"floattransparent.svm"));
+}
void SvmTest::checkEPS(const GDIMetaFile& rMetaFile)
{
More information about the Libreoffice-commits
mailing list