summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-06-10 10:24:13 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-10 12:00:05 +0200
commit266a3bad6d0537e309922ddafe3a6d4119e2c50c (patch)
tree47ef6b852d864a2405c855fb2ecd018dcd08e3fd
parent76e2c20876319cbeea24d40104fac1ba7d6b5278 (diff)
tdf#142629: vcl_filters_test: Add unittest
Change-Id: Id0397bc8e16eb22853ce3388f8ef3cc8f8558692 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116961 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--vcl/qa/cppunit/graphicfilter/data/psd/tdf142629.psdbin0 -> 53812 bytes
-rw-r--r--vcl/qa/cppunit/graphicfilter/filters-psd-test.cxx27
2 files changed, 25 insertions, 2 deletions
diff --git a/vcl/qa/cppunit/graphicfilter/data/psd/tdf142629.psd b/vcl/qa/cppunit/graphicfilter/data/psd/tdf142629.psd
new file mode 100644
index 000000000000..097536bcc484
--- /dev/null
+++ b/vcl/qa/cppunit/graphicfilter/data/psd/tdf142629.psd
Binary files differ
diff --git a/vcl/qa/cppunit/graphicfilter/filters-psd-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-psd-test.cxx
index 4ff25b18636a..bf181f811e76 100644
--- a/vcl/qa/cppunit/graphicfilter/filters-psd-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-psd-test.cxx
@@ -12,6 +12,7 @@
#include <vcl/FilterConfigItem.hxx>
#include <tools/stream.hxx>
#include <vcl/graph.hxx>
+#include <vcl/graphicfilter.hxx>
#include <filter/PsdReader.hxx>
using namespace css;
@@ -29,13 +30,20 @@ public:
const OUString &rURL, const OUString &,
SfxFilterFlags, SotClipboardFormatId, unsigned int) override;
+ OUString getUrl() const
+ {
+ return m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/psd/");
+ }
+
/**
* Ensure CVEs remain unbroken
*/
void testCVEs();
+ void testTdf142629();
CPPUNIT_TEST_SUITE(PsdFilterTest);
CPPUNIT_TEST(testCVEs);
+ CPPUNIT_TEST(testTdf142629);
CPPUNIT_TEST_SUITE_END();
};
@@ -51,11 +59,26 @@ bool PsdFilterTest::load(const OUString &,
void PsdFilterTest::testCVEs()
{
#ifndef DISABLE_CVE_TESTS
- testDir(OUString(),
- m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/psd/"));
+ testDir(OUString(), getUrl());
#endif
}
+void PsdFilterTest::testTdf142629()
+{
+ OUString aURL = getUrl() + "tdf142629.psd";
+ SvFileStream aFileStream(aURL, StreamMode::READ);
+ Graphic aGraphic;
+ GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
+
+ ErrCode bResult = rFilter.ImportGraphic(aGraphic, aURL, aFileStream);
+
+ // Without the fix in place, the following asserts would have failed
+ CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult);
+
+ CPPUNIT_ASSERT(aGraphic.IsAlpha());
+ CPPUNIT_ASSERT(aGraphic.IsTransparent());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(PsdFilterTest);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */