diff --git a/crates/engine/src/cmd/blocks.rs b/crates/engine/src/cmd/blocks.rs index 8189e37c1..6ea5acdc1 100644 --- a/crates/engine/src/cmd/blocks.rs +++ b/crates/engine/src/cmd/blocks.rs @@ -631,11 +631,35 @@ enum InsStage { /// rows). Cell(Vec2), ColSpacing, + /// The second of two points a preset or the column spacing takes after a point (AutoCAD 2024 + /// asks "Specify second point:"), from the first. + Second(TwoPoints, Vec2), Attribs, /// A Verify attribute asked again. Verify, } +/// What two points give: a preset scale factor (all axes, or one) or the column spacing by their +/// distance, the preset rotation by their direction. +#[derive(Clone, Copy, Debug, PartialEq)] +enum TwoPoints { + Scale, + Axis(usize), + Rotation, + ColSpacing, +} + +// AutoCAD 2024's messages at INSERT's and MINSERT's scale, rotation and spacing prompts (measured): +// a scale factor of 0; anything else that isn't a number where two points give a distance or an +// angle, where a point gives the distance from the insertion point, and where only a number does. +const NONZERO: &str = "Value must be nonzero."; +/// Exploded INSERT's scale factor, which must be positive. +const POSITIVE: &str = "Value must be positive and nonzero."; +const TWO_POINTS: &str = "Requires numeric distance or two points."; +const ANGLE_TWO_POINTS: &str = "Requires valid numeric angle or two points."; +const SECOND_POINT: &str = "Requires numeric distance or second point."; +const NUMERIC: &str = "Requires numeric value."; + #[derive(Default)] struct InsertM { stage: InsStage, @@ -799,6 +823,66 @@ impl InsertM { } Ok(d) } + + /// The Scale preset `f` for every axis. + fn preset_scale(&mut self, s: &mut Session, f: f64) -> Result { + self.scale = Some(Vec2::new(f, f)); + self.z_scale = Some(f.abs()); + // An axis preset after it changes that axis alone (Scale -3 then X 2: 2/-3/3). + self.axes = [Some(f), Some(f), Some(f.abs())]; + // Exploded insertion asks its one scale factor after the insertion point. + if self.at.is_some() { + return self.advance(s); + } + self.stage = InsStage::Point; + Ok(Step::Continue) + } + + /// One axis preset: the others are 1, and no scale factors are asked after the point. + fn preset_axis(&mut self, ax: usize, f: f64) -> Result { + if let Some(a) = self.axes.get_mut(ax) { + *a = Some(f); + } + let [x, y, z] = self.axes.map(|a| a.unwrap_or(1.0)); + self.scale = Some(Vec2::new(x, y)); + self.z_scale = Some(z.abs()); + self.stage = InsStage::Point; + Ok(Step::Continue) + } + + fn preset_rotation(&mut self, r: f64) -> Result { + self.rotation = Some(r); + self.stage = InsStage::Point; + Ok(Step::Continue) + } + + /// The second of two points (AutoCAD 2024, measured): their distance is a preset scale factor + /// (0 refused) or the column spacing (0 taken), their direction the preset rotation. Enter + /// keeps a preset's default and is refused for the spacing, as anything else is; a refusal asks + /// the first prompt again. + fn second_point(&mut self, s: &mut Session, what: TwoPoints, a: Vec2, i: Input) -> Result { + let (first, refused) = match what { + TwoPoints::Scale => (InsStage::PresetScale, TWO_POINTS), + TwoPoints::Axis(ax) => (InsStage::PresetAxis(ax), TWO_POINTS), + TwoPoints::Rotation => (InsStage::PresetRotation, ANGLE_TWO_POINTS), + TwoPoints::ColSpacing => (InsStage::ColSpacing, TWO_POINTS), + }; + self.stage = first; + match (what, i) { + (TwoPoints::ColSpacing, Input::Point(b)) => { + self.col_spacing = Some(a.dist(b)); + self.advance(s) + } + (TwoPoints::Rotation, Input::Point(b)) => self.preset_rotation(a.angle_to(b)), + (TwoPoints::Rotation, Input::Enter) => self.preset_rotation(0.0), + (TwoPoints::Scale | TwoPoints::Axis(_), Input::Point(b)) if a.dist(b) == 0.0 => Err(EngineError::Other(NONZERO.into())), + (TwoPoints::Scale, Input::Point(b)) => self.preset_scale(s, a.dist(b)), + (TwoPoints::Scale, Input::Enter) => self.preset_scale(s, 1.0), + (TwoPoints::Axis(ax), Input::Point(b)) => self.preset_axis(ax, a.dist(b)), + (TwoPoints::Axis(ax), Input::Enter) => self.preset_axis(ax, 1.0), + _ => Err(EngineError::Other(refused.into())), + } + } } /// A distance typed at MINSERT's grid prompts: any finite number, negative or 0 too. @@ -806,8 +890,14 @@ fn distance(t: &str) -> Result { number(t).filter(|v| v.is_finite()).ok_or_else(|| EngineError::Other("Requires a distance.".into())) } -fn nonzero(t: &str) -> Result { - number(t).filter(|v| *v != 0.0).ok_or_else(|| EngineError::Other("Requires a non-zero number.".into())) +/// A scale factor typed at `t`: 0 gets AutoCAD 2024's "Value must be nonzero.", anything that +/// isn't a number the prompt's own message. +fn nonzero(t: &str, not_a_number: &str) -> Result { + let v = number(t).ok_or_else(|| EngineError::Other(not_a_number.into()))?; + if v == 0.0 { + return Err(EngineError::Other(NONZERO.into())); + } + Ok(v) } impl Interactive for InsertM { @@ -828,22 +918,31 @@ impl Interactive for InsertM { } InsStage::Point => Prompt::new("Specify insertion point", Accept::POINT).kw(&["Basepoint", "Scale", "X", "Y", "Z", "Rotate"]), InsStage::BasePoint => Prompt::new("Specify base point", Accept::POINT), - InsStage::PresetScale => Prompt::new("Specify scale factor for XYZ axes", Accept::NUMBER).default("1"), - InsStage::PresetAxis(i) => Prompt::new(format!("Specify {} scale factor", ["X", "Y", "Z"][i.min(2)]), Accept::NUMBER).default("1"), + // Exploded, after the insertion point, it takes a number only. + InsStage::PresetScale if self.at.is_some() => Prompt::new("Specify scale factor for XYZ axes", Accept::NUMBER).default("1"), + InsStage::PresetScale => Prompt::new("Specify scale factor for XYZ axes", Accept::POINT_OR_NUMBER).default("1"), + InsStage::PresetAxis(i) => { + Prompt::new(format!("Specify {} scale factor", ["X", "Y", "Z"][i.min(2)]), Accept::POINT_OR_NUMBER).default("1") + } + // Typed text is read as before (`<<45` the angle, not an override for a point); a point + // still comes from a click or LISP. InsStage::PresetRotation => Prompt::new("Specify rotation angle", Accept::NUMBER).default("0"), + // Text is read here, not taken as a distance along the rubber band: the core console + // refuses 5 at this prompt (measured). + InsStage::Second(_, a) => Prompt::new("Specify second point", Accept::POINT_OR_NUMBER).base(a), InsStage::XScale if self.xyz => Prompt::new("Specify X scale factor", Accept::POINT_OR_NUMBER).kw(&["Corner"]).default("1").base(at), InsStage::XScale => { Prompt::new("Enter X scale factor, specify opposite corner", Accept::POINT_OR_NUMBER).kw(&["Corner", "XYZ"]).default("1").base(at) } InsStage::Corner => Prompt::new("Specify opposite corner", Accept::POINT).base(at), InsStage::YScale => Prompt::new("Enter Y scale factor", Accept::NUMBER).default("use X scale factor"), - InsStage::ZScale => Prompt::new("Specify Z scale factor or", Accept::NUMBER).default("use X scale factor"), + InsStage::ZScale => Prompt::new("Specify Z scale factor or", Accept::POINT_OR_NUMBER).default("use X scale factor").base(at), InsStage::Rotation => Prompt::new("Specify rotation angle", Accept::POINT_OR_NUMBER).default("0").base(at), InsStage::Rows => Prompt::new("Enter number of rows (---)", Accept::NUMBER).default("1"), InsStage::Cols => Prompt::new("Enter number of columns (|||)", Accept::NUMBER).default("1"), InsStage::RowSpacing => Prompt::new("Enter distance between rows or specify unit cell (---)", Accept::POINT_OR_NUMBER), InsStage::Cell(a) => Prompt::new("Specify opposite corner", Accept::POINT).corner(a), - InsStage::ColSpacing => Prompt::new("Specify distance between columns (|||)", Accept::NUMBER), + InsStage::ColSpacing => Prompt::new("Specify distance between columns (|||)", Accept::POINT_OR_NUMBER), InsStage::Attribs => { let (_, prompt, default, _) = self.attdefs.get(self.values.len()).cloned().unwrap_or_default(); let p = Prompt::new(if prompt.is_empty() { "Enter attribute value".into() } else { prompt }, Accept::TEXT); @@ -919,45 +1018,58 @@ impl Interactive for InsertM { self.stage = InsStage::Point; } } - InsStage::PresetScale => { - let f = match i { - Input::Text(t) => nonzero(&t)?, - Input::Enter => 1.0, - _ => return Ok(Step::Continue), + // Exploded, after the insertion point: a positive number only (AutoCAD 2024 refuses a + // point and x with "Requires numeric value.", 0 and -2 with "Value must be positive and + // nonzero.", measured). + InsStage::PresetScale if self.at.is_some() => { + return match i { + Input::Text(t) => { + let f = number(&t).ok_or_else(|| EngineError::Other(NUMERIC.into()))?; + let f = Some(f).filter(|f| *f > 0.0).ok_or_else(|| EngineError::Other(POSITIVE.into()))?; + self.preset_scale(s, f) + } + Input::Enter => self.preset_scale(s, 1.0), + _ => Err(EngineError::Other(NUMERIC.into())), }; - self.scale = Some(Vec2::new(f, f)); - self.z_scale = Some(f.abs()); - // An axis preset after it changes that axis alone (Scale -3 then X 2: 2/-3/3). - self.axes = [Some(f), Some(f), Some(f.abs())]; - // Exploded insertion asks its one scale factor after the insertion point. - if self.at.is_some() { - return self.advance(s); - } - self.stage = InsStage::Point; } - // One axis preset: the others are 1, and no scale factors are asked after the point. + // A point at a preset is the first of two (AutoCAD 2024, measured). + InsStage::PresetScale => { + return match i { + Input::Point(p) => { + self.stage = InsStage::Second(TwoPoints::Scale, p); + Ok(Step::Continue) + } + Input::Text(t) => self.preset_scale(s, nonzero(&t, TWO_POINTS)?), + Input::Enter => self.preset_scale(s, 1.0), + _ => Err(EngineError::Other(TWO_POINTS.into())), + }; + } InsStage::PresetAxis(ax) => { - let f = match i { - Input::Text(t) => nonzero(&t)?, - Input::Enter => 1.0, - _ => return Ok(Step::Continue), + return match i { + Input::Point(p) => { + self.stage = InsStage::Second(TwoPoints::Axis(ax), p); + Ok(Step::Continue) + } + Input::Text(t) => self.preset_axis(ax, nonzero(&t, TWO_POINTS)?), + Input::Enter => self.preset_axis(ax, 1.0), + _ => Err(EngineError::Other(TWO_POINTS.into())), }; - if let Some(a) = self.axes.get_mut(ax) { - *a = Some(f); - } - let [x, y, z] = self.axes.map(|a| a.unwrap_or(1.0)); - self.scale = Some(Vec2::new(x, y)); - self.z_scale = Some(z.abs()); - self.stage = InsStage::Point; } InsStage::PresetRotation => { - self.rotation = Some(match i { - Input::Text(t) => s.angle_settings().direction(&t).ok_or_else(|| EngineError::Other("Requires an angle.".into()))?, - Input::Enter => 0.0, - _ => return Ok(Step::Continue), - }); - self.stage = InsStage::Point; + return match i { + Input::Point(p) => { + self.stage = InsStage::Second(TwoPoints::Rotation, p); + Ok(Step::Continue) + } + Input::Text(t) => { + let r = s.angle_settings().direction(&t).ok_or_else(|| EngineError::Other(ANGLE_TWO_POINTS.into()))?; + self.preset_rotation(r) + } + Input::Enter => self.preset_rotation(0.0), + _ => Err(EngineError::Other(ANGLE_TWO_POINTS.into())), + }; } + InsStage::Second(what, a) => return self.second_point(s, what, a, i), InsStage::XScale => match i { Input::Keyword(k) if k == "Corner" => self.stage = InsStage::Corner, Input::Keyword(k) if k == "XYZ" => self.xyz = true, @@ -966,7 +1078,7 @@ impl Interactive for InsertM { return self.corner_scale(s, sc); } Input::Text(t) => { - self.x_scale = Some(nonzero(&t)?); + self.x_scale = Some(nonzero(&t, "Requires a non-zero number.")?); self.stage = InsStage::YScale; } Input::Enter => { @@ -983,10 +1095,11 @@ impl Interactive for InsertM { } InsStage::YScale => { let x = self.x_scale.unwrap_or(1.0); + // A number only: AutoCAD 2024 refuses a point here (measured). let y = match i { - Input::Text(t) => nonzero(&t)?, + Input::Text(t) => nonzero(&t, NUMERIC)?, Input::Enter => x, - _ => return Ok(Step::Continue), + _ => return Err(EngineError::Other(NUMERIC.into())), }; self.scale = Some(Vec2::new(x, y)); if self.xyz { @@ -995,11 +1108,15 @@ impl Interactive for InsertM { } return self.advance(s); } + // A point gives its distance from the insertion point (AutoCAD 2024, measured). InsStage::ZScale => { self.z_scale = Some(match i { - Input::Text(t) => nonzero(&t)?, + Input::Text(t) => nonzero(&t, SECOND_POINT)?, Input::Enter => self.x_scale.unwrap_or(1.0).abs(), - _ => return Ok(Step::Continue), + Input::Point(p) => { + Some(self.at.unwrap_or_default().dist(p)).filter(|d| *d != 0.0).ok_or_else(|| EngineError::Other(NONZERO.into()))? + } + _ => return Err(EngineError::Other(SECOND_POINT.into())), }); return self.advance(s); } @@ -1045,11 +1162,19 @@ impl Interactive for InsertM { return self.advance(s); } } + // A distance, or two points (AutoCAD 2024, measured): Enter is refused too. InsStage::ColSpacing => { - if let Input::Text(t) = i { - self.col_spacing = Some(distance(&t)?); - return self.advance(s); - } + return match i { + Input::Text(t) => { + self.col_spacing = Some(number(&t).filter(|v| v.is_finite()).ok_or_else(|| EngineError::Other(TWO_POINTS.into()))?); + self.advance(s) + } + Input::Point(p) => { + self.stage = InsStage::Second(TwoPoints::ColSpacing, p); + Ok(Step::Continue) + } + _ => Err(EngineError::Other(TWO_POINTS.into())), + }; } InsStage::Attribs => { let (tag, _, default, _) = self.attdefs.get(self.values.len()).cloned().unwrap_or_default(); diff --git a/crates/engine/tests/it/insert_prompts.rs b/crates/engine/tests/it/insert_prompts.rs index 00c5b8e41..04f300e4e 100644 --- a/crates/engine/tests/it/insert_prompts.rs +++ b/crates/engine/tests/it/insert_prompts.rs @@ -129,3 +129,105 @@ fn insert_options_match_autocad() { s.cmdline("(command \"_.-INSERT\" \"B7\" \"_B\" '(612350.678 2398770.432) '(612365.678 2398775.432) 1 \"\" 0)").unwrap(); assert_eq!(last_insert(&s), (115.0, 55.0, 1.0, 1.0, 1.0, 0.0)); } + +/// A session with block B1, a line from (0, 0) to (10, 0) based at the origin. +fn with_b1() -> Session { + let mut s = Session::new(); + s.execute("line", &json!({ "points": [[0, 0], [10, 0]] })).unwrap(); + s.execute("block", &json!({ "name": "B1", "base": [0, 0], "keep": "delete", "handles": ["100"] })).unwrap(); + s +} + +/// Points at the scale and rotation prompts, as AutoCAD 2024 takes them (accoreconsole, unitless; +/// INSERT measured at Scale, Rotate and XYZ's Z, MINSERT at every one): at the Scale, X, Y, Z and +/// Rotate presets a point is the first of two, "Specify second point:" gives their distance or +/// direction, and Enter there keeps the default; at XYZ's Z a point gives its distance from the +/// insertion point. +#[test] +fn points_at_the_scale_and_rotation_prompts() { + let cases = [ + ("\"_S\" '(3.0 4.0) '(6.0 8.0) '(10.0 0.0) 0", (10.0, 0.0, 5.0, 5.0, 5.0, 0.0)), + ("\"_X\" '(3.0 4.0) '(6.0 8.0) '(10.0 0.0) 0", (10.0, 0.0, 5.0, 1.0, 1.0, 0.0)), + ("\"_Z\" '(3.0 4.0) '(6.0 8.0) '(10.0 0.0) 0", (10.0, 0.0, 1.0, 1.0, 5.0, 0.0)), + ("\"_R\" '(3.0 4.0) '(3.0 8.0) '(10.0 0.0) 1 \"\"", (10.0, 0.0, 1.0, 1.0, 1.0, 90.0)), + // Enter at the second point keeps the preset's default. + ("\"_S\" '(3.0 4.0) \"\" '(10.0 0.0) 0", (10.0, 0.0, 1.0, 1.0, 1.0, 0.0)), + ("\"_X\" '(3.0 4.0) \"\" '(10.0 0.0) 0", (10.0, 0.0, 1.0, 1.0, 1.0, 0.0)), + ("\"_R\" '(3.0 4.0) \"\" '(10.0 0.0) 1 \"\"", (10.0, 0.0, 1.0, 1.0, 1.0, 0.0)), + // <<45 typed at the Rotate preset is still the angle 45, not an override for a point. + ("\"_R\" \"<<45\" '(10.0 0.0) 1 \"\"", (10.0, 0.0, 1.0, 1.0, 1.0, 45.0)), + // The same point twice is no turn. + ("\"_R\" '(3.0 4.0) '(3.0 4.0) '(10.0 0.0) 1 \"\"", (10.0, 0.0, 1.0, 1.0, 1.0, 0.0)), + ]; + for (args, want) in cases { + let mut s = with_b1(); + s.cmdline(&format!("(command \"_.-INSERT\" \"B1\" {args})")).unwrap(); + assert!(s.running.is_none(), "{args}: {}", s.prompt_text()); + assert_eq!(last_insert(&s), want, "{args}"); + } + // Typed at the command line too: the prompt asks for the second point. + let mut s = with_b1(); + s.cmdline("-insert B1 s 3,4").unwrap(); + assert_eq!(s.current_prompt().map(|p| p.display()).as_deref(), Some("Specify second point:")); + s.cmdline("6,8 10,0 0").unwrap(); + assert_eq!(last_insert(&s), (10.0, 0.0, 5.0, 5.0, 5.0, 0.0)); + // XYZ's Z: (3, 4) is √65 from the insertion point (10, 0). + let mut s = with_b1(); + s.cmdline("(command \"_.-INSERT\" \"B1\" '(10.0 0.0) \"_XYZ\" 2 3 '(3.0 4.0) 0)").unwrap(); + let (.., z, _) = last_insert(&s); + assert!((z - 65f64.sqrt()).abs() < 1e-9, "{z}"); +} + +/// What the scale and rotation prompts refuse, with AutoCAD 2024's messages (accoreconsole, +/// measured), and the prompt asked again ("" for the same one): a refusal at "Specify second point:" +/// asks the first one. +#[test] +fn what_the_scale_and_rotation_prompts_refuse() { + const TWO: &str = "Requires numeric distance or two points."; + const NONZERO: &str = "Value must be nonzero."; + const NUMERIC: &str = "Requires numeric value."; + const SCALE: &str = "Specify scale factor for XYZ axes <1>:"; + const Y: &str = "Enter Y scale factor :"; + const Z: &str = "Specify Z scale factor or :"; + let cases = [ + ("-insert B1 s", "x", TWO, SCALE), + ("-insert B1 s", "0", NONZERO, SCALE), + ("-insert B1 s 3,4", "5", TWO, SCALE), + ("-insert B1 s 3,4", "3,4", NONZERO, SCALE), + ("-insert B1 x", "x", TWO, "Specify X scale factor <1>:"), + ("-insert B1 x", "0", NONZERO, "Specify X scale factor <1>:"), + ("-insert B1 x 3,4", "5", TWO, "Specify X scale factor <1>:"), + ("-insert B1 x 3,4", "3,4", NONZERO, "Specify X scale factor <1>:"), + ("-insert B1 r", "x", "Requires valid numeric angle or two points.", "Specify rotation angle <0>:"), + // A point from LISP: typed text at this prompt is read as an angle, as before. + ("-insert B1 r|(list 3 4)", "5", "Requires valid numeric angle or two points.", "Specify rotation angle <0>:"), + ("-insert B1 10,0", "0", NONZERO, ""), + ("-insert B1 10,0 2", "(list 3 4)", NUMERIC, Y), + ("-insert B1 10,0 2", "x", NUMERIC, Y), + ("-insert B1 10,0 2", "0", NONZERO, Y), + ("-insert B1 10,0 xyz 2 3", "x", "Requires numeric distance or second point.", Z), + ("-insert B1 10,0 xyz 2 3", "0", NONZERO, Z), + // XYZ's Z at the insertion point itself: no distance. + ("-insert B1 10,0 xyz 2 3", "10,0", NONZERO, Z), + // Exploded, after the insertion point, the scale is a positive number only. + ("-insert *B1 10,0", "(list 3 4)", NUMERIC, ""), + ("-insert *B1 10,0", "x", NUMERIC, ""), + ("-insert *B1 10,0", "0", "Value must be positive and nonzero.", ""), + ("-insert *B1 10,0", "-2", "Value must be positive and nonzero.", ""), + ]; + for (typed, bad, message, again) in cases { + let mut s = with_b1(); + // Separate inputs are split at `|`. + for t in typed.split('|') { + s.cmdline(t).unwrap(); + } + let before = s.current_prompt().map(|p| p.display()); + let logged = s.log.len(); + s.cmdline(bad).unwrap(); + let said: Vec<&str> = + s.log.iter().skip(logged).map(String::as_str).filter(|l| l.starts_with("Requires") || l.starts_with("Value must")).collect(); + assert_eq!(said, [message], "{typed} then {bad}"); + let again = if again.is_empty() { before.clone() } else { Some(again.to_string()) }; + assert_eq!(s.current_prompt().map(|p| p.display()), again, "{typed} then {bad}"); + } +} diff --git a/crates/engine/tests/it/minsert.rs b/crates/engine/tests/it/minsert.rs index e123876df..c48fe8ce5 100644 --- a/crates/engine/tests/it/minsert.rs +++ b/crates/engine/tests/it/minsert.rs @@ -117,6 +117,42 @@ fn the_prompts_follow_autocad_2024() { assert_eq!(grid(&i), (3, 2, 20.0, 15.0)); } +#[test] +fn the_column_spacing_takes_two_points() { + // AutoCAD 2024 at "Specify distance between columns (|||):": a point asks "Specify second + // point:", and the two points' distance is the spacing, 0 included; x and Enter there, and + // Enter or 5 at the second point, get "Requires numeric distance or two points." (measured). + let to_spacing = |s: &mut Session| { + let l = handle(&s.execute("line", &json!({"points": [[0, 0], [10, 0]]})).unwrap()); + s.execute("-block", &json!({"name": "B", "base": [0, 0], "handles": [l]})).unwrap(); + for input in ["minsert", "B", "10,0", "1", "", "0", "2", "2", "10"] { + s.cmdline(input).unwrap(); + } + assert_eq!(s.current_prompt().map(|p| p.display()).as_deref(), Some("Specify distance between columns (|||):")); + }; + for (second, spacing) in [("6,8", 5.0), ("3,4", 0.0)] { + let mut s = Session::new(); + to_spacing(&mut s); + s.cmdline("3,4").unwrap(); + assert_eq!(s.current_prompt().map(|p| p.display()).as_deref(), Some("Specify second point:")); + s.cmdline(second).unwrap(); + assert!(s.running.is_none(), "{}", s.prompt_text()); + let [i] = inserts(&s).try_into().unwrap(); + assert_eq!(grid(&i), (2, 2, spacing, 10.0), "{second}"); + } + for bad in [&["x"][..], &[""], &["3,4", ""], &["3,4", "5"]] { + let mut s = Session::new(); + to_spacing(&mut s); + let logged = s.log.len(); + for input in bad { + s.cmdline(input).unwrap(); + } + let said: Vec<&str> = s.log.iter().skip(logged).map(String::as_str).filter(|l| l.starts_with("Requires")).collect(); + assert_eq!(said, ["Requires numeric distance or two points."], "{bad:?}"); + assert_eq!(s.current_prompt().map(|p| p.display()).as_deref(), Some("Specify distance between columns (|||):"), "{bad:?}"); + } +} + #[test] fn counts_run_from_1_to_32767() { // AutoCAD 2024: "Requires an integer between 1 and 32767."