Merge pull request #10676 from dotCooCoo/fix/color-cad-table-rows

Tests: harmony labels and DXF miles and kilometers
This commit is contained in:
.CooCoo authored and GitHub committed 2026-12-03 01:16:13 -08:00
commit 8ed527a9bf
2 files changed
+11

No files matched your search

+6
View File
@@ -140,6 +140,12 @@ fn units_choose_the_default_scale() {
assert_eq!((i.unit, i.units.as_str()), (Unit::Millimeters, name));
assert!((i.scale * pt - 72.0 / 25.4).abs() < 1e-9, "{name}: 1 mm is {} units", i.scale);
}
// Miles and kilometers have no unit of their own, so they read as millimeters at their scale.
for (code, name, pt) in [("3", "Miles", 72.0 * 63_360.0), ("7", "Kilometers", 72.0 / 0.0254 * 1e3)] {
let i = info(&drawing(&[(9, "$INSUNITS"), (70, code)], &[], &[], LINE)).unwrap();
assert_eq!((i.unit, i.units.as_str()), (Unit::Millimeters, name));
assert!((i.scale * pt - 72.0 / 25.4).abs() < 1e-9, "{name}: 1 mm is {} units", i.scale);
}
let survey_in = open(&drawing(&[(9, "$INSUNITS"), (70, "22")], &[], &[], LINE), &ImportOptions::default()).document;
assert!((survey_in.artboards[0].rect.width() - 7200.0144000288).abs() < 1e-6, "{:?}", survey_in.artboards[0].rect);
let imperial = info(&drawing(&[(9, "$MEASUREMENT"), (70, "0")], &[], &[], LINE)).unwrap();
+5
View File
@@ -197,6 +197,11 @@ mod tests {
assert_eq!(Harmony::SplitComplementary.id(), "splitComplementary");
assert_eq!(Harmony::HighContrast3.id(), "highContrast3");
assert_eq!(parse("square"), None);
// The labels are written here and the ids come from the framework: a few shown labels read
// back as their rules.
for h in [Harmony::LeftComplement, Harmony::Monochromatic, Harmony::Compound2, Harmony::Pentagram] {
assert_eq!(parse(label(h)), Some(h), "{}", label(h));
}
}
#[test]