forked from 1b-agent/opencadstudio-upstream
feat(commands): interactive value prompts for PDMODE/PDSIZE/LTSCALE/CELTSCALE (F4)
Bare PDMODE / PDSIZE / LTSCALE / CELTSCALE now enter a generic ValuePromptCommand front-end that prompts for the value and delegates to the existing inline `<name> <value>` handler via CmdResult::Dispatch, so they prompt step-by-step like UCS. A bare Enter reports the current value; `PDMODE 3` still works as one typed / headless line. Only pure single-value setting commands are converted. Dialog-opening commands (LAYER, PURGE, DIMSTYLE, STYLE …) intentionally keep their bare-name behaviour (open the panel), and subcommand-tree commands keep their inline handlers — all already typable with arguments since F1. Adds headless test value_prompt_commands_inline_args. Fourth phase of the unified step driver. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
52f6aed2f2
commit
df0e283eba
3 files changed
+109
-4
No files matched your search
@@ -497,6 +497,27 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn value_prompt_commands_inline_args() {
|
||||
// A single-value setting command entered with its value on one line
|
||||
// drives the interactive front-end (start + value step) and applies via
|
||||
// the inline handler. (F4)
|
||||
let mut app = OpenCADStudio::new_for_test();
|
||||
app.automation_op(r#"{"op":"new"}"#);
|
||||
app.automation_op(r#"{"op":"run","cmd":"PDMODE 3"}"#);
|
||||
app.automation_op(r#"{"op":"run","cmd":"LTSCALE 2.5"}"#);
|
||||
let i = app.active_tab;
|
||||
let h = &app.tabs[i].scene.document.header;
|
||||
assert_eq!(h.point_display_mode, 3, "PDMODE 3 should set point mode");
|
||||
assert!(
|
||||
(h.linetype_scale - 2.5).abs() < 1e-9,
|
||||
"LTSCALE 2.5 should set scale, got {}",
|
||||
h.linetype_scale
|
||||
);
|
||||
// No command should be left dangling.
|
||||
assert!(app.tabs[i].active_cmd.is_none(), "command must have finished");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn save_then_open_round_trips() {
|
||||
let mut app = OpenCADStudio::new_for_test();
|
||||
|
||||
Reference in new issue
Block a user