[librsvg] Add test for computing the root element's dimensions
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Add test for computing the root element's dimensions
- Date: Tue, 19 Feb 2019 19:54:24 +0000 (UTC)
commit bfe13915eb7f6ef2ab84099bd43f4d695eb84cca
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Feb 19 09:34:02 2019 -0600
Add test for computing the root element's dimensions
librsvg_crate/tests/intrinsic-dimensions.rs | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
---
diff --git a/librsvg_crate/tests/intrinsic-dimensions.rs b/librsvg_crate/tests/intrinsic-dimensions.rs
index e109db4f..fabaaa77 100644
--- a/librsvg_crate/tests/intrinsic-dimensions.rs
+++ b/librsvg_crate/tests/intrinsic-dimensions.rs
@@ -57,3 +57,26 @@ fn has_intrinsic_dimensions() {
}
);
}
+
+#[test]
+fn root_geometry_with_percent_viewport() {
+ let svg = load_svg(
+ br#"<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
+ <rect x="10" y="20" width="30" height="40"/>
+</svg>
+"#,
+ );
+
+ let renderer = svg.get_cairo_renderer();
+ let (ink_r, logical_r) = renderer.get_geometry_for_element(None).unwrap();
+
+ let rect = cairo::Rectangle {
+ x: 10.0,
+ y: 20.0,
+ width: 30.0,
+ height: 40.0,
+ };
+
+ assert_eq!((ink_r, logical_r), (rect, rect));
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]