[Libreoffice-commits] core.git: filter/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Fri Dec 18 08:47:40 UTC 2020


 filter/qa/cppunit/data/tiff/tdf115863.tif |binary
 filter/qa/cppunit/filters-tiff-test.cxx   |   31 +++++++++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 1 deletion(-)

New commits:
commit e57665ea6f812aff9fc87073ce947f40a8b26e9d
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Dec 17 21:48:07 2020 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Dec 18 09:46:58 2020 +0100

    tdf#115863: libtest_filter_tiff: Add unittest
    
    Change-Id: I4877005287181189c4210052ab57ada876ae2e90
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107926
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/filter/qa/cppunit/data/tiff/tdf115863.tif b/filter/qa/cppunit/data/tiff/tdf115863.tif
new file mode 100644
index 000000000000..b5e2dd9e4bcd
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/tdf115863.tif differ
diff --git a/filter/qa/cppunit/filters-tiff-test.cxx b/filter/qa/cppunit/filters-tiff-test.cxx
index 8d8fba03caf1..0dd5e4f82354 100644
--- a/filter/qa/cppunit/filters-tiff-test.cxx
+++ b/filter/qa/cppunit/filters-tiff-test.cxx
@@ -12,6 +12,7 @@
 #include <vcl/FilterConfigItem.hxx>
 #include <tools/stream.hxx>
 #include <vcl/graph.hxx>
+#include <vcl/graphicfilter.hxx>
 
 extern "C"
 {
@@ -35,13 +36,20 @@ public:
         const OUString &rURL, const OUString &,
         SfxFilterFlags, SotClipboardFormatId, unsigned int) override;
 
+    OUString getUrl()
+    {
+        return m_directories.getURLFromSrc("/filter/qa/cppunit/data/tiff/");
+    }
+
     /**
      * Ensure CVEs remain unbroken
      */
     void testCVEs();
+    void testTdf115863();
 
     CPPUNIT_TEST_SUITE(TiffFilterTest);
     CPPUNIT_TEST(testCVEs);
+    CPPUNIT_TEST(testTdf115863);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -57,7 +65,28 @@ bool TiffFilterTest::load(const OUString &,
 void TiffFilterTest::testCVEs()
 {
     testDir(OUString(),
-        m_directories.getURLFromSrc("/filter/qa/cppunit/data/tiff/"));
+        getUrl());
+}
+
+void TiffFilterTest::testTdf115863()
+{
+    OUString aURL = getUrl() + "tdf115863.tif";
+    SvFileStream aFileStream(aURL, StreamMode::READ);
+    Graphic aGraphic;
+    GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
+
+    ErrCode bResult = rFilter.ImportGraphic(aGraphic, aURL, aFileStream);
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: 0x0(Error Area:Io Class:NONE Code:0)
+    // - Actual  : 0x8203(Error Area:Vcl Class:General Code:3)
+    CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult);
+
+    Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap();
+    Size aSize = aBitmap.GetSizePixel();
+    CPPUNIT_ASSERT_EQUAL(tools::Long(528), aSize.Width());
+    CPPUNIT_ASSERT_EQUAL(tools::Long(618), aSize.Height());
+
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(TiffFilterTest);


More information about the Libreoffice-commits mailing list