Publish harness and TUI open-source
initial sync from the monorepo
This commit is contained in:
commit
c68e39f604
2734 changed files with 1437016 additions and 0 deletions
13
crates/common/xai-test-utils/src/image.rs
Normal file
13
crates/common/xai-test-utils/src/image.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
//! Synthetic image fixtures shared across crates' test suites.
|
||||
|
||||
/// Wrap a PNG into a minimal single-frame ICO. `width`/`height` are the
|
||||
/// ICONDIRENTRY bytes (`0` means 256); the PNG carries the real dimensions.
|
||||
pub fn ico_with_png_frame(png: &[u8], width: u8, height: u8) -> Vec<u8> {
|
||||
let mut buf = Vec::with_capacity(22 + png.len());
|
||||
buf.extend_from_slice(&[0, 0, 1, 0, 1, 0]); // ICONDIR
|
||||
buf.extend_from_slice(&[width, height, 0, 0, 1, 0, 32, 0]); // ICONDIRENTRY
|
||||
buf.extend_from_slice(&(png.len() as u32).to_le_bytes()); // bytes in resource
|
||||
buf.extend_from_slice(&22u32.to_le_bytes()); // offset to the PNG payload
|
||||
buf.extend_from_slice(png);
|
||||
buf
|
||||
}
|
||||
Loading…
Reference in a new issue