sd/qa/unit/PNGExportTests.cxx | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
New commits: commit b461ada70158de5cd2e96a54147c8e46ee1ca4ac Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon Mar 7 16:09:40 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Mar 7 19:48:27 2022 +0100 tdf#136632: sd_png_export_tests: Add unittest Change-Id: I1d85f989dd2a56f693befcf995985a69f62354cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131114 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sd/qa/unit/PNGExportTests.cxx b/sd/qa/unit/PNGExportTests.cxx index 44a282f94a97..6af1b6ea0bb4 100644 --- a/sd/qa/unit/PNGExportTests.cxx +++ b/sd/qa/unit/PNGExportTests.cxx @@ -180,6 +180,45 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf126319) } } +CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf136632) +{ + // Reuse existing file + mxComponent + = loadFromDesktop(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf105998.odp")); + uno::Reference<uno::XComponentContext> xContext = getComponentContext(); + CPPUNIT_ASSERT(xContext.is()); + uno::Reference<drawing::XGraphicExportFilter> xGraphicExporter + = drawing::GraphicExportFilter::create(xContext); + + uno::Sequence<beans::PropertyValue> aFilterData{ comphelper::makePropertyValue("Translucent", + sal_Int32(0)) }; + + utl::TempFile aTempFile; + aTempFile.EnableKillingFile(); + + uno::Sequence<beans::PropertyValue> aDescriptor{ + comphelper::makePropertyValue("URL", aTempFile.GetURL()), + comphelper::makePropertyValue("FilterName", OUString("PNG")), + comphelper::makePropertyValue("FilterData", aFilterData) + }; + + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + uno::Reference<lang::XComponent> xShape(xPage->getByIndex(0), uno::UNO_QUERY); + xGraphicExporter->setSourceDocument(xShape); + xGraphicExporter->filter(aDescriptor); + + SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ); + vcl::PngImageReader aPNGReader(aFileStream); + BitmapEx aBMPEx = aPNGReader.read(); + AlphaMask aAlpha = aBMPEx.GetAlpha(); + AlphaMask::ScopedReadAccess pReadAccess(aAlpha); + + // Without the fix in place, this test would have failed here + CPPUNIT_ASSERT(!pReadAccess); +} + CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf113163) { mxComponent