summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2024-09-14 01:04:55 +1000
committerTomaž Vajngerl <quikee@gmail.com>2024-09-18 08:06:33 +0200
commit05c01410f3c0fcb791f60b19ce2085beee1dabe0 (patch)
tree626807281325dc1fa9fc2f2f98c91f75a1c2f6f9 /vcl
parent393b1a5de4e113336ca5fa87cc77555679fa8e03 (diff)
vcl: test BitmapAlphaClampFilter
Change-Id: Ie44884a3010cd26b057bac593059a4bd0a3aabc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173345 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qa/cppunit/BitmapFilterTest.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/BitmapFilterTest.cxx b/vcl/qa/cppunit/BitmapFilterTest.cxx
index e492b963f48d..099720a1569d 100644
--- a/vcl/qa/cppunit/BitmapFilterTest.cxx
+++ b/vcl/qa/cppunit/BitmapFilterTest.cxx
@@ -15,6 +15,7 @@
#include <tools/stream.hxx>
#include <vcl/graphicfilter.hxx>
+#include <vcl/BitmapAlphaClampFilter.hxx>
#include <vcl/BitmapArithmeticBlendFilter.hxx>
#include <vcl/BitmapDarkenBlendFilter.hxx>
#include <vcl/BitmapLightenBlendFilter.hxx>
@@ -41,6 +42,7 @@ public:
{
}
+ void testClampAlpha();
void testBlurCorrectness();
void testBasicMorphology();
void testPerformance();
@@ -53,6 +55,7 @@ public:
void testArithmeticBlendFilter();
CPPUNIT_TEST_SUITE(BitmapFilterTest);
+ CPPUNIT_TEST(testClampAlpha);
CPPUNIT_TEST(testBlurCorrectness);
CPPUNIT_TEST(testBasicMorphology);
CPPUNIT_TEST(testPerformance);
@@ -91,6 +94,22 @@ private:
}
};
+void BitmapFilterTest::testClampAlpha()
+{
+ // Setup test bitmap
+ Size aSize(1, 1);
+ Bitmap aBitmap24Bit(aSize, vcl::PixelFormat::N24_BPP);
+
+ {
+ BitmapScopedWriteAccess aWriteAccess(aBitmap24Bit);
+ aWriteAccess->Erase(COL_RED);
+ }
+
+ BitmapEx aBitmapEx24Bit(aBitmap24Bit);
+ BitmapFilter::Filter(aBitmapEx24Bit, BitmapAlphaClampFilter(0x7F));
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(0xFF), aBitmapEx24Bit.GetAlpha(0, 0));
+}
+
void BitmapFilterTest::testBlurCorrectness()
{
// Setup test bitmap