Bug 170384 - Write tests for bitmap filters
Summary: Write tests for bitmap filters
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
26.2.0.0 alpha0+ master
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:26.8.0
Keywords: difficultyBeginner, easyHack, skillTest, topicQA
Depends on:
Blocks: Dev-related
  Show dependency treegraph
 
Reported: 2026-01-19 09:27 UTC by Xisco Faulí
Modified: 2026-01-20 20:17 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2026-01-19 09:27:00 UTC
There are more than 30 different filters in vcl/source/bitmap/ to manipulate bitmaps.
Some of these filters are already covered with a test in vcl/qa/cppunit/BitmapFilterTest.cxx but most of them don't have a corresponding test.

The idea for this easyhack is to check which tests are missing and implement them for N24_BPP and N32_BPP bitmaps
Comment 1 Hossein 2026-01-19 10:18:47 UTC
Looking into BitmapFilterTest.cxx, at the moment it contains 22 tests for 12 distinct filters:

$ git grep -h BitmapFilterTest vcl/qa/cppunit/BitmapFilterTest.cxx|awk '{print substr($2, 1, length($2)-1)}'
testClampAlpha_24_BPP
testClampAlpha_32_BPP
testBlurCorrectness_24_BPP
testBlurCorrectness_32_BPP
testBasicMorphology
testPerformance_24_BPP
testPerformance_32_BPP
testGenerateStripRanges
testMultiplyBlendFilter_24_BPP
testMultiplyBlendFilter_32_BPP
testNormalBlendFilter_24_BPP
testNormalBlendFilter_32_BPP
testDarkenBlendFilter_24_BPP
testDarkenBlendFilter_32_BPP
testLightenBlendFilter_24_BPP
testLightenBlendFilter_32_BPP
testScreenBlendFilter_24_BPP
testScreenBlendFilter_32_BPP
testArithmeticBlendFilter_24_BPP
testArithmeticBlendFilter_32_BPP
testDuoToneFilter_24_BPP
testDuoToneFilter_32_BPP

32 Bitmap filters can be be found in vcl/source/bitmap/:

$ ls vcl/source/bitmap/*Filter.cxx|wc -l
32

You may compare the names in these two, and find the missing ones. For each of the missing tests, first you should understand the purpose of the filter, and then come up with an idea to test the filter. Then, you should create two functions for 24 and 32 bit bitmap.

In the implementation(s), you should make sure that the filter generates an expected output when it modifies the bitmap. This is usually done by checking the modified bitmap after the filter is applied with BitmapFilter::Filter().
Comment 2 Commit Notification 2026-01-20 20:17:16 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ceafe6ac7423ddc49489f8c0a87572b08b036474

tdf#170384: test BitmapColorizeFilter

It will be available in 26.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.