summaryrefslogtreecommitdiff
path: root/emfio/qa
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2021-06-22 14:36:15 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-07-07 22:00:24 +0200
commit032b00382f654962ec787029b3a887f9efbd2a3d (patch)
treeb97b74aff9daf9fb060bb0e7910c7d1e0d3afd5b /emfio/qa
parent70e86db58bd04d919b3f67efad6c94dc967fd900 (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> (cherry picked from commit 4992780d2bc996c111b333549314d72f6891308d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118304 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'emfio/qa')
-rw-r--r--emfio/qa/cppunit/emf/EmfImportTest.cxx34
-rw-r--r--emfio/qa/cppunit/emf/data/TestDrawImagePointsTypeBitmap.emfbin0 -> 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 7e28b2a326d0..f894c2d9a666 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
new file mode 100644
index 000000000000..291052a165a8
--- /dev/null
+++ b/emfio/qa/cppunit/emf/data/TestDrawImagePointsTypeBitmap.emf
Binary files differ