vcl/qa/cppunit/svm/svmtest.cxx |   82 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 78 insertions(+), 4 deletions(-)

New commits:
commit 920b347a088452e7220f0381bee114ec75bab241
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Mon Apr 29 07:48:43 2019 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Mon Apr 29 03:52:51 2019 +0200

    Add MetaActionWallpaper to the SVM test
    
    Change-Id: Icce9c3c5fa826b6f5237d2d0e28fc51555a3e267
    Reviewed-on: https://gerrit.libreoffice.org/71494
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx
index 50aa78fcfc2f..d8d9adf7b72b 100644
--- a/vcl/qa/cppunit/svm/svmtest.cxx
+++ b/vcl/qa/cppunit/svm/svmtest.cxx
@@ -108,7 +108,7 @@ class SvmTest : public test::BootstrapFixture, public 
XmlTestTools
     void checkHatch(const GDIMetaFile& rMetaFile);
     void testHatch();
 
-    //void checkWallpaper(const GDIMetaFile& rMetaFile);
+    void checkWallpaper(const GDIMetaFile& rMetaFile);
     void testWallpaper();
 
     //void checkClipRegion(const GDIMetaFile& rMetaFile);
@@ -1239,8 +1239,40 @@ void SvmTest::testHatch()
     checkHatch(writeAndRead(aGDIMetaFile, "hatch.svm"));
 }
 
+void SvmTest::checkWallpaper(const GDIMetaFile& rMetaFile)
+{
+    xmlDocPtr pDoc = dumpMeta(rMetaFile);
+
+    // Fuuny enough - we don't serialize the rectangle of the wallpaper so 
it's always EMPTY
+    assertXPathAttrs(pDoc, "/metafile/wallpaper[1]",
+    {
+        {"left", "0"},
+        {"top", "0"},
+        {"right", "-32767"},
+        {"bottom", "-32767"},
+    });
+
+    assertXPathAttrs(pDoc, "/metafile/wallpaper[1]/wallpaper",
+    {
+        {"color", "#00ff00"},
+        {"style", "Tile"},
+        {"fixed", "true"},
+        {"scrollable", "true"},
+    });
+}
+
 void SvmTest::testWallpaper()
-{}
+{
+    GDIMetaFile aGDIMetaFile;
+    ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
+    setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile);
+
+    Wallpaper aWallpaper(COL_LIGHTGREEN);
+    pVirtualDev->DrawWallpaper(tools::Rectangle(Point(1, 1), Size(3, 3)), 
aWallpaper);
+
+    checkWallpaper(writeAndRead(aGDIMetaFile, "wallpaper.svm"));
+}
+
 void SvmTest::testClipRegion()
 {}
 void SvmTest::testIntersectRectClipRegion()
commit 654a7ad5420ca26f90f449122fa96ea2a53af0cf
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Mon Apr 29 07:46:31 2019 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Mon Apr 29 03:52:39 2019 +0200

    Add MetaActionHatch to the SVM test
    
    Change-Id: I96113168d4ae8289cec3a5b0bbd6aa79faf97c48
    Reviewed-on: https://gerrit.libreoffice.org/71493
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    Tested-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx
index 107a8e4d1b36..50aa78fcfc2f 100644
--- a/vcl/qa/cppunit/svm/svmtest.cxx
+++ b/vcl/qa/cppunit/svm/svmtest.cxx
@@ -105,7 +105,7 @@ class SvmTest : public test::BootstrapFixture, public 
XmlTestTools
     //void checkGradientEx(const GDIMetaFile& rMetaFile);
     void testGradientEx();
 
-    //void checkHatch(const GDIMetaFile& rMetaFile);
+    void checkHatch(const GDIMetaFile& rMetaFile);
     void testHatch();
 
     //void checkWallpaper(const GDIMetaFile& rMetaFile);
@@ -1195,8 +1195,50 @@ void SvmTest::testGradient()
 
 void SvmTest::testGradientEx()
 {}
+
+void SvmTest::checkHatch(const GDIMetaFile& rMetaFile)
+{
+    xmlDocPtr pDoc = dumpMeta(rMetaFile);
+
+    assertXPathAttrs(pDoc, "/metafile/hatch[1]/polygon/point[1]", {
+        {"x", "1"}, {"y", "8"},
+    });
+    assertXPathAttrs(pDoc, "/metafile/hatch[1]/polygon/point[2]", {
+        {"x", "2"}, {"y", "7"},
+    });
+    assertXPathAttrs(pDoc, "/metafile/hatch[1]/polygon/point[3]", {
+        {"x", "3"}, {"y", "6"},
+    });
+
+    assertXPathAttrs(pDoc, "/metafile/hatch[1]/hatch", {
+        {"style", "Single"},
+        {"color", "#ffff00"},
+        {"distance", "15"},
+        {"angle", "900"},
+    });
+}
+
 void SvmTest::testHatch()
-{}
+{
+    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);
+
+    Hatch aHatch(HatchStyle::Single, COL_YELLOW, 15, 900);
+
+    pVirtualDev->DrawHatch(aPolyPolygon, aHatch);
+
+    checkHatch(writeAndRead(aGDIMetaFile, "hatch.svm"));
+}
+
 void SvmTest::testWallpaper()
 {}
 void SvmTest::testClipRegion()
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to