summaryrefslogtreecommitdiff
path: root/vcl/qa/cppunit/svm/svmtest.cxx
diff options
context:
space:
mode:
authorpanoskorovesis <panoskorovesis@outlook.com>2021-06-23 13:52:32 +0300
committerTomaž Vajngerl <quikee@gmail.com>2021-06-28 13:55:01 +0200
commitd1eb1e6e487fad489b7c80b68613290da6edfe8a (patch)
treefe99fac1ea5ab8a15c46cbf0fe20ca633eed8485 /vcl/qa/cppunit/svm/svmtest.cxx
parent4a6ddaadd75ae21cc251f461327a5f472241a41e (diff)
Add EPS cppunit test to vcl.
The test creates an EPS along with a second metafile and tests their attributes. mtfxmldump.cxx was edited to support EPS. Change-Id: I43495304aaf191e1a8ad034b96ff59de085a0630 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117702 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/qa/cppunit/svm/svmtest.cxx')
-rw-r--r--vcl/qa/cppunit/svm/svmtest.cxx77
1 files changed, 75 insertions, 2 deletions
diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx
index c260a974282d..abe76a85e606 100644
--- a/vcl/qa/cppunit/svm/svmtest.cxx
+++ b/vcl/qa/cppunit/svm/svmtest.cxx
@@ -183,7 +183,7 @@ class SvmTest : public test::BootstrapFixture, public XmlTestTools
//void checkFloatTransparent(const GDIMetaFile& rMetaFile);
void testFloatTransparent();
- //void checkEPS(const GDIMetaFile& rMetaFile);
+ void checkEPS(const GDIMetaFile& rMetaFile);
void testEPS();
void checkRefPoint(const GDIMetaFile& rMetaFile);
@@ -2035,8 +2035,81 @@ void SvmTest::testTransparent()
void SvmTest::testFloatTransparent()
{}
+void SvmTest::checkEPS(const GDIMetaFile& rMetaFile)
+{
+ xmlDocUniquePtr pDoc = dumpMeta(rMetaFile);
+
+ assertXPathAttrs(pDoc, "/metafile/eps[1]", {
+ {"x", "1"},
+ {"y", "8"},
+ {"width", "2"},
+ {"height", "7"}
+ });
+
+ assertXPathAttrs(pDoc, "/metafile/eps[1]/gfxlink[1]", {
+ {"width", "3"},
+ {"height", "6"},
+ {"type", "EpsBuffer"},
+ {"userid", "12345"},
+ {"datasize", "3"},
+ {"data", "616263"},
+ {"native", "false"},
+ {"emf", "false"},
+ {"validmapmode", "true"}
+ });
+
+ assertXPathAttrs(pDoc, "/metafile/eps[1]/gfxlink[1]/prefmapmode[1]", {
+ {"mapunit", "Map100thInch"},
+ {"x", "0"},
+ {"y", "1"},
+ {"scalex", "(1/2)"},
+ {"scaley", "(2/3)"}
+ });
+
+ assertXPathAttrs(pDoc, "/metafile/eps[1]/metafile[1]/point[1]", {
+ {"x", "1"},
+ {"y", "8"}
+ });
+
+ assertXPathAttrs(pDoc, "/metafile/eps[1]/metafile[1]/point[2]", {
+ {"x", "2"},
+ {"y", "7"}
+ });
+}
+
void SvmTest::testEPS()
-{}
+{
+ GDIMetaFile aGDIMetaFile;
+ ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
+ setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile);
+
+ sal_uInt32 nDataSize = 3;
+ std::unique_ptr<sal_uInt8[]> pBuffer (new sal_uInt8[nDataSize]);
+ pBuffer[0] = 'a';
+ pBuffer[1] = 'b';
+ pBuffer[2] = 'c';
+
+ MapMode aMapMode1(MapUnit::Map100thInch);
+ aMapMode1.SetOrigin(Point(0, 1));
+ aMapMode1.SetScaleX(Fraction(1, 2));
+ aMapMode1.SetScaleY(Fraction(2, 3));
+
+ GDIMetaFile aGDIMetaFile1;
+ ScopedVclPtrInstance<VirtualDevice> pVirtualDev1;
+ setupBaseVirtualDevice(*pVirtualDev1, aGDIMetaFile1);
+
+ pVirtualDev1->DrawPixel(Point(1, 8));
+ pVirtualDev1->DrawPixel(Point(2, 7));
+
+ GfxLink aGfxLink(std::move(pBuffer), nDataSize, GfxLinkType::EpsBuffer);
+ aGfxLink.SetPrefMapMode(aMapMode1);
+ aGfxLink.SetUserId(12345);
+ aGfxLink.SetPrefSize(Size(3, 6));
+ pVirtualDev->DrawEPS(Point(1, 8), Size(2, 7), aGfxLink, &aGDIMetaFile1);
+
+ checkEPS(writeAndReadStream(aGDIMetaFile));
+ checkEPS(readFile(u"eps.svm"));
+}
void SvmTest::checkRefPoint(const GDIMetaFile& rMetaFile)
{