forked from 1b-agent/opencadstudio-upstream
feat(blocks): edit action selections and refresh evaluated references
Add BACTIONSET and the Block Editor Action Selection ribbon entry. Pick or preselect an action, replace/add/remove its drawing targets, or redefine a Stretch frame while preserving the native action and graph identity. Retain existing Stretch vertex bindings during target edits and bind new targets against the stored frame. Allow removing invalid bindings or rebuilding them through a replacement frame. Rebuild evaluated references at their independent cached values so removed targets lose old action effects, with local undo, discard and one drawing save delta. Validate synthetic native DWG/DXF roundtrips, shared COPY representations, stale-result guards, reference geometry refresh, frame/cancel/history and the real ribbon flyout. 347 block tests pass (6 existing opt-in ignored), plus 42 dock and 27 viewport tests.
This commit is contained in:
1 parent
042f26a4cc
commit
7c91f5835e
15 files changed
+1083
-69
No files matched your search
@@ -1244,6 +1244,75 @@ fn block_actions_palette_controls_require_compatible_parameters_and_start_comman
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn block_actions_set_ribbon_flyout_starts_action_selection_and_uses_preselected_marker() {
|
||||
with_stack(|| {
|
||||
use crate::scene::block_actions::{self as actions, Kind};
|
||||
let mut app = authoring_app();
|
||||
let i = app.active_tab;
|
||||
let _ = app.run_command_line("BPARAMETER LINEAR 0,0 10,0 5,2");
|
||||
let def = app.tabs[i].active_block_edit_session().unwrap().br_handle;
|
||||
let p = actions::parameters(&app.tabs[i].scene.document, def, Kind::Move)[0].handle;
|
||||
let targets = app.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
.block_records
|
||||
.get("AUTHOR")
|
||||
.unwrap()
|
||||
.entity_handles
|
||||
.clone();
|
||||
let a = actions::create(
|
||||
&mut app.tabs[i].scene.document,
|
||||
def,
|
||||
Kind::Move,
|
||||
p,
|
||||
&targets,
|
||||
glam::DVec3::new(3., 4., 0.),
|
||||
)
|
||||
.unwrap();
|
||||
app.tabs[i].selected_authoring = Some(a);
|
||||
app.ribbon
|
||||
.set_collapse_mode(crate::ui::ribbon::CollapseMode::Collapsed);
|
||||
// The top-level Manage tab has the same label as this panel opener.
|
||||
// Open the existing panel, then click the new command in its real flyout.
|
||||
let _ = app.update(Message::ToggleRibbonPanel("Manage".into()));
|
||||
assert_eq!(app.ribbon.collapsed_open.as_deref(), Some("Manage"));
|
||||
let messages = {
|
||||
let mut simulator = iced_test::Simulator::with_size(
|
||||
iced::Settings::default(),
|
||||
VIEW_SIZE,
|
||||
app.view_main(),
|
||||
);
|
||||
simulator
|
||||
.click("Action Selection")
|
||||
.expect("action selection in Manage flyout");
|
||||
simulator.into_messages().collect::<Vec<_>>()
|
||||
};
|
||||
for message in messages {
|
||||
let _ = app.update(message);
|
||||
}
|
||||
assert_eq!(
|
||||
app.tabs[i].active_cmd.as_ref().unwrap().name(),
|
||||
"BACTIONSET"
|
||||
);
|
||||
assert!(app.tabs[i]
|
||||
.active_cmd
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.prompt()
|
||||
.contains("New/Add/Remove"));
|
||||
let _ = app.feed_command(crate::command::StepInput::Enter);
|
||||
assert!(app.tabs[i]
|
||||
.active_cmd
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.is_selection_gathering());
|
||||
let before = app.tabs[i].scene.document.clone();
|
||||
let _ = app.update(Message::CommandEscape);
|
||||
assert_eq!(app.tabs[i].scene.document, before);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn block_actions_stretch_palette_requires_distance_parameter() {
|
||||
with_stack(|| {
|
||||
|
||||
Reference in new issue
Block a user