[Libreoffice-commits] core.git: vcl/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jun 10 10:00:41 UTC 2021
vcl/qa/cppunit/graphicfilter/data/psd/tdf142629.psd |binary
vcl/qa/cppunit/graphicfilter/filters-psd-test.cxx | 27 ++++++++++++++++++--
2 files changed, 25 insertions(+), 2 deletions(-)
New commits:
commit 266a3bad6d0537e309922ddafe3a6d4119e2c50c
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Jun 10 10:24:13 2021 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Jun 10 12:00:05 2021 +0200
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 at libreoffice.org>
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
Binary files /dev/null and b/vcl/qa/cppunit/graphicfilter/data/psd/tdf142629.psd 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: */
More information about the Libreoffice-commits
mailing list