[librsvg: 11/35] Compare and print test dimensions in points, not millimeters




commit 63941395a6781e07b1767cc6819f2c6b2e5e0f03
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Jun 11 20:24:42 2021 -0500

    Compare and print test dimensions in points, not millimeters
    
    As much as I prefer the metric system, a PDF's MediaBox is in points,
    so this makes it easier to correlate with the actual file.
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/547>

 tests/src/predicates/pdf.rs | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/tests/src/predicates/pdf.rs b/tests/src/predicates/pdf.rs
index f19d845f..449992fb 100644
--- a/tests/src/predicates/pdf.rs
+++ b/tests/src/predicates/pdf.rs
@@ -93,25 +93,25 @@ impl Dimensions {
         })
     }
 
-    pub fn width_in_mm(self: &Self) -> f64 {
-        self.w * self.unit * 72.0 / 254.0
+    pub fn width_in_pt(self: &Self) -> f64 {
+        self.w * self.unit
     }
 
-    pub fn height_in_mm(self: &Self) -> f64 {
-        self.h * self.unit * 72.0 / 254.0
+    pub fn height_in_pt(self: &Self) -> f64 {
+        self.h * self.unit
     }
 }
 
 impl fmt::Display for Dimensions {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "{} mm x {} mm", self.width_in_mm(), self.height_in_mm())
+        write!(f, "{} pt x {} pt", self.width_in_pt(), self.height_in_pt())
     }
 }
 
 impl cmp::PartialEq for Dimensions {
     fn eq(&self, other: &Self) -> bool {
-        approx_eq!(f64, self.width_in_mm(), other.width_in_mm())
-            && approx_eq!(f64, self.height_in_mm(), other.height_in_mm())
+        approx_eq!(f64, self.width_in_pt(), other.width_in_pt())
+            && approx_eq!(f64, self.height_in_pt(), other.height_in_pt())
     }
 }
 


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