Tests from main: the world state is a Result here

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MNXLXkZLQ6T7TSi4wswcmk
This commit is contained in:
brett19
2026-10-31 17:31:28 -07:00
parent c18491f52e
commit 4cd2ae0620
5 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -102,7 +102,7 @@ fn sketches_move_to_the_part_whose_face_they_are_on() {
run(&mut s, "solid.box", json!({"length":10,"width":10,"height":10,"body_name":"Base"}));
run(&mut s, "occurrence.move", json!({"occurrence":occurrence,"translate":[30,0,0]}));
run(&mut s, "component.activate", json!({"component":0}));
let world = s.world_state();
let world = s.world_state().unwrap();
let base = world.body("Base").unwrap();
let top = base.body.faces(0.01).unwrap().into_iter().max_by(|a, b| a.centroid.z.total_cmp(&b.centroid.z)).unwrap();
let pick = json!({"body": base.name, "index": top.index, "face": [top.centroid.x, top.centroid.y, top.centroid.z], "path": [occurrence]});
@@ -110,7 +110,7 @@ fn sketches_move_to_the_part_whose_face_they_are_on() {
sketch_square(&mut s);
let on_xy = run(&mut s, "sketch.create", json!({"name":"OnXY","plane":"XY"}))["sketch"].as_u64().unwrap();
sketch_square(&mut s);
let world_plane = |s: &Session| s.world_state().sketch(on_face).unwrap().plane;
let world_plane = |s: &Session| s.world_state().unwrap().sketch(on_face).unwrap().plane;
let before = world_plane(&s);
assert_eq!(s.doc.feature(on_face).unwrap().component, 0);
let doc_before = s.doc.to_json();
+1 -1
View File
@@ -569,7 +569,7 @@ fn dragging_an_occurrence_row_onto_the_top_of_a_sibling_reorders_them() {
fn sketches_folder_moves_its_sketches_to_the_part_they_are_on() {
let (mut h, component, occurrence) = crate::test_support::component_box();
h.app.session.auto_project = false;
let world = h.app.session.world_state();
let world = h.app.session.world_state().unwrap();
let body = world.bodies.iter().find(|b| h.app.session.doc.model_body_component(b) == component).unwrap().name.clone();
let face = world.body(&body).unwrap().body.faces(0.01).unwrap().into_iter().max_by(|a, b| a.centroid.z.total_cmp(&b.centroid.z)).unwrap();
let pick = json!({"face":[face.centroid.x,face.centroid.y,face.centroid.z],"body":body,"index":face.index,"path":[occurrence]});
+1 -1
View File
@@ -628,7 +628,7 @@ fn many_selected_bodies_hover_cost() {
}
None => grid(1440),
};
let st = h.app.session.world_state();
let st = h.app.session.world_state().unwrap();
st.warm_meshes(|| true);
for b in &st.bodies {
let _ = b.display_plan();
+1 -1
View File
@@ -190,7 +190,7 @@ fn an_ellipse_takes_a_typed_major_and_minor_radius() {
assert_focus(&h, 0);
type_value(&mut h, "8");
h.step(&json!({"key": "Enter"})).unwrap();
let state = h.app.session.world_state();
let state = h.app.session.world_state().unwrap();
let sk = &state.sketch(h.app.session.active_sketch.unwrap()).unwrap().sketch;
assert_eq!(sk.curves.len(), 1, "{:?}", h.app.status);
let CurveKind::Ellipse { c, m, r } = sk.curves[0].kind.clone() else { panic!("{:?}", sk.curves[0].kind) };
+1 -1
View File
@@ -9737,7 +9737,7 @@ mod tests {
app.viewport.gpu = Some(GpuTarget { format: egui_wgpu::wgpu::TextureFormat::Rgba8Unorm, depth: None, samples: 1, tess: true, oit: false });
app.run("solid.box", json!({"length": 4, "width": 4, "height": 4, "center": [40, 0, 2], "operation": "new", "name": "Seed"})).unwrap();
app.run("solid.pattern.rectangular", json!({"features": ["Seed"], "dir1": [1, 0, 0], "count1": 6, "spacing1": 6, "name": "Row"})).unwrap();
let st = app.session.world_state();
let st = app.session.world_state().unwrap();
assert_eq!(st.bodies.len(), 7);
let mut by_name = BodiesByName::new(&st);
for b in &st.bodies {