[Libreoffice-commits] core.git: vcl/qa
Luboš Luňák (via logerrit)
logerrit at kemper.freedesktop.org
Fri Mar 29 09:23:09 UTC 2019
vcl/qa/cppunit/jpeg/JpegWriterTest.cxx | 18 ++++++++++++++++++
vcl/qa/cppunit/jpeg/data/8BitGrayscale.jpg |binary
2 files changed, 18 insertions(+)
New commits:
commit ea97248f39b2bcf65bc8aaf0577f49ca64b0e79f
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed Mar 27 11:53:40 2019 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Fri Mar 29 10:22:41 2019 +0100
check that jpeg export of 8bit grayscale works
This is a simpler check for 77146ca8193a8e258dbb0dae0793497a66734ff1
(related to tdf#121615).
Change-Id: I33b92f07bebeb735466e0728c6c51b79fc0b5bb8
Reviewed-on: https://gerrit.libreoffice.org/69820
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx b/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx
index a81d0c478ff9..9ce9eb43bfd6 100644
--- a/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx
+++ b/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx
@@ -29,9 +29,11 @@ class JpegWriterTest : public test::BootstrapFixtureBase
BitmapEx roundtripJPG(const OUString& aURL);
public:
+ void testWrite8BitGrayscale();
void testWrite8BitNonGrayscale();
CPPUNIT_TEST_SUITE(JpegWriterTest);
+ CPPUNIT_TEST(testWrite8BitGrayscale);
CPPUNIT_TEST(testWrite8BitNonGrayscale);
CPPUNIT_TEST_SUITE_END();
};
@@ -64,6 +66,22 @@ BitmapEx JpegWriterTest::roundtripJPG(const BitmapEx& bitmap)
return aImportGraphic.GetBitmapEx();
}
+void JpegWriterTest::testWrite8BitGrayscale()
+{
+ Bitmap bitmap = roundtripJPG(getFullUrl("8BitGrayscale.jpg")).GetBitmap();
+ Bitmap::ScopedReadAccess access(bitmap);
+ const ScanlineFormat format = access->GetScanlineFormat();
+ // Check that it's still 8bit grayscale.
+ CPPUNIT_ASSERT_EQUAL(ScanlineFormat::N8BitPal, format);
+ CPPUNIT_ASSERT(bitmap.HasGreyPalette());
+ // Check that the content is valid.
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_WHITE), access->GetColor(0, 0));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_WHITE), access->GetColor(0, access->Width() - 1));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_WHITE), access->GetColor(access->Height() - 1, 0));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_BLACK),
+ access->GetColor(access->Height() - 1, access->Width() - 1));
+}
+
void JpegWriterTest::testWrite8BitNonGrayscale()
{
Bitmap bitmap = roundtripJPG(getFullUrl("8BitNonGrayscale.gif")).GetBitmap();
diff --git a/vcl/qa/cppunit/jpeg/data/8BitGrayscale.jpg b/vcl/qa/cppunit/jpeg/data/8BitGrayscale.jpg
new file mode 100644
index 000000000000..91541e4a858a
Binary files /dev/null and b/vcl/qa/cppunit/jpeg/data/8BitGrayscale.jpg differ
More information about the Libreoffice-commits
mailing list