pub fn check_capability_honesty<E, D>(
enc: E,
dec: D,
img: &TestImage,
) -> Conformancewhere
E: EncoderConfig,
D: DecoderConfig,
<E::Job as EncodeJob>::Enc: Encoder<Error = E::Error>,
<E::Job as EncodeJob>::AnimationFrameEnc: AnimationFrameEncoder,Expand description
Declared capabilities match real behavior.
For the encode paths (push_rows, encode_from, animation), the decode paths
(streaming, animation), the lossless knob, and cheap_probe, both
directions are checked: every declared capability is exercised, and every
undeclared optional path must decline with
UnsupportedOperation — a codec can’t claim a
feature it lacks or hide one it has. The metadata channels
(icc/exif/xmp/cicp) are checked bidirectionally where the decoder can
observe them: each channel is supplied separately, and a declared channel
must survive a PreserveExact round trip, and
an undeclared one must not (a hidden write capability); the
encoder-writes-but-decoder-doesn’t-read quadrant isn’t observable through decode.
Separate probes allow formats with mutually exclusive ICC/native-color carriers;
mixed-carrier precedence remains covered by check_color_authority_spec.
native_alpha is forward-only — a declared RGBA8 round trip must preserve alpha;
the no-alpha direction isn’t cleanly assertable (a codec may legitimately reject
or flatten RGBA input).
All violations are collected and reported together, so one run names every dishonest flag.
Not covered: cooperative cancellation (stop) — whether a codec honors a
triggered token is timing-dependent on small inputs and can’t be asserted
reliably here; the lossy flag, whose effect isn’t observable from the
bitstream alone; and the pixel-format / resource / tuning flags (native_gray,
native_16bit, native_f32, enforces_max_pixels / enforces_max_memory,
the CICP-carrier flags, and the effort / quality / threads ranges),
whose honesty needs format-specific fixtures a generic harness can’t supply.
hdr and gain_map have their own checks (check_native_hdr_roundtrip,
check_gain_map_roundtrip).