mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-08-02 09:18:06 +00:00
Address CodeRabbit nitpick: warn on double-edge padding crop, add unit tests
Logging a double-edge match at warning level (vs. info for a single edge) makes it easy to spot an unexpected crop in the field, since two edges matching at once is a much stronger signal of genuine baked-in padding than one edge coinciding with real all-black content. Also adds test/test_vegas_plugin_adapter.py covering _strip_scroll_padding's branch logic: leading-only, trailing-only, both-edges, no-match, degenerate all-black, missing/undersized display_width, and the info-vs-warning log level.
This commit is contained in:
@@ -369,7 +369,14 @@ class PluginAdapter:
|
||||
return img
|
||||
|
||||
cropped = img.crop((left, 0, img.width - right, img.height))
|
||||
logger.info(
|
||||
|
||||
# Both edges matching at once is a much stronger signal of genuine
|
||||
# baked-in padding than a single edge (which has a small chance of
|
||||
# coinciding with real all-black content, e.g. a dark logo touching
|
||||
# one boundary). Log that case at warning level so an unexpected
|
||||
# double-edge crop is easy to spot in the field.
|
||||
log = logger.warning if (left and right) else logger.info
|
||||
log(
|
||||
"[%s] Stripping scroll_helper padding (left=%dpx, right=%dpx): %dpx -> %dpx",
|
||||
plugin_id, left, right, img.width, cropped.width
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user