[Libreoffice-commits] core.git: vcl/qa vcl/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jan 7 00:05:50 UTC 2021
vcl/qa/cppunit/graphicfilter/filters-test.cxx | 2 ++
vcl/qa/cppunit/jpeg/JpegWriterTest.cxx | 16 ++++++++++++----
vcl/source/filter/graphicfilter.cxx | 1 -
3 files changed, 14 insertions(+), 5 deletions(-)
New commits:
commit 252ddaa9075462000bb8e63288b9c15daeecca8a
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Dec 29 23:11:04 2020 +0900
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Jan 7 01:05:07 2021 +0100
improve JpegWriterTest - detect type is correct during roundtrip
Change-Id: I4560be2dd1627caf8126142930c3479668689273
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108823
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx
index 5a4443f1075a..aee1dda1407e 100644
--- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx
@@ -144,6 +144,8 @@ void VclFiltersTest::testExportImport()
checkExportImport(u"png");
fprintf(stderr, "Check ExportImport BMP\n");
checkExportImport(u"bmp");
+ fprintf(stderr, "Check ExportImport TIF\n");
+ checkExportImport(u"tif");
}
void VclFiltersTest::testCVEs()
diff --git a/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx b/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx
index b2144fe3b47e..f999c018df7c 100644
--- a/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx
+++ b/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx
@@ -16,6 +16,7 @@
#include <vcl/graphicfilter.hxx>
#include <vcl/BitmapReadAccess.hxx>
#include <tools/stream.hxx>
+#include <graphic/GraphicFormatDetector.hxx>
constexpr OUStringLiteral gaDataUrl(u"/vcl/qa/cppunit/jpeg/data/");
@@ -54,16 +55,23 @@ BitmapEx JpegWriterTest::roundtripJPG(const OUString& aURL) { return roundtripJP
BitmapEx JpegWriterTest::roundtripJPG(const BitmapEx& bitmap)
{
- SvMemoryStream stream;
+ // EXPORT JPEG
+ SvMemoryStream aStream;
GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
sal_uInt16 exportFormatJPG = rFilter.GetExportFormatNumberForShortName(JPG_SHORTNAME);
Graphic aExportGraphic(bitmap);
- ErrCode bResult = rFilter.ExportGraphic(aExportGraphic, "memory", stream, exportFormatJPG);
+ ErrCode bResult = rFilter.ExportGraphic(aExportGraphic, "memory", aStream, exportFormatJPG);
CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult);
- stream.Seek(0);
+ //Detect the magic bytes - we need to be sure the file is actually a JPEG
+ aStream.Seek(0);
+ vcl::GraphicFormatDetector aDetector(aStream, "");
+ CPPUNIT_ASSERT(aDetector.detect());
+ CPPUNIT_ASSERT(aDetector.checkJPG());
+ // IMPORT JPEG
+ aStream.Seek(0);
Graphic aImportGraphic;
sal_uInt16 importFormatJPG = rFilter.GetImportFormatNumberForShortName(JPG_SHORTNAME);
- bResult = rFilter.ImportGraphic(aImportGraphic, "memory", stream, importFormatJPG);
+ bResult = rFilter.ImportGraphic(aImportGraphic, "memory", aStream, importFormatJPG);
CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult);
return aImportGraphic.GetBitmapEx();
}
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 2c2aa67bcbe2..684bb9c02731 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -649,7 +649,6 @@ extern "C" bool iptGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterCo
extern "C" bool ipxGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
extern "C" bool iraGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
extern "C" bool itgGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
-extern "C" bool itiGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
#endif
More information about the Libreoffice-commits
mailing list