forked from 1b-agent/opencadstudio-upstream
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
838e397a6c
commit
bcd52be4c7
28 files changed
+153
-36
No files matched your search
@@ -6560,3 +6560,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6548,3 +6548,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6545,3 +6545,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6546,3 +6546,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6548,3 +6548,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6548,3 +6548,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6545,3 +6545,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6548,3 +6548,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6536,3 +6536,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6532,3 +6532,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6547,3 +6547,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6536,3 +6536,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6547,3 +6547,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6548,3 +6548,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6546,3 +6546,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6547,3 +6547,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6548,3 +6548,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6549,3 +6549,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6531,3 +6531,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing File
|
||||
@@ -6543,3 +6543,9 @@ keytips =
|
||||
selection-report =
|
||||
.found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total
|
||||
.found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total
|
||||
|
||||
block-def =
|
||||
.name-too-short = The name must be at least one character long.
|
||||
.name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = `
|
||||
.definition-changed-redefine = The block definition has changed. Do you want to redefine it ?
|
||||
.create-drawing-file = Create Drawing 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()));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -511,7 +511,8 @@ pub enum WblockSource {
|
||||
}
|
||||
|
||||
/// -WBLOCK: `Enter name of output file:` → (replace?) →
|
||||
/// `Enter name of existing block or [= (block=output file)/* (whole drawing)] <define new drawing>:`
|
||||
/// `Enter name of existing block or [= (block=output file)/* (whole drawing)]
|
||||
/// <define new drawing>:`
|
||||
/// → `Specify insertion base point or [mOde]:` → `Select objects:`.
|
||||
pub struct DashWblockCommand {
|
||||
step: WblockStep,
|
||||
|
||||
@@ -643,7 +643,7 @@ fn locked_noop_redefine_leaves_the_instance_where_it_is() {
|
||||
fn locked_block_definition_dialog_prefills_the_existing_definition_base_point() {
|
||||
// base-point fix (D): choosing an existing block in the Block Definition dialog
|
||||
// prefills the base point from that definition, so a redefine starts from
|
||||
// the base it already has. A new block still starts at 0.0000.
|
||||
// the base it already has. A new block starts at 0.
|
||||
let scene = scene_with_bp_test();
|
||||
assert_close(
|
||||
block_base_point(&scene.document, BP_TEST),
|
||||
@@ -652,11 +652,11 @@ fn locked_block_definition_dialog_prefills_the_existing_definition_base_point()
|
||||
"the drawing's block base point",
|
||||
);
|
||||
|
||||
// A new block: the fields stay at 0.0000.
|
||||
// A new block: the fields start at 0.
|
||||
let fresh = BlockDefinitionState::new(vec![BP_TEST.to_string()], Vec::new(), 0);
|
||||
assert_eq!(fresh.base_point_x, "0.0000");
|
||||
assert_eq!(fresh.base_point_y, "0.0000");
|
||||
assert_eq!(fresh.base_point_z, "0.0000");
|
||||
assert_eq!(fresh.base_point_x, "0");
|
||||
assert_eq!(fresh.base_point_y, "0");
|
||||
assert_eq!(fresh.base_point_z, "0");
|
||||
assert_eq!(fresh.parse_base_point(), DVec3::ZERO);
|
||||
|
||||
// Picking the existing block (what `Message::BlockDefNameSelect` does).
|
||||
|
||||
+2
-1
@@ -1380,7 +1380,8 @@ pub fn documents_dir() -> Option<std::path::PathBuf> {
|
||||
let mut raw: windows_sys::core::PWSTR = std::ptr::null_mut();
|
||||
// SAFETY: SHGetKnownFolderPath writes a CoTaskMemAlloc'd, NUL-terminated
|
||||
// wide string to `raw`, freed below.
|
||||
let hr = unsafe { SHGetKnownFolderPath(&FOLDERID_Documents, 0, std::ptr::null_mut(), &mut raw) };
|
||||
let hr =
|
||||
unsafe { SHGetKnownFolderPath(&FOLDERID_Documents, 0, std::ptr::null_mut(), &mut raw) };
|
||||
let path = if hr == 0 && !raw.is_null() {
|
||||
// SAFETY: `raw` is a valid NUL-terminated wide string from the call above.
|
||||
let len = unsafe { (0..).take_while(|&k| *raw.add(k) != 0).count() };
|
||||
|
||||
Reference in new issue
Block a user