mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
layout/tests: Extract check_ops_on_layout()
This commit is contained in:
+9
-9
@@ -1479,24 +1479,24 @@ impl Op {
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn check_ops(ops: &[Op]) -> Layout<TestWindow> {
|
||||
let mut layout = Layout::default();
|
||||
fn check_ops_on_layout(layout: &mut Layout<TestWindow>, ops: &[Op]) {
|
||||
for op in ops {
|
||||
op.apply(&mut layout);
|
||||
op.apply(layout);
|
||||
layout.verify_invariants();
|
||||
}
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn check_ops(ops: &[Op]) -> Layout<TestWindow> {
|
||||
let mut layout = Layout::default();
|
||||
check_ops_on_layout(&mut layout, ops);
|
||||
layout
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn check_ops_with_options(options: Options, ops: &[Op]) -> Layout<TestWindow> {
|
||||
let mut layout = Layout::with_options(Clock::with_time(Duration::ZERO), options);
|
||||
|
||||
for op in ops {
|
||||
op.apply(&mut layout);
|
||||
layout.verify_invariants();
|
||||
}
|
||||
|
||||
check_ops_on_layout(&mut layout, ops);
|
||||
layout
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user