From 1adbb3e00593af8eed5baf7019fa9b177186567c Mon Sep 17 00:00:00 2001 From: panoskorovesis Date: Wed, 9 Jun 2021 10:03:34 +0300 Subject: Add RefPoint cppunit test to vcl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test creates two RefPoints. A default one and one using a Point. Then checks their attributes Change-Id: I7ae3d6498f776d00dee3d084d13f0764942af5c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116780 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- vcl/qa/cppunit/svm/data/refpoint.svm | Bin 0 -> 247 bytes vcl/qa/cppunit/svm/svmtest.cxx | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 vcl/qa/cppunit/svm/data/refpoint.svm (limited to 'vcl') diff --git a/vcl/qa/cppunit/svm/data/refpoint.svm b/vcl/qa/cppunit/svm/data/refpoint.svm new file mode 100644 index 000000000000..e6412f9083b2 Binary files /dev/null and b/vcl/qa/cppunit/svm/data/refpoint.svm differ diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx index 06ec5841f8f6..0331502d1041 100644 --- a/vcl/qa/cppunit/svm/svmtest.cxx +++ b/vcl/qa/cppunit/svm/svmtest.cxx @@ -179,7 +179,7 @@ class SvmTest : public test::BootstrapFixture, public XmlTestTools //void checkEPS(const GDIMetaFile& rMetaFile); void testEPS(); - //void checkRefPoint(const GDIMetaFile& rMetaFile); + void checkRefPoint(const GDIMetaFile& rMetaFile); void testRefPoint(); //void checkComment(const GDIMetaFile& rMetaFile); @@ -1636,8 +1636,36 @@ void SvmTest::testFloatTransparent() void SvmTest::testEPS() {} +void SvmTest::checkRefPoint(const GDIMetaFile& rMetaFile) +{ + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); + + assertXPathAttrs(pDoc, "/metafile/refpoint[1]", { + {"x", "0"}, + {"y", "0"}, + {"set", "false"} + }); + + assertXPathAttrs(pDoc, "/metafile/refpoint[2]", { + {"x", "1"}, + {"y", "2"}, + {"set", "true"} + }); +} + void SvmTest::testRefPoint() -{} +{ + GDIMetaFile aGDIMetaFile; + ScopedVclPtrInstance pVirtualDev; + setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile); + + pVirtualDev->SetRefPoint(); + + pVirtualDev->SetRefPoint(Point(1,2)); + + checkRefPoint(writeAndReadStream(aGDIMetaFile)); + checkRefPoint(readFile(u"refpoint.svm")); +} void SvmTest::testComment() {} -- cgit