block definition: locale coverage, tests for the new defaults, wraps

- block-def strings in every locale (English until translated); the
  catalog test requires each locale to carry them.
- A new block's base point starts at 0, and ATTMAN / BATTMAN report a
  drawing without attributed blocks; the tests expect that now.
- Lines over 100 columns wrapped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-15 00:16:35 +03:00
1 parent 838e397a6c
commit bcd52be4c7
28 files changed
+153 -36

No files matched your search

+2 -2
View File
@@ -1582,8 +1582,8 @@ mod block_base_point_tests {
app.block_definition
.as_ref()
.map(|s| s.base_point_y.as_str()),
Some("0.0000"),
"a new block still starts at 0.0000"
Some("0"),
"a new block starts at 0"
);
let _ = app.update(Message::BlockDefNameSelect("DEF_BASE".to_string()));
+2 -2
View File
@@ -204,8 +204,8 @@ impl OpenCADStudio {
self.push_undo_snapshot(i, "ATTSYNC");
let mut changes = Vec::new();
for handle in inserts {
let Some(codec::EntityType::Insert(ins)) = self.tabs[i].scene.document.get_entity(handle)
else {
let document = &self.tabs[i].scene.document;
let Some(codec::EntityType::Insert(ins)) = document.get_entity(handle) else {
continue;
};
let transform = crate::scene::render_graph::insert_transform_with_base(ins, base);
+9 -22
View File
@@ -612,8 +612,8 @@ impl OpenCADStudio {
// ATTSYNC <block>: the named block, without prompts.
cmd if cmd.starts_with("ATTSYNC ") => {
let arg = cmd.trim_start_matches("ATTSYNC").trim().to_string();
let table =
crate::modules::insert::block_cmdline::BlockTable::of(&self.tabs[i].scene.document);
let document = &self.tabs[i].scene.document;
let table = crate::modules::insert::block_cmdline::BlockTable::of(document);
match table.attributed.iter().find(|b| b.eq_ignore_ascii_case(&arg)) {
Some(block) => {
let block = block.clone();
@@ -1725,27 +1725,14 @@ mod tests {
}
// ATTMAN and BATTMAN are the Block Attribute Manager; this build routes both
// to the attribute editor (ATTEDIT) instead of the old command-line listing.
// With nothing selected they start the same interactive pick as ATTEDIT,
// byte for byte, and never emit the old "no matching block" listing text.
// to the attribute editor (ATTEDIT). A drawing without attributed blocks
// has nothing to manage, which both report instead of opening it.
#[test]
fn attman_and_battman_route_to_attedit() {
let attedit = run_capture(&mut fresh_app(), "ATTEDIT");
let attman = run_capture(&mut fresh_app(), "ATTMAN");
let battman = run_capture(&mut fresh_app(), "BATTMAN");
assert_eq!(
attman, attedit,
"ATTMAN must behave like ATTEDIT, got: {attman:?} vs {attedit:?}"
);
assert_eq!(
battman, attedit,
"BATTMAN must behave like ATTEDIT, got: {battman:?} vs {attedit:?}"
);
assert!(
!attman.contains("no matching block"),
"ATTMAN must not run the old command-line listing, got: {attman:?}"
);
fn attman_and_battman_report_a_drawing_without_attributed_blocks() {
for command in ["ATTMAN", "BATTMAN"] {
let output = run_capture(&mut fresh_app(), command);
assert_eq!(output, "This drawing contains no attributed blocks.", "{command}");
}
}
#[test]
+8 -2
View File
@@ -799,7 +799,9 @@ impl OpenCADStudio {
attdef_on_screen: crate::modules::draw::draw::attdef::session().on_screen,
block_base_on_screen: block_defaults.base_on_screen,
block_objects_on_screen: block_defaults.objects_on_screen,
block_object_mode: crate::modules::insert::block_cmdline::mode_code(block_defaults.mode),
block_object_mode: crate::modules::insert::block_cmdline::mode_code(
block_defaults.mode,
),
block_allow_exploding: block_defaults.allow_exploding,
block_open_in_editor: block_defaults.open_in_editor,
wblock_object_mode: crate::modules::insert::block_cmdline::mode_code(
@@ -2439,7 +2441,11 @@ impl OpenCADStudio {
d.header.insertion_units = unit;
d
}
crate::modules::insert::block_cmdline::WblockSource::Objects { handles, base, .. } => {
crate::modules::insert::block_cmdline::WblockSource::Objects {
handles,
base,
..
} => {
crate::modules::insert::wblock::extract_entities_to_doc_with_base(
&document, &handles, base, unit,
)
+3 -1
View File
@@ -6082,7 +6082,9 @@ impl OpenCADStudio {
crate::modules::insert::block_cmdline::defaults().wblock_mode = mode;
self.persist_settings_if_changed();
let source = match state.source_mode {
WblockSourceMode::Block => WblockSource::Block(state.block_name.trim().to_string()),
WblockSourceMode::Block => {
WblockSource::Block(state.block_name.trim().to_string())
}
WblockSourceMode::EntireDrawing => WblockSource::Drawing,
WblockSourceMode::Objects => WblockSource::Objects {
handles: state.selected_handles.clone(),