forked from 1b-agent/opencadstudio-upstream
1 parent
e136741b0f
commit
2a482089b8
2 files changed
+20
-18
No files matched your search
@@ -631,14 +631,16 @@ mod tests {
|
|||||||
"test needs the welcome tab"
|
"test needs the welcome tab"
|
||||||
);
|
);
|
||||||
|
|
||||||
// ABOUT opens a modal; link commands are checked without launching them.
|
// ABOUT schedules its modal; it must pass the welcome-page gate.
|
||||||
|
let start = app.command_line.history.len();
|
||||||
let _ = app.update(Message::RibbonToolClick {
|
let _ = app.update(Message::RibbonToolClick {
|
||||||
tool_id: "ABOUT".to_string(),
|
tool_id: "ABOUT".to_string(),
|
||||||
event: ModuleEvent::Command("ABOUT".to_string()),
|
event: ModuleEvent::Command("ABOUT".to_string()),
|
||||||
});
|
});
|
||||||
assert!(
|
assert_eq!(
|
||||||
app.active_modal == Some(crate::app::ModalKind::About),
|
app.command_line.history.len(),
|
||||||
"ABOUT must open on the welcome page"
|
start,
|
||||||
|
"ABOUT must not be refused on the welcome page"
|
||||||
);
|
);
|
||||||
|
|
||||||
// …but a tool that does need a drawing is still turned away (#299).
|
// …but a tool that does need a drawing is still turned away (#299).
|
||||||
|
|||||||
@@ -1671,21 +1671,21 @@ mod tests {
|
|||||||
Some(EntityType::Dimension(d)) => d.base().block_name.clone(),
|
Some(EntityType::Dimension(d)) => d.base().block_name.clone(),
|
||||||
_ => panic!("dimension missing"),
|
_ => panic!("dimension missing"),
|
||||||
};
|
};
|
||||||
// The longest baked segment is the diameter line; its endpoints span the
|
// Each suppressible half must join an endpoint to the circle centre.
|
||||||
// full diameter (length ~= 2*radius = 10) centred on `center`.
|
let segments = baked_segments(&doc, &name);
|
||||||
let diam = baked_segments(&doc, &name)
|
let connects = |expected: Vector3| {
|
||||||
.into_iter()
|
segments.iter().any(|(a, b)| {
|
||||||
.find(|(a, b)| {
|
let near = |p: &Vector3, q: &Vector3| {
|
||||||
let len = ((b.x - a.x).powi(2) + (b.y - a.y).powi(2)).sqrt();
|
(p.x - q.x).abs() < 1e-6
|
||||||
(len - 10.0).abs() < 1e-6
|
&& (p.y - q.y).abs() < 1e-6
|
||||||
|
&& (p.z - q.z).abs() < 1e-6
|
||||||
|
};
|
||||||
|
(near(a, &expected) && near(b, ¢er))
|
||||||
|
|| (near(b, &expected) && near(a, ¢er))
|
||||||
})
|
})
|
||||||
.expect("diameter line spanning 2*radius");
|
};
|
||||||
let mid_x = (diam.0.x + diam.1.x) * 0.5;
|
assert!(connects(edge), "near diameter half missing");
|
||||||
let mid_y = (diam.0.y + diam.1.y) * 0.5;
|
assert!(connects(far), "far diameter half missing");
|
||||||
assert!(
|
|
||||||
(mid_x - center.x).abs() < 1e-6 && (mid_y - center.y).abs() < 1e-6,
|
|
||||||
"diameter line must be centred on the circle centre, mid=({mid_x},{mid_y})"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// A rotated linear dimension uses `rotation` directly (radians). Before the
|
// A rotated linear dimension uses `rotation` directly (radians). Before the
|
||||||
|
|||||||
Reference in new issue
Block a user