Files
texturecraft/crates/engine/tests/sample.rs
bflatastic f4496037ea Sample opens ready to paint; exact per-pixel reads in the DoF and subsurface passes
- The startup sample adds an empty paint layer on top of each stack and selects it (strokes on
  the bottom layer were hidden under the smart material)
- Depth of field and subsurface blur read same-size targets by pixel, not by filtered UV, so
  inert settings change nothing on any adapter (software adapters blended neighbours)
- CLI help lists .abc and builtin:udim_plane

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 15:38:44 +07:00

25 lines
1.1 KiB
Rust

//! The startup sample project must be ready to paint: an empty paint layer on top, selected.
use serde_json::json;
use texturecraft_engine::core::LayerKind;
use texturecraft_engine::geom::glam::Vec2;
use texturecraft_engine::{execute, project_cmds::sample_session};
#[test]
fn the_sample_opens_on_an_empty_top_paint_layer_that_shows_strokes() {
let mut s = sample_session(256, 64).unwrap();
s.viewport = Vec2::new(800.0, 600.0);
for ts in 0..s.set_count() {
let set = s.doc.project.texture_set(ts).unwrap();
let top = *set.stack.last().unwrap();
assert!(matches!(s.doc.project.layer(top).unwrap().kind, LayerKind::Paint), "set {ts}: the top layer is a paint layer");
assert_eq!(s.selected.get(&ts), Some(&top), "set {ts}: the top paint layer is selected");
}
s.update();
let before = s.caches[0].composite.clone();
execute(&mut s, "tool.brush", &json!({"size": 10})).unwrap();
execute(&mut s, "tool.stroke", &json!({"points": [[300, 260], [500, 300]]})).unwrap();
s.update();
assert_ne!(s.caches[0].composite, before, "a stroke on the sample changes what is shown");
}