diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-03-07 16:09:40 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-03-07 19:48:27 +0100 |
commit | b461ada70158de5cd2e96a54147c8e46ee1ca4ac (patch) | |
tree | 5e237d464aea210ccb6d92db567a1fea12af91b3 /sd/qa/unit/PNGExportTests.cxx | |
parent | 794b93daa9bc31f4ca78d5d88a8dafb12f7ff869 (diff) |
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 <xiscofauli@libreoffice.org>
Diffstat (limited to 'sd/qa/unit/PNGExportTests.cxx')
-rw-r--r-- | sd/qa/unit/PNGExportTests.cxx | 39 |
1 files changed, 39 insertions, 0 deletions
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 |