[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - vcl/qa vcl/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Tue Dec 29 15:50:44 UTC 2020
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 fc2a0543ab1b6a6aa1c991d83be1f1d50684f334
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Dec 29 23:11:04 2020 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Tue Dec 29 23:25:43 2020 +0900
improve JpegWriterTest - detect type is correct during roundtrip
Change-Id: I4560be2dd1627caf8126142930c3479668689273
diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx
index fe7485e3944a..2de865e77a85 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 234b2ea14514..38d46c0fe487 100644
--- a/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx
+++ b/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx
@@ -12,6 +12,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/");
@@ -50,16 +51,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 418563fcb604..10954031427c 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