Files
photocraft/crates/format/tests/it/layer_labels.rs
T
aiongg a6428d3dfb Build each crate's integration tests as one binary
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.
2026-10-22 16:55:34 +00:00

20 lines
865 B
Rust

use photocraft_color::{ColorMode, SampleType};
use photocraft_doc::{Document, LabelColor, Layer, Size};
#[test]
fn layer_labels_pcraft_roundtrip_all_colors_and_depths() {
for depth in SampleType::ALL {
let mut doc = Document::new("Labels", Size::new(2, 2), ColorMode::Rgb, depth);
for color in LabelColor::ALL {
let mut child = Layer::raster("Child", doc.pixel_format());
child.label = color;
let mut group = Layer::group(color.label(), vec![child]);
group.label = color;
doc.layers.push(group);
}
let bytes = photocraft_format::save_to_bytes(&doc, &Default::default()).unwrap();
assert_eq!(photocraft_format::load_from_bytes(&bytes).unwrap(), doc, "{depth:?}");
assert!(photocraft_format::load_from_bytes(&bytes[..bytes.len() / 2]).is_err());
}
}