[librsvg/librsvg-2.44] Length: Basic tests for FontEm / FontEx normalization
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.44] Length: Basic tests for FontEm / FontEx normalization
- Date: Fri, 21 Sep 2018 17:38:06 +0000 (UTC)
commit 2b1e4496fa25508a92337771fcd864133c285ebf
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Sep 3 15:09:03 2018 -0500
Length: Basic tests for FontEm / FontEx normalization
rsvg_internals/src/length.rs | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
---
diff --git a/rsvg_internals/src/length.rs b/rsvg_internals/src/length.rs
index 37dfdd02..b1bf6723 100644
--- a/rsvg_internals/src/length.rs
+++ b/rsvg_internals/src/length.rs
@@ -466,6 +466,31 @@ mod tests {
);
}
+ #[test]
+ fn normalize_font_em_ex_works() {
+ let params = ViewParams {
+ dpi_x: 40.0,
+ dpi_y: 40.0,
+ view_box_width: 100.0,
+ view_box_height: 200.0,
+ };
+
+ let values = ComputedValues::default();
+
+ // These correspond to the default size for the font-size
+ // property and the way we compute FontEx from that.
+
+ assert_approx_eq_cairo!(
+ Length::new(1.0, LengthUnit::FontEm, LengthDir::Vertical).normalize(&values, ¶ms),
+ 12.0
+ );
+
+ assert_approx_eq_cairo!(
+ Length::new(1.0, LengthUnit::FontEx, LengthDir::Vertical).normalize(&values, ¶ms),
+ 6.0
+ );
+ }
+
fn parse_dash_array_str(s: &str) -> Result<Dasharray, ValueErrorKind> {
Dasharray::parse_str(s, ())
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]