vcl/qa/cppunit/svm/data/intersectrectclipregion.svm |binary vcl/qa/cppunit/svm/data/intersectregionclipregion.svm |binary vcl/qa/cppunit/svm/svmtest.cxx | 96 +++++++++++++++++- 3 files changed, 92 insertions(+), 4 deletions(-)
New commits: commit 794eda02133699830913b37e094a07edeaeff22d Author: panoskorovesis <panoskorove...@outlook.com> AuthorDate: Thu Jun 10 11:51:32 2021 +0300 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Fri Jun 11 03:07:42 2021 +0200 Add IntersectClipRegion cppunit tests to vcl Two tests where added, IntersectRectClipRegion and IntersectRegionClipRegion, along with their .svm files. The tests create mutliple IntersectClipRegions and test their attributes. Change-Id: I33b7b13b4f3eef1de07cc063ef22fea034d65cfc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116967 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/vcl/qa/cppunit/svm/data/intersectrectclipregion.svm b/vcl/qa/cppunit/svm/data/intersectrectclipregion.svm new file mode 100644 index 000000000000..23179cbe8a27 Binary files /dev/null and b/vcl/qa/cppunit/svm/data/intersectrectclipregion.svm differ diff --git a/vcl/qa/cppunit/svm/data/intersectregionclipregion.svm b/vcl/qa/cppunit/svm/data/intersectregionclipregion.svm new file mode 100644 index 000000000000..6f8571863282 Binary files /dev/null and b/vcl/qa/cppunit/svm/data/intersectregionclipregion.svm differ diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx index 844a12bd1214..ec9c80614e22 100644 --- a/vcl/qa/cppunit/svm/svmtest.cxx +++ b/vcl/qa/cppunit/svm/svmtest.cxx @@ -128,10 +128,10 @@ class SvmTest : public test::BootstrapFixture, public XmlTestTools void checkClipRegion(const GDIMetaFile& rMetaFile); void testClipRegion(); - //void checkIntersectRectClipRegion(const GDIMetaFile& rMetaFile); + void checkIntersectRectClipRegion(const GDIMetaFile& rMetaFile); void testIntersectRectClipRegion(); - //void checkIntersectRegionClipRegion(const GDIMetaFile& rMetaFile); + void checkIntersectRegionClipRegion(const GDIMetaFile& rMetaFile); void testIntersectRegionClipRegion(); //void checkMoveClipRegion(const GDIMetaFile& rMetaFile); @@ -1467,10 +1467,98 @@ void SvmTest::testClipRegion() checkClipRegion(readFile(u"clipregion.svm")); } +void SvmTest::checkIntersectRectClipRegion(const GDIMetaFile& rMetaFile) +{ + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); + + assertXPathAttrs(pDoc, "/metafile/sectregionclipregion[1]", { + {"left", "1"}, + {"top", "2"}, + {"right", "4"}, + {"bottom", "9"} + }); +} + void SvmTest::testIntersectRectClipRegion() -{} +{ + GDIMetaFile aGDIMetaFile; + ScopedVclPtrInstance<VirtualDevice> pVirtualDev; + setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile); + + tools::Rectangle aRectangle(Point(1, 2), Size(4, 8)); + + vcl::Region aRegion(aRectangle); + + pVirtualDev->IntersectClipRegion(aRegion); + checkIntersectRectClipRegion(writeAndReadStream(aGDIMetaFile)); + checkIntersectRectClipRegion(readFile(u"intersectrectclipregion.svm")); +} + +void SvmTest::checkIntersectRegionClipRegion(const GDIMetaFile& rMetaFile) +{ + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); + + assertXPathAttrs(pDoc, "/metafile/sectregionclipregion[1]", { + {"left", "1"}, + {"top", "2"}, + {"right", "5"}, + {"bottom", "6"} + }); + + assertXPathAttrs(pDoc, "/metafile/sectregionclipregion[2]", { + {"left", "1"}, + {"top", "2"}, + {"right", "7"}, + {"bottom", "8"} + }); + + assertXPathAttrs(pDoc, "/metafile/sectregionclipregion[3]", { + {"left", "0"}, + {"top", "3"}, + {"right", "2"}, + {"bottom", "6"} + }); +} + void SvmTest::testIntersectRegionClipRegion() -{} +{ + GDIMetaFile aGDIMetaFile; + ScopedVclPtrInstance<VirtualDevice> pVirtualDev; + setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile); + + tools::Polygon aPolygon(3); + aPolygon.SetPoint(Point(1, 2), 0); + aPolygon.SetPoint(Point(3, 4), 1); + aPolygon.SetPoint(Point(5, 6), 2); + + vcl::Region aRegion(aPolygon); + pVirtualDev->IntersectClipRegion(aRegion); + + tools::Polygon aPolygon1(2); + aPolygon1.SetPoint(Point(5, 6), 0); + aPolygon1.SetPoint(Point(7, 8), 1); + + tools::PolyPolygon aPolyPolygon(2); + aPolyPolygon.Insert(aPolygon); + aPolyPolygon.Insert(aPolygon1); + + vcl::Region aRegion1(aPolyPolygon); + pVirtualDev->IntersectClipRegion(aRegion1); + + basegfx::B2DPolygon aB2DPolygon; + aB2DPolygon.append(basegfx::B2DPoint(0.0, 3.3)); + aB2DPolygon.append(basegfx::B2DPoint(1.1, 4.4)); + aB2DPolygon.append(basegfx::B2DPoint(2.2, 5.5)); + + basegfx::B2DPolyPolygon aB2DPolyPolygon(aB2DPolygon); + + vcl::Region aRegion2(aB2DPolyPolygon); + pVirtualDev->IntersectClipRegion(aRegion2); + + checkIntersectRegionClipRegion(writeAndReadStream(aGDIMetaFile)); + checkIntersectRegionClipRegion(readFile(u"intersectregionclipregion.svm")); +} + void SvmTest::testMoveClipRegion() {} _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits