[librsvg/librsvg-2.50] Add test with no width/height
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.50] Add test with no width/height
- Date: Fri, 2 Oct 2020 19:24:37 +0000 (UTC)
commit 05df1d091f68d6097dfd6955feac266a34698b93
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Sep 29 16:08:29 2020 -0500
Add test with no width/height
librsvg_crate/tests/intrinsic_dimensions.rs | 31 +++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
---
diff --git a/librsvg_crate/tests/intrinsic_dimensions.rs b/librsvg_crate/tests/intrinsic_dimensions.rs
index 10859c43..8307361f 100644
--- a/librsvg_crate/tests/intrinsic_dimensions.rs
+++ b/librsvg_crate/tests/intrinsic_dimensions.rs
@@ -143,6 +143,37 @@ fn layer_geometry_with_viewbox_and_offset_viewport() {
assert_eq!((ink_r, logical_r), (rect, rect));
}
+#[test]
+fn layer_geometry_with_no_width_height() {
+ let svg = load_svg(
+ br#"<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="100 100 200 200">
+ <rect x="110" y="120" width="30" height="40"/>
+</svg>
+"#,
+ );
+
+ let renderer = CairoRenderer::new(&svg);
+
+ let viewport = cairo::Rectangle {
+ x: 100.0,
+ y: 100.0,
+ width: 100.0,
+ height: 100.0,
+ };
+
+ let (ink_r, logical_r) = renderer.geometry_for_layer(None, &viewport).unwrap();
+
+ let rect = cairo::Rectangle {
+ x: 105.0,
+ y: 110.0,
+ width: 15.0,
+ height: 20.0,
+ };
+
+ assert_eq!((ink_r, logical_r), (rect, rect));
+}
+
#[test]
fn layer_geometry_with_percent_viewport() {
let svg = load_svg(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]