[Libreoffice-commits] core.git: vcl/qa
Chris Sherlock (via logerrit)
logerrit at kemper.freedesktop.org
Sat Dec 19 03:15:54 UTC 2020
vcl/qa/cppunit/BitmapTest.cxx | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
New commits:
commit af05c3a9a7672c2233f7df7729736259f7b0f0dc
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
AuthorDate: Fri Dec 18 16:08:11 2020 +1100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sat Dec 19 04:15:19 2020 +0100
vcl: add unit test for certain sizes of bitmaps to be dithered
Change-Id: I9e40c8536c86468040bde56c569e7c69ad8f745b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107947
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx
index 67f897cd9ef4..8a931df524eb 100644
--- a/vcl/qa/cppunit/BitmapTest.cxx
+++ b/vcl/qa/cppunit/BitmapTest.cxx
@@ -1,4 +1,3 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -46,6 +45,7 @@ class BitmapTest : public CppUnit::TestFixture
void testBitmap32();
void testOctree();
void testEmptyAccess();
+ void testDitherSize();
CPPUNIT_TEST_SUITE(BitmapTest);
CPPUNIT_TEST(testCreation);
@@ -61,6 +61,7 @@ class BitmapTest : public CppUnit::TestFixture
CPPUNIT_TEST(testBitmap32);
CPPUNIT_TEST(testOctree);
CPPUNIT_TEST(testEmptyAccess);
+ CPPUNIT_TEST(testDitherSize);
CPPUNIT_TEST_SUITE_END();
};
@@ -650,6 +651,38 @@ void BitmapTest::testEmptyAccess()
CPPUNIT_ASSERT_EQUAL(tools::Long(0), access.Height());
}
+void BitmapTest::testDitherSize()
+{
+ // no need to do anything for a 1x1 pixel bitmap
+ {
+ Bitmap aBitmap(Size(1, 1), 24);
+ CPPUNIT_ASSERT(aBitmap.Dither());
+ }
+
+ // cannot dither a bitmap with a width of 2 or 3 pixels
+ {
+ Bitmap aBitmap(Size(2, 4), 24);
+ CPPUNIT_ASSERT(!aBitmap.Dither());
+ }
+
+ {
+ Bitmap aBitmap(Size(3, 4), 24);
+ CPPUNIT_ASSERT(!aBitmap.Dither());
+ }
+
+ // cannot dither a bitmap with a height of 2 pixels
+ {
+ Bitmap aBitmap(Size(4, 2), 24);
+ CPPUNIT_ASSERT(!aBitmap.Dither());
+ }
+
+ // only dither bitmaps with a width > 3 pixels and height > 2 pixels
+ {
+ Bitmap aBitmap(Size(4, 3), 24);
+ CPPUNIT_ASSERT(aBitmap.Dither());
+ }
+}
+
} // namespace
CPPUNIT_TEST_SUITE_REGISTRATION(BitmapTest);
More information about the Libreoffice-commits
mailing list