forked from 1b-agent/opencadstudio-upstream
feat(plugin): ModuleEvent::PluginFileDialog for native file import
Add-ons had no way to request a file picker — only the host's own Open dialog. PluginFileDialog lets a plugin tool ask the host to open a native picker; on selection the host dispatches "<command> <path>" back to the plugin with original case preserved (bypassing the command-line upper-casing that mangles case-sensitive paths on Linux/macOS). The demo plugin gains an Import tool exercising it. Part of the #100 extensibility epic (surfaced in #106). Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
844069b4ef
commit
50825b6346
8 files changed
+107
-7
No files matched your search
@@ -139,6 +139,20 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plugin_file_dialog_dispatch_preserves_case() {
|
||||
// ModuleEvent::PluginFileDialog dispatches "<command> <path>" verbatim;
|
||||
// the mixed-case path must reach the plugin unaltered.
|
||||
let mut app = OpenCADStudio::new_for_test();
|
||||
let line = "DP_IMPORT /home/User/My Points.CSV";
|
||||
assert!(try_dispatch(&mut app, 0, line));
|
||||
let info = app.command_history_info();
|
||||
assert!(
|
||||
info.iter().any(|t| t.contains("/home/User/My Points.CSV")),
|
||||
"path case not preserved; info: {info:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unknown_plugin_command_falls_through() {
|
||||
let mut app = OpenCADStudio::new_for_test();
|
||||
|
||||
Reference in new issue
Block a user