svgio/qa/cppunit/SvgImportTest.cxx | 18 ++++++++++++++++++ svgio/qa/cppunit/data/tdf160517.svg | 11 +++++++++++ sw/qa/extras/ooxmlexport/data/tdf158451.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport20.cxx | 12 ++++++++++++ vcl/source/bitmap/BitmapTools.cxx | 11 ++--------- 5 files changed, 43 insertions(+), 9 deletions(-)
New commits: commit 01479c742f2680d004ea8e133e56133870023b43 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Apr 18 22:10:43 2024 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Apr 19 09:08:25 2024 +0200 tdf#160721: nothing is displayed in case of wrong 'in' reference Change-Id: I746ec8a12dba7832241693dac7f20788a2fa85bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166267 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 3d6ef34d5857..8831dc5c9058 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -14,6 +14,7 @@ #include <test/xmltesttools.hxx> #include <comphelper/seqstream.hxx> +#include <comphelper/string.hxx> #include <com/sun/star/graphic/SvgTools.hpp> #include <com/sun/star/graphic/XPrimitive2D.hpp> @@ -1617,6 +1618,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf159968) "/primitive2D/transform/transform/transform/transform/polypolygoncolor/polypolygon/polygon/point"_ostr, 5); } +CPPUNIT_TEST_FIXTURE(Test, testTdf160517) +{ + xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf160517.svg"); + + assertXPath(pDocument, + "/primitive2D/transform/bitmap"_ostr, "height"_ostr, "100"); + assertXPath(pDocument, + "/primitive2D/transform/bitmap"_ostr, "width"_ostr, "100"); + assertXPath(pDocument, + "/primitive2D/transform/bitmap/data"_ostr, 100); + + // Check the color of a pixel in the middle + const OUString sDataRow = getXPath(pDocument, "/primitive2D/transform/bitmap/data[50]"_ostr, "row"_ostr); + std::vector<OUString> aPixels = comphelper::string::split(sDataRow, ','); + CPPUNIT_ASSERT_EQUAL(OUString("008100"), aPixels[50]); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf149880) { xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf149880.svg"); diff --git a/svgio/qa/cppunit/data/tdf160517.svg b/svgio/qa/cppunit/data/tdf160517.svg new file mode 100644 index 000000000000..ea0750c8af48 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf160517.svg @@ -0,0 +1,11 @@ +<svg width="230" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <filter id="filter"> + <feComposite + in="SourceGraphic" + in2="unknown" + operator="arithmetic" + k1="0" k2="0.5" k3="0" k4="0" /> + </filter> + <rect fill="green" filter="url(#filter)" x="10" y="10" width="100" height="100"/> +</svg> + diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx index 204e61b57073..b5186616bb5c 100644 --- a/vcl/source/bitmap/BitmapTools.cxx +++ b/vcl/source/bitmap/BitmapTools.cxx @@ -516,7 +516,7 @@ BitmapEx DrawBitmapInRect( const BitmapEx& rBitmap, ::basegfx::B2DRectangle const & rBitmapRect, ::basegfx::B2DRectangle const & rDestRect ) { - if( rBitmapRect.isEmpty() || rDestRect.isEmpty() ) + if( rDestRect.isEmpty() ) return BitmapEx(); const Size aDestBmpSize( ::basegfx::fround<tools::Long>( rDestRect.getWidth() ), @@ -537,13 +537,6 @@ BitmapEx DrawBitmapInRect( const BitmapEx& rBitmap, if (rBitmap.IsAlpha()) pAlphaReadAccess = aSrcAlpha; - if( !pReadAccess || (!pAlphaReadAccess && rBitmap.IsAlpha()) ) - { - // TODO(E2): Error handling! - ENSURE_OR_THROW( false, - "DrawBitmapInRect(): could not access source bitmap" ); - } - // mapping table, to translate pAlphaReadAccess' pixel // values into destination alpha values (needed e.g. for // paletted 1-bit masks). @@ -561,7 +554,7 @@ BitmapEx DrawBitmapInRect( const BitmapEx& rBitmap, } // else: mapping table is not used - Bitmap aDstBitmap(aDestBmpSize, aSrcBitmap.getPixelFormat(), &pReadAccess->GetPalette()); + Bitmap aDstBitmap(aDestBmpSize, vcl::PixelFormat::N24_BPP); Bitmap aDstAlpha( AlphaMask( aDestBmpSize ).GetBitmap() ); { commit e75899a25921aa8fc7857c154326a9aca4648c27 Author: Kira Tubo <kira.t...@gmail.com> AuthorDate: Wed Apr 3 21:17:11 2024 -0700 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Apr 19 09:08:14 2024 +0200 tdf#158451 - sw unit test - FILEOPEN DOCX crash Unit text checks if DOCX file crashes when opened. Document contains grouped shapes that is anchored "As character". Change-Id: I7df17de0e1f1bf252593548883ba7959f2002023 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165776 Tested-by: Xisco Fauli <xiscofa...@libreoffice.org> Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/ooxmlexport/data/tdf158451.docx b/sw/qa/extras/ooxmlexport/data/tdf158451.docx new file mode 100755 index 000000000000..e206cecd556c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf158451.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx index be378107df04..94f8872f263a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx @@ -1111,6 +1111,18 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf158971) } } +CPPUNIT_TEST_FIXTURE(Test, testTdf158451) +{ + //Without the test, crash occurs when document loads + loadAndReload("tdf158451.docx"); + //Asserts document contains grouped shapes with Anchor = "As Character" + CPPUNIT_ASSERT_EQUAL(1, getPages()); + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GroupShape"), getShape(1)->getShapeType()); + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, + getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf159110) { // Given a text with an URL with multiple spaces