Skip to content

Add raw pixel data regression tests#161

Merged
mrousavy merged 1 commit into
mainfrom
test/raw-pixel-data-harness
Jul 23, 2026
Merged

Add raw pixel data regression tests#161
mrousavy merged 1 commit into
mainfrom
test/raw-pixel-data-harness

Conversation

@mrousavy

Copy link
Copy Markdown
Owner

What

Harness regression tests for raw pixel data, covering loadFromRawPixelData and toRawPixelData across all pixel formats in both directions.

What makes them meaningful:

  • Coordinate-keyed pattern on a non-square (4x8) image, not a solid fill. r depends on x, g/b on y, so the checks also catch stride/row-padding, transpose/row-vs-column-major and width/height-swap bugs, not just channel permutations.
  • Disjoint channel value ranges (r < g < b), so any channel swap pushes a value out of its expected range.
  • Both directions anchored independently: an export byte-order check against a ground-truth createBlankImage fill, plus a PNG-cycle load check that reads through the codec. A load bug and an export bug therefore cannot cancel out in a plain roundtrip.

Verified locally on Android (Pixel emulator) and iOS (iPhone 17 Pro simulator): 13/13 passing with all three fixes applied.

Depends on

These tests validate the fixes in the following PRs and go green once they are merged, so this should merge last:

The harness CI here will be red until those are merged and this branch is rebased onto main.

🤖 Generated with Claude Code

Adds harness coverage for loadFromRawPixelData and toRawPixelData across
all pixel formats, in both directions.

The test images use a coordinate-keyed color pattern on a non-square
(4x8) image instead of a solid fill, so the checks catch stride/row
padding, transpose/row-vs-column-major and width/height-swap bugs, not
just channel permutations. Each channel lives in a disjoint value range,
so any channel swap pushes a value out of its expected range.

The load and export sides are anchored independently (an export byte-
order check against a ground-truth fill, and a PNG-cycle load check that
reads through the codec), so a load bug and an export bug cannot cancel
out in a plain roundtrip.
@mrousavy
mrousavy merged commit 9fee13b into main Jul 23, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant