[Libreoffice-commits] core.git: 2 commits - vcl/qa

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 29 01:54:37 UTC 2019


 vcl/qa/cppunit/svm/svmtest.cxx |   81 +++++++++++++++++++++++++++++++++++++----
 1 file changed, 75 insertions(+), 6 deletions(-)

New commits:
commit 4c868602960a362edbea28a53535bdee4cfc2230
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Apr 29 07:57:23 2019 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Apr 29 03:53:50 2019 +0200

    Add MetaActionTransparent to the SVM test
    
    Change-Id: Ia927070883e5647b61876e31d6a0a085e2456f8a
    Reviewed-on: https://gerrit.libreoffice.org/71498
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx
index 406eeb551360..a4cecaa12b14 100644
--- a/vcl/qa/cppunit/svm/svmtest.cxx
+++ b/vcl/qa/cppunit/svm/svmtest.cxx
@@ -156,7 +156,7 @@ class SvmTest : public test::BootstrapFixture, public XmlTestTools
     void checkRasterOp(const GDIMetaFile& rMetaFile);
     void testRasterOp();
 
-    //void checkTransparent(const GDIMetaFile& rMetaFile);
+    void checkTransparent(const GDIMetaFile& rMetaFile);
     void testTransparent();
 
     //void checkFloatTransparent(const GDIMetaFile& rMetaFile);
@@ -1517,8 +1517,43 @@ void SvmTest::testRasterOp()
     checkRasterOp(writeAndRead(aGDIMetaFile, "rasterop.svm"));
 }
 
+void SvmTest::checkTransparent(const GDIMetaFile& rMetaFile)
+{
+    xmlDocPtr pDoc = dumpMeta(rMetaFile);
+
+    assertXPathAttrs(pDoc, "/metafile/transparent[1]", {
+        {"transparence", "50"},
+    });
+
+    assertXPathAttrs(pDoc, "/metafile/transparent[1]/polygon/point[1]", {
+        {"x", "1"}, {"y", "8"},
+    });
+    assertXPathAttrs(pDoc, "/metafile/transparent[1]/polygon/point[2]", {
+        {"x", "2"}, {"y", "7"},
+    });
+    assertXPathAttrs(pDoc, "/metafile/transparent[1]/polygon/point[3]", {
+        {"x", "3"}, {"y", "6"},
+    });
+}
+
 void SvmTest::testTransparent()
-{}
+{
+    GDIMetaFile aGDIMetaFile;
+    ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
+    setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile);
+
+    tools::Polygon aPolygon(3);
+    aPolygon.SetPoint(Point(1, 8), 0);
+    aPolygon.SetPoint(Point(2, 7), 1);
+    aPolygon.SetPoint(Point(3, 6), 2);
+
+    tools::PolyPolygon aPolyPolygon(1);
+    aPolyPolygon.Insert(aPolygon);
+
+    pVirtualDev->DrawTransparent(aPolygon, 50);
+
+    checkTransparent(writeAndRead(aGDIMetaFile, "transparent.svm"));
+}
 
 void SvmTest::testFloatTransparent()
 {}
commit 405bfa05226116d05f1b87c92d4760dbab184314
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Apr 29 07:56:07 2019 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Apr 29 03:53:34 2019 +0200

    Add TextAlign,RasterOp to the SVM test
    
    Change-Id: I58b7bb114864a9fdf901a92d54717964c6f1b68e
    Reviewed-on: https://gerrit.libreoffice.org/71497
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx
index 541822ef25e6..406eeb551360 100644
--- a/vcl/qa/cppunit/svm/svmtest.cxx
+++ b/vcl/qa/cppunit/svm/svmtest.cxx
@@ -141,7 +141,7 @@ class SvmTest : public test::BootstrapFixture, public XmlTestTools
     void checkOverLineColor(const GDIMetaFile& rMetaFile);
     void testOverLineColor();
 
-    //void checkTextAlign(const GDIMetaFile& rMetaFile);
+    void checkTextAlign(const GDIMetaFile& rMetaFile);
     void testTextAlign();
 
     //void checkMapMode(const GDIMetaFile& rMetaFile);
@@ -153,7 +153,7 @@ class SvmTest : public test::BootstrapFixture, public XmlTestTools
     void checkPushPop(const GDIMetaFile& rMetaFile);
     void testPushPop();
 
-    //void checkRasterOp(const GDIMetaFile& rMetaFile);
+    void checkRasterOp(const GDIMetaFile& rMetaFile);
     void testRasterOp();
 
     //void checkTransparent(const GDIMetaFile& rMetaFile);
@@ -1435,8 +1435,25 @@ void SvmTest::testOverLineColor()
     checkOverLineColor(writeAndRead(aGDIMetaFile, "overlinecolor.svm"));
 }
 
+void SvmTest::checkTextAlign(const GDIMetaFile& rMetaFile)
+{
+    xmlDocPtr pDoc = dumpMeta(rMetaFile);
+
+    assertXPathAttrs(pDoc, "/metafile/textalign[1]", {
+        {"align", "bottom"},
+    });
+}
+
 void SvmTest::testTextAlign()
-{}
+{
+    GDIMetaFile aGDIMetaFile;
+    ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
+    setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile);
+
+    pVirtualDev->SetTextAlign(TextAlign::ALIGN_BOTTOM);
+
+    checkTextAlign(writeAndRead(aGDIMetaFile, "textalign.svm"));
+}
 
 void SvmTest::testMapMode()
 {}
@@ -1480,8 +1497,25 @@ void SvmTest::testPushPop()
     checkPushPop(writeAndRead(aGDIMetaFile, "pushpop.svm"));
 }
 
+void SvmTest::checkRasterOp(const GDIMetaFile& rMetaFile)
+{
+    xmlDocPtr pDoc = dumpMeta(rMetaFile);
+
+    assertXPathAttrs(pDoc, "/metafile/rasterop[1]", {
+        {"operation", "xor"},
+    });
+}
+
 void SvmTest::testRasterOp()
-{}
+{
+    GDIMetaFile aGDIMetaFile;
+    ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
+    setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile);
+
+    pVirtualDev->SetRasterOp(RasterOp::Xor);
+
+    checkRasterOp(writeAndRead(aGDIMetaFile, "rasterop.svm"));
+}
 
 void SvmTest::testTransparent()
 {}


More information about the Libreoffice-commits mailing list