mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-21 01:18:43 +00:00
Every tests/*.rs file is its own executable that links the whole crate graph. Move each crate's test files into tests/it/ as modules of one tests/it/main.rs; helper modules under tests/common move with them. These keep their own binary (own process): - engine panic_hunt: a process-wide panic hook counts every panic. - engine text_gamma: changes the process-wide text gamma. - engine smart_filter_stages, mask_cache_purge: assert on global caches. - codecs pnm_peak_memory: reads the process's peak RSS. - photocraft mac_menu_appkit: harness = false.
27 lines
1.2 KiB
Rust
27 lines
1.2 KiB
Rust
//! The global layer block retains its insertion position and neighboring opaque blocks.
|
|
use photocraft_psd::*;
|
|
|
|
#[test]
|
|
fn global_layer_block_roundtrips_with_opaque_neighbors() {
|
|
for version in [Version::Psd, Version::Psb] {
|
|
for depth in [16, 32] {
|
|
for index in 0..=2 {
|
|
for signature in [*b"8BIM", *b"8B64"] {
|
|
let mut file = testgen::layered(version, ColorMode::Rgb, depth, Compression::Raw);
|
|
file.global_blocks = vec![TaggedBlock::new(*b"zz01", vec![7, 8, 9]), TaggedBlock::new(*b"zz02", vec![10, 11])];
|
|
file.layer_info_placement = LayerInfoPlacement::GlobalBlock {
|
|
index,
|
|
signature,
|
|
key: if depth == 16 { *b"Lr16" } else { *b"Lr32" },
|
|
padding: Some(vec![31, 32, 33]),
|
|
};
|
|
let bytes = file.to_bytes().unwrap();
|
|
let parsed = PsdFile::from_bytes(&bytes).unwrap();
|
|
assert_eq!(parsed, file, "{version:?} {depth} {index} {signature:?}");
|
|
assert_eq!(parsed.to_bytes().unwrap(), bytes);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|