Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Merge remote-tracking branch 'origin/main' into centimeters-four-decimals

moppeeer4b3b6d0cf024
diff --cc crates/geom/src/units.rs
index 45b0ddaee,f1077ffce..47cbf6b8b
--- a/crates/geom/src/units.rs
+++ b/crates/geom/src/units.rs
@@@ -305,9 -306,17 +307,17 @@@ mod tests
(a - b).abs() < 1e-6
}
+ /// Tiny negatives that round to zero must not print a sign.
+ #[test]
+ fn tiny_negative_picas_ciceros_have_no_sign() {
+ assert_eq!(format_measure(-0.0004, Unit::Picas), "0p0");
+ assert_eq!(format_measure(-0.0004, Unit::Ciceros), "0c0");
+ assert_eq!(format_measure(-12.0, Unit::Picas), "-1p0");
+ }
+
- /// Inches show four decimals, as InDesign's fields do; other units three.
+ /// Inches and centimetres show four decimals, as InDesign's fields do; other units three.
#[test]
- fn inches_show_four_decimals() {
+ fn inches_and_centimeters_show_four_decimals() {
assert_eq!(format_measure(12.0, Unit::Inches), "0.1667 in");
assert_eq!(format_measure(210.0 * PT_PER_MM, Unit::Inches), "8.2677 in");
assert_eq!(format_measure(612.0, Unit::Inches), "8.5 in");