diff options
author | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2021-06-22 14:36:15 +0200 |
---|---|---|
committer | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2021-07-03 14:59:06 +0200 |
commit | 4992780d2bc996c111b333549314d72f6891308d (patch) | |
tree | 23a018e12dd22452c63b5314a44639a77219614c /emfio/qa/cppunit/emf | |
parent | ded2452a52d21131347a0dc2e25c8161f20fcfad (diff) |
EMF+ tdf#142941 Fixes for SrcRect in DrawImagePoints
The SrcRect could be specified outside of source bitmap.
In such cases the Destination bitmap should be displayed as shifted
(eg. if position is negative), and scaled properly.
Change-Id: Ied6d339703999faaae061802ef6a28e190d5a176
Change-Id: Ia9772ced282684c2c94a261d97d30b53921d6171
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118345
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'emfio/qa/cppunit/emf')
-rw-r--r-- | emfio/qa/cppunit/emf/EmfImportTest.cxx | 34 | ||||
-rw-r--r-- | emfio/qa/cppunit/emf/data/TestDrawImagePointsTypeBitmap.emf | bin | 0 -> 8600 bytes |
2 files changed, 34 insertions, 0 deletions
diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx index 63e1d575803b..c60a4870f6f1 100644 --- a/emfio/qa/cppunit/emf/EmfImportTest.cxx +++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx @@ -46,6 +46,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools, public unotest: uno::Reference<lang::XComponent> mxComponent; void testPolyPolygon(); + void TestDrawImagePointsTypeBitmap(); void TestDrawString(); void TestDrawStringAlign(); void TestDrawStringTransparent(); @@ -87,6 +88,7 @@ public: CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testPolyPolygon); + CPPUNIT_TEST(TestDrawImagePointsTypeBitmap); CPPUNIT_TEST(TestDrawString); CPPUNIT_TEST(TestDrawStringAlign); CPPUNIT_TEST(TestDrawStringTransparent); @@ -190,6 +192,38 @@ void Test::testPolyPolygon() } +void Test::TestDrawImagePointsTypeBitmap() +{ + // tdf#142941 EMF+ file with ObjectTypeImage, FillRects, DrawImagePoints ,records + // The test is checking the position of displaying bitmap with too large SrcRect + + Primitive2DSequence aSequence + = parseEmf(u"/emfio/qa/cppunit/emf/data/TestDrawImagePointsTypeBitmap.emf"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument + = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence)); + CPPUNIT_ASSERT(pDocument); + + assertXPath(pDocument, "/primitive2D/metafile/transform/polypolygoncolor", "color", "#0080ff"); + assertXPath(pDocument, "/primitive2D/metafile/transform/bitmap", "xy11", "5346"); + assertXPath(pDocument, "/primitive2D/metafile/transform/bitmap", "xy12", "0"); + assertXPath(pDocument, "/primitive2D/metafile/transform/bitmap", "xy13", "5558"); + assertXPath(pDocument, "/primitive2D/metafile/transform/bitmap", "xy21", "0"); + assertXPath(pDocument, "/primitive2D/metafile/transform/bitmap", "xy22", "4716"); + assertXPath(pDocument, "/primitive2D/metafile/transform/bitmap", "xy23", "5564"); + assertXPath( + pDocument, "/primitive2D/metafile/transform/bitmap/data[2]", "row", + "020202,ffffff,ffffff,ffffff,fefefe,ffffff,ffffff,fefefe,ffffff,ffffff,f8f8f8,ffffff," + "fdfdfd,ffffff,ffffff,fdfdfd,ffffff,ffffff,ffffff,fbfbfb,010101,ffffff,fefefe,ffffff," + "ffffff,fbfbfb,ffffff,fdfdfd,fcfcfc,fdfdfd,ffffff,ffffff,ffffff,ffffff,ffffff,ffffff," + "ffffff,ffffff,ffffff,ffffff,020202,fdfdfd,ffffff,ffffff,fefefe,ffffff,ffffff,ffffff," + "ffffff,fbfbfb,fefefe,ffffff,fcfcfc,ffffff,fdfdfd,ffffff,ffffff,ffffff,ffffff,fbfbfb," + "010101,ffffff,fefefe,ffffff,ffffff,ffffff,fcfcfc,ffffff,fafafa,ffffff,ffffff,fefefe," + "ffffff,fdfdfd,fefefe,fefefe,ffffff,ffffff,fdfdfd,fffbfb,1e0000,8f4347,b13a3e,b82d32," + "bb3438,b73237,b63338,b33035,b63338"); +} + void Test::TestDrawString() { #if HAVE_MORE_FONTS diff --git a/emfio/qa/cppunit/emf/data/TestDrawImagePointsTypeBitmap.emf b/emfio/qa/cppunit/emf/data/TestDrawImagePointsTypeBitmap.emf Binary files differnew file mode 100644 index 000000000000..291052a165a8 --- /dev/null +++ b/emfio/qa/cppunit/emf/data/TestDrawImagePointsTypeBitmap.emf |