[librsvg/wip/dimensions-api: 7/11] length.rs: Add normalization tests for the new LengthUnit types



commit 95f3fe32ded7b4c35e0917c71da5bfc31a458a97
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Feb 6 18:13:24 2019 -0600

    length.rs: Add normalization tests for the new LengthUnit types

 rsvg_internals/src/length.rs | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/rsvg_internals/src/length.rs b/rsvg_internals/src/length.rs
index 9f882b7d..78d75a40 100644
--- a/rsvg_internals/src/length.rs
+++ b/rsvg_internals/src/length.rs
@@ -509,6 +509,23 @@ mod tests {
             LengthVertical::new(10.0, LengthUnit::In).normalize(&values, &params),
             500.0
         );
+
+        assert_approx_eq_cairo!(
+            LengthHorizontal::new(10.0, LengthUnit::Cm).normalize(&values, &params),
+            400.0 / CM_PER_INCH
+        );
+        assert_approx_eq_cairo!(
+            LengthHorizontal::new(10.0, LengthUnit::Mm).normalize(&values, &params),
+            400.0 / MM_PER_INCH
+        );
+        assert_approx_eq_cairo!(
+            LengthHorizontal::new(10.0, LengthUnit::Pt).normalize(&values, &params),
+            400.0 / POINTS_PER_INCH
+        );
+        assert_approx_eq_cairo!(
+            LengthHorizontal::new(10.0, LengthUnit::Pc).normalize(&values, &params),
+            400.0 / PICA_PER_INCH
+        );
     }
 
     #[test]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]