Simplify Modify ribbon extensions

This commit is contained in:
Hakan Seven committed 2026-09-11 10:06:51 +03:00
1 parent 13600996d3
commit 5f3edf45ef
21 files changed
+248 -117

No files matched your search

+13
View File
@@ -713,6 +713,19 @@ mod tests {
app
}
#[test]
fn ncopy_without_preselection_gathers_objects() {
let mut app = fresh_app();
let _ = app.run_command_line("NCOPY");
assert_eq!(
app.tabs[app.active_tab]
.active_cmd
.as_ref()
.map(|active| active.name()),
Some("SELECT")
);
}
/// Run one command line and return only the command-line text it appended.
fn run_capture(app: &mut OpenCADStudio, cmd: &str) -> String {
let start = app.command_line.history.len();
+16 -1
View File
@@ -2997,6 +2997,22 @@ mod tests {
app
}
#[test]
fn selection_commands_gather_instead_of_using_the_whole_drawing() {
for command in ["SETBYLAYER", "OVERKILL"] {
let mut app = fresh_app();
let _ = app.run_command_line(command);
assert_eq!(
app.tabs[app.active_tab]
.active_cmd
.as_ref()
.map(|active| active.name()),
Some("SELECT"),
"{command} should gather an explicit selection"
);
}
}
#[test]
fn test_cad_selection_and_model_space_sysvars() {
let mut app = fresh_app();
@@ -3209,4 +3225,3 @@ mod scale_validation_tests {
}
}
}
+31
View File
@@ -2341,4 +2341,35 @@ mod tests {
let line_sort = entries.get(&h_line.value()).copied().unwrap_or(h_line.value());
assert!(hatch_sort > line_sort);
}
#[test]
fn draworder_mode_aliases_route_directly() {
let mut app = fresh_app();
let i = app.active_tab;
let line = app.tabs[i]
.scene
.add_entity_clone(EntityType::Line(Default::default()));
let hatch = app.tabs[i]
.scene
.add_entity_clone(EntityType::Hatch(Default::default()));
app.tabs[i]
.scene
.replace_selection(std::iter::once(hatch).collect());
let _ = app.run_command_line("DRAWORDER_FRONT");
let entries = effective_sort_map(&app);
assert!(
entries.get(&hatch.value()).copied().unwrap_or(hatch.value())
> entries.get(&line.value()).copied().unwrap_or(line.value())
);
app.tabs[i]
.scene
.replace_selection(std::iter::once(hatch).collect());
let _ = app.run_command_line("DRAWORDER_ABOVE");
assert!(app.tabs[i]
.active_cmd
.as_ref()
.is_some_and(|command| command.name() == "DRAWORDER" && command.needs_entity_pick()));
}
}
+3 -3
View File
@@ -890,9 +890,9 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
}
pub(super) fn on_command_escape(&mut self) -> Task<Message> {
if self.ribbon.escape_extension() {
return Task::none();
}
if self.ribbon.escape_extension() {
return Task::none();
}
// Esc drops an unconsumed one-shot snap override and closes
// its menu (#337). Falls through — Esc keeps its usual effect.
self.snap_override_popup = None;