Link the ordinary tests once, and keep their debug info to line tables
Eleven `tests/*.rs` were eleven binaries, each linking the whole graph -- `wgpu` and all -- to run a handful of cases. They are modules of one target now, under `tests/cases/`, and `cargo test --test suite layout::` still picks one out. The fuzzers and the `*_cost` measurements stay their own targets: they are run on their own and want to be selectable without building the rest. `profile.test` takes `debug = "line-tables-only"`, which is what a backtrace here actually reads; the type and variable information was the bulk of what the linker was writing. Measured on this machine, rebuilding `iris`'s test targets after a change to the crate: 14.3 s before, 9.8 s with one target, 7.7 s with both. `target/` went from 45 GB to 13 GB. The suite still passes 102 tests, and the binary still carries `.debug_line`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
39e4ca20e6
commit
cb955f1023
13 files changed
+35
No files matched your search
@@ -0,0 +1,61 @@
|
||||
//! Scrolling moves content and stops at its ends.
|
||||
|
||||
use iris::harness::{Harness, assert_corners};
|
||||
use iris::prelude::*;
|
||||
|
||||
#[test]
|
||||
fn scrollable_enables_a_region_node_but_raw_scroll_does_not() {
|
||||
let mut h = Harness::new((100, 100));
|
||||
let default_child = ().add(&mut h.rsc);
|
||||
let _default = default_child.scrollable().add(&mut h.rsc);
|
||||
assert!(h.rsc.widgets().is_region_node(default_child));
|
||||
h.rsc.widgets_mut().set_region_node(default_child, false);
|
||||
assert!(!h.rsc.widgets().is_region_node(default_child));
|
||||
|
||||
let raw_child = ().add(&mut h.rsc);
|
||||
let _raw = Scroll::new(raw_child.add_strong(&mut h.rsc), Axis::Y).add(&mut h.rsc);
|
||||
assert!(!h.rsc.widgets().is_region_node(raw_child));
|
||||
|
||||
let explicit = ().region_node().add(&mut h.rsc);
|
||||
assert!(h.rsc.widgets().is_region_node(explicit));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_scrollable_child_can_drop_its_region_node() {
|
||||
let mut h = Harness::new((400, 200));
|
||||
let top = rect(Color::RED).height(200).add(&mut h.rsc);
|
||||
let bottom = rect(Color::BLUE).height(200).add(&mut h.rsc);
|
||||
let content = (top, bottom).span(Dir::DOWN).add(&mut h.rsc);
|
||||
h.set_root(content.scrollable());
|
||||
h.rsc.widgets_mut().set_region_node(content, false);
|
||||
h.frame();
|
||||
|
||||
h.move_to((200, 100));
|
||||
h.scroll((0, 1));
|
||||
h.frame();
|
||||
|
||||
assert!(!h.rsc.widgets().is_region_node(content));
|
||||
assert_corners!(h, top, (0, -150), (400, 50));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_wheel_scrolls_the_content_and_stops_at_its_end() {
|
||||
let mut h = Harness::new((400, 200));
|
||||
// Twice the window's height, so there is 200 to scroll.
|
||||
let top = rect(Color::RED).height(200).add(&mut h.rsc);
|
||||
let bottom = rect(Color::BLUE).height(200).add(&mut h.rsc);
|
||||
h.set_root((top, bottom).span(Dir::DOWN).scrollable());
|
||||
h.move_to((200, 100));
|
||||
|
||||
// `Scroll` starts snapped to the end.
|
||||
assert_corners!(h, top, (0, -200), (400, 0));
|
||||
|
||||
// The handler scales a wheel line by 50.
|
||||
h.scroll((0, 1));
|
||||
h.frame();
|
||||
assert_corners!(h, top, (0, -150), (400, 50));
|
||||
|
||||
h.scroll((0, 10));
|
||||
h.frame();
|
||||
assert_corners!(h, top, (0, 0), (400, 200));
|
||||
}
|
||||
Reference in new issue
Block a user