Tests: the multileader's DWG round trip runs, through CADCraft's record

The multileader DWG test that waited for craft-libs#2005 (ignored) now runs:
its scales and paper text height come back through DWG from CADCraft's own
record, and the DWG holds no multileader contexts. The contexts' round trip
through DWG follows with the bridge.

FredApps on #1362 (rule 31).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cody Vogt
2026-11-30 13:49:17 -06:00
co-authored by Claude Opus 5.5
parent 684afce03c
commit d3a7097e99
+5 -13
View File
@@ -746,10 +746,13 @@ fn a_multileader_gets_its_context_data_at_each_scale() {
assert!((x.arrow_size - y.arrow_size).abs() < 1e-9 && (x.dogleg - y.dogleg).abs() < 1e-9, "{y:?}");
}
/// A multileader's scales come back through DWG from CADCraft's own record (the DWG bridge
/// doesn't convert contexts yet, storytold/craft-libs#2005), at its paper size; the DWG holds no
/// multileader contexts.
#[cfg(not(target_arch = "wasm32"))]
#[test]
#[ignore = "needs the DWG bridge's annotation context conversion (storytold/craft-libs#2005) in the pinned craft-dwg"]
fn a_multileader_keeps_its_scales_through_dwg() {
cadcraft_io::dwg_worker::allow_in_process();
let (d, _) = with_mleader();
let dwg = cadcraft_io::write(&d, "x.dwg").unwrap();
let back = cadcraft_io::read(&dwg, "x.dwg").unwrap();
@@ -758,19 +761,8 @@ fn a_multileader_keeps_its_scales_through_dwg() {
assert_eq!(got, ["1:1", "1:10"]);
let EntityKind::MLeader(m) = &e.kind else { panic!("multileader") };
assert!((m.text.as_ref().unwrap().height - 2.5).abs() < 1e-9, "{m:?}");
// The DXF read back from the DWG has AutoCAD's layout and each context at its scale.
let text = String::from_utf8_lossy(&craft_dwg::dwg_to_dxf(&dwg).unwrap()).into_owned();
let ctx: Vec<Rec> = records(&text).into_iter().filter(|(k, _)| k == "ACDB_MLEADEROBJECTCONTEXTDATA_CLASS").collect();
let mut scales: Vec<f64> = ctx
.iter()
.map(|(_, t)| {
assert!(t.iter().all(|(c, v)| !(*c == 300 && v.starts_with("CONTEXT_DATA"))), "{t:?}");
let at = t.iter().position(|(c, _)| *c == 340).unwrap();
num(&t[at + 1..], 40)
})
.collect();
scales.sort_by(f64::total_cmp);
assert_eq!(scales, [1.0, 10.0]);
assert!(!records(&text).iter().any(|(k, _)| k == "ACDB_MLEADEROBJECTCONTEXTDATA_CLASS"), "no contexts in the DWG");
}
/// The fixture with AutoCAD's variable dictionary naming 1:10 as the current annotation scale.