What's wrong
The padding check uses integer division against the requested size, so it rejects inputs that the processing pipeline handles fine.
Where
IconHelper/Arguments.cs:53:
else if (Size > 0 && Padding >= Size / 2)
{
errors.Add("Padding must be less than half the size of the image.");
}
The pipeline's own bound is EffectivePadding (IconHelper/IconHelper.cs:403), which accepts padding up to (size - 1) / 2.
Failure scenarios
--size 1 with the default padding: Size / 2 == 0, so 0 >= 0 and Validate() fails with the padding message, even though no padding was given. A throwaway test with Size = 1 and valid input/output directories confirmed Validate() == false. The documented size rule is only Size <= 0 → error.
--size 3 --padding 1: 1 >= 1 is rejected, yet EffectivePadding allows 1 for size 3 and leaves a 1-pixel image.
Suggested fix
- Validate with the same bound the pipeline uses:
Padding > (Size - 1) / 2 → error, which is equivalent to 2 * Padding >= Size.
- Update the message to match.
- Add
Arguments tests for Size = 1, Padding = 0 (valid), Size = 3, Padding = 1 (valid) and Size = 4, Padding = 2 (invalid).
What's wrong
The padding check uses integer division against the requested size, so it rejects inputs that the processing pipeline handles fine.
Where
IconHelper/Arguments.cs:53:The pipeline's own bound is
EffectivePadding(IconHelper/IconHelper.cs:403), which accepts padding up to(size - 1) / 2.Failure scenarios
--size 1with the default padding:Size / 2 == 0, so0 >= 0andValidate()fails with the padding message, even though no padding was given. A throwaway test withSize = 1and valid input/output directories confirmedValidate() == false. The documented size rule is onlySize <= 0→ error.--size 3 --padding 1:1 >= 1is rejected, yetEffectivePaddingallows 1 for size 3 and leaves a 1-pixel image.Suggested fix
Padding > (Size - 1) / 2→ error, which is equivalent to2 * Padding >= Size.Argumentstests forSize = 1, Padding = 0(valid),Size = 3, Padding = 1(valid) andSize = 4, Padding = 2(invalid).