//! Prints where a cold layout puts every widget of many grown trees, so two //! commits can be compared on cold layout alone. The warm/cold oracle cannot //! see a change that moves cold layout, since both of its sides move; this //! can, by diffing its output across the change: //! //! IRIS_DUMP_SEEDS=400 IRIS_DUMP_DEPTH=5 cargo test --release \ //! --test layout_dump -- --ignored --nocapture > /tmp/before.txt //! //! then the same after, and `diff` the two. A line is one widget: the seed, //! its index in creation order, and its box in window pixels, or `-` where //! it is not drawn. `IRIS_UNBOUNDED=1` drops the trees' intrinsic bounds, as //! in the diagnostics rig, which compares the two paths over the same shapes. mod rig; use iris::harness::Harness; use iris::random::{Edits, build, plan}; use rig::env; #[test] #[ignore = "a dump to diff across commits, not a check"] fn every_cold_layout_is_printed() { let seeds = env("IRIS_DUMP_SEEDS", 400_u64); let depth = env("IRIS_DUMP_DEPTH", 5_usize); let mut out = String::new(); for seed in 1..=seeds { let mut harness = Harness::new((1920.0, 1200.0)); let mut plan = plan(seed, depth, &Edits::default()); if env("IRIS_UNBOUNDED", 0_u8) != 0 { plan.drop_bounds(); } let (root, tree) = build(&mut harness.rsc, &plan); harness.state.root = Some(root); harness.frame(); for (index, id) in tree.ids.iter().enumerate() { match harness.region(id) { Some(region) => out.push_str(&format!("{seed} {index} {region:?}\n")), None => out.push_str(&format!("{seed} {index} -\n")), } } } print!("{out}"); }