Merge pull request #10563 from dotCooCoo/fix/numbers-digits-need-leading-zeros

Type Tools: Make Numbers Sequence's Digits field is unavailable with Leading Zeros off
This commit is contained in:
.CooCoo authored and GitHub committed 2026-12-03 07:12:44 -08:00
commit 59cd3d4b19
3 files changed
+23 -2

No files matched your search

@@ -84,7 +84,9 @@ pub(crate) fn open(app: &mut VectorcraftApp) -> Result<Value, String> {
Param::section(tl!("Zeros")),
Param::new("leadingZeros", tl!("Leading Zeros"), ParamKind::bool(true)),
Param::new("fixedDigits", tl!("Fixed Number of Digits"), ParamKind::bool(false)).enabled_when("leadingZeros", FieldValue::Bool(true)),
Param::new("digits", tl!("Digits:"), ParamKind::int(Some(1), Some(30), 3)).enabled_when("fixedDigits", FieldValue::Bool(true)),
Param::new("digits", tl!("Digits:"), ParamKind::int(Some(1), Some(30), 3))
.enabled_when("fixedDigits", FieldValue::Bool(true))
.and_enabled_when_in("leadingZeros", [FieldValue::Bool(true)]),
Param::new("trailingZeros", tl!("Trailing Zeros"), ParamKind::bool(false)),
Param::new("order", tl!("Order:"), radio(&ORDERS)).enabled_when("shuffle", FieldValue::Bool(false)),
Param::new("replace", tl!("Replace:"), radio(&REPLACES)),
@@ -25,6 +25,24 @@ fn texts(app: &VectorcraftApp, ids: &[u64]) -> Vec<String> {
.collect()
}
/// Digits takes input only while Leading Zeros and Fixed Number of Digits are both on, since the
/// command gets `digits` only then.
#[test]
fn digits_takes_input_only_with_leading_zeros() {
let (app, _) = app();
let mut panel = crate::tests::panel_harness::Panel::new(app, crate::tests::picks::dialogs);
open_item(&mut panel.app(), "Type Tools", "Make Numbers Sequence…");
panel.frame();
let dialog = dialog_id(&panel.app());
set(&panel.app(), dialog, "fixedDigits", json!(true));
panel.frame();
assert!(panel.enabled("Digits"));
set(&panel.app(), dialog, "leadingZeros", json!(false));
panel.frame();
assert!(read(&panel.app(), dialog, super::params).get("digits").is_none());
assert!(!panel.enabled("Digits"), "with Leading Zeros off the command gets no digits");
}
/// The dialog's fields reach the command: an end and fixed digits only when turned on, and OK
/// numbers the objects as one undo step.
#[test]
+2 -1
View File
@@ -18832,7 +18832,8 @@ script.
| `removeUnused` | false; true needs `end` |
→ `{count (objects changed), ids (numbered, in order), removed}`. Make Numbers Sequence… opens a dialog (`ui.menuDialog
{command}`, dialog key `addon.type.numbers`) whose fields are the command's parameters, with Preview.
{command}`, dialog key `addon.type.numbers`) whose fields are the command's parameters, with Preview. Its Digits field takes input only while Leading Zeros
and Fixed Number of Digits are both on.
```json
{"name":"run_command","arguments":{"command":"addon.type.numbers","params":{"start":1,"order":"rows"}}}