feat(editor): integrate docking into editor_demo

Add full-frame-cycle integration test to dock.rs (16 tests total) and
update editor_demo to use DockTree layout instead of a single panel.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-26 10:09:53 +09:00
parent 1571aa5f97
commit f7ef228b49
2 changed files with 74 additions and 12 deletions

View File

@@ -531,4 +531,28 @@ mod tests {
let first_bg = &ui.draw_list.vertices[0];
assert_eq!(first_bg.color, [40, 40, 40, 255]);
}
#[test]
fn test_full_frame_cycle() {
let mut dock = DockTree::new(
DockNode::split(Axis::Horizontal, 0.3,
DockNode::Leaf { tabs: vec![0, 1], active: 0 },
DockNode::split(Axis::Vertical, 0.6, DockNode::leaf(vec![2]), DockNode::leaf(vec![3])),
),
vec!["Hierarchy", "Inspector", "Viewport", "Console"],
);
let mut ui = UiContext::new(1280.0, 720.0);
for _ in 0..3 {
ui.begin_frame(100.0, 100.0, false);
let areas = dock.layout(Rect { x: 0.0, y: 0.0, w: 1280.0, h: 720.0 });
dock.update(100.0, 100.0, false);
dock.draw_chrome(&mut ui);
assert_eq!(areas.len(), 3);
for (_, r) in &areas {
assert!(r.w > 0.0);
assert!(r.h > 0.0);
}
ui.end_frame();
}
}
}