forked from 1b-agent/opencadstudio-upstream
refactor(draw): TRIM geometry helpers come from the kernel; drop a probe test
#1511 added an orthogonal ellipse projection and a nearest-end arc_parameter to draw/modify/geom.rs, the latter shadowing the kernel function of the same name. Both now live in opencadkernel 237827e and are re-exported here, so every kernel caller gets them too. test_coincident_line_and_arc_grip_move only printed values and asserted nothing; removed. Pins opencadkernel 237827e, opencadgraph fe36957. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
66ac8c4ec0
commit
eac19348d5
4 files changed
+7
-170
No files matched your search
@@ -7009,70 +7009,6 @@ mod selection_preview_tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_coincident_line_and_arc_grip_move() {
|
||||
use codec::{types::Vector3, EntityType};
|
||||
let mut app = OpenCADStudio::new_for_test();
|
||||
app.automation_op(r#"{"op":"new"}"#);
|
||||
let i = app.active_tab;
|
||||
app.tabs[i].scene.selection.borrow_mut().vp_size = (800.0, 600.0);
|
||||
|
||||
let pt = glam::DVec3::new(-2.8146711761917635, 12.22681563180158, 0.0);
|
||||
|
||||
// Line ending at pt
|
||||
let mut line = codec::entities::Line::new();
|
||||
line.start = Vector3::new(-20.0, 12.22681563180158, 0.0);
|
||||
line.end = Vector3::new(pt.x, pt.y, pt.z);
|
||||
let line_h = app.tabs[i].scene.add_entity(EntityType::Line(line));
|
||||
|
||||
// Arc starting at pt
|
||||
let mut arc = codec::entities::Arc::new();
|
||||
arc.center = Vector3::new(0.0, 0.0, 0.0);
|
||||
arc.radius = (pt.x * pt.x + pt.y * pt.y).sqrt();
|
||||
let sa = (pt.y).atan2(pt.x);
|
||||
arc.start_angle = sa;
|
||||
arc.end_angle = sa + 1.0;
|
||||
let arc_h = app.tabs[i].scene.add_entity(EntityType::Arc(arc));
|
||||
|
||||
app.tabs[i].scene.selected.insert(line_h);
|
||||
app.tabs[i].scene.selected.insert(arc_h);
|
||||
app.refresh_selected_grips();
|
||||
|
||||
println!("selected grips count: {}", app.tabs[i].selected_grips.len());
|
||||
for (g_idx, g) in app.tabs[i].selected_grips.iter().enumerate() {
|
||||
let h = app.tabs[i].selected_grip_handles[g_idx];
|
||||
println!("grip idx {g_idx}: handle {:?}, id {}, world {:?}", h, g.id, g.world);
|
||||
}
|
||||
|
||||
let bounds = iced::Rectangle::with_size(iced::Size::new(800.0, 600.0));
|
||||
let cursor = app.tabs[i].scene.camera.borrow().project(pt, bounds).unwrap();
|
||||
app.tabs[i].scene.selection.borrow_mut().last_move_pos =
|
||||
Some(iced::Point::new(cursor.x, cursor.y));
|
||||
let _ = app.on_viewport_left_press();
|
||||
|
||||
let active = app.tabs[i].active_grip.as_ref().expect("grip must engage");
|
||||
println!("active grip targets len: {}", active.targets.len());
|
||||
for t in &active.targets {
|
||||
println!("target: handle {:?}, grip_id {}, last_world {:?}", t.handle, t.grip_id, t.last_world);
|
||||
}
|
||||
|
||||
// Drag cursor by (5.0, 5.0)
|
||||
let new_target = pt + glam::DVec3::new(5.0, 5.0, 0.0);
|
||||
let new_cursor = app.tabs[i].scene.camera.borrow().project(new_target, bounds).unwrap();
|
||||
let _ = app.on_viewport_move(iced::Point::new(new_cursor.x, new_cursor.y));
|
||||
|
||||
let EntityType::Line(moved_line) = app.tabs[i].scene.document.get_entity(line_h).unwrap() else { panic!() };
|
||||
let EntityType::Arc(moved_arc) = app.tabs[i].scene.document.get_entity(arc_h).unwrap() else { panic!() };
|
||||
|
||||
println!("moved line end: {:?}", moved_line.end);
|
||||
let arc_start_moved = glam::DVec3::new(
|
||||
moved_arc.center.x + moved_arc.radius * moved_arc.start_angle.cos(),
|
||||
moved_arc.center.y + moved_arc.radius * moved_arc.start_angle.sin(),
|
||||
0.0,
|
||||
);
|
||||
println!("moved arc start: {:?}", arc_start_moved);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn constraint_glyph_tooltip_appears_after_hover_dwell() {
|
||||
use crate::scene::parametric_constraints::{ConstraintKind, ParametricRef, ParametricScope};
|
||||
|
||||
Reference in new issue
Block a user