forked from 1b-agent/opencadstudio-upstream
Test wipeout and break command interactions
This commit is contained in:
1 parent
cf9ddf8586
commit
4a1dddfbe5
2 files changed
+55
-1
No files matched your search
@@ -502,3 +502,28 @@ impl CadCommand for BreakAtPointCommand {
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["BREAKATPOINT"] }); // BreakAtPointCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["BREAK"] }); // BreakInteractiveCommand
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn first_option_replaces_the_selection_point_and_at_reuses_it() {
|
||||
let handle = Handle::new(7);
|
||||
let mut command = BreakInteractiveCommand::new();
|
||||
assert!(matches!(
|
||||
command.on_entity_pick(handle, DVec3::new(1.0, 2.0, 0.0)),
|
||||
CmdResult::NeedPoint
|
||||
));
|
||||
assert_eq!(command.options().len(), 1);
|
||||
assert!(matches!(command.on_text_input("F"), Some(CmdResult::NeedPoint)));
|
||||
|
||||
let replacement = DVec3::new(3.0, 4.0, 0.0);
|
||||
assert!(matches!(command.on_point(replacement), CmdResult::NeedPoint));
|
||||
assert!(matches!(
|
||||
command.on_text_input("@"),
|
||||
Some(CmdResult::BreakEntity { handle: result, p1, p2 })
|
||||
if result == handle && p1 == replacement && p2 == replacement
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user