[librsvg: 3/8] Test for 100% width and height




commit 3ce1b78c5d2941b43870132dcc359a2a1d448ec9
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Sep 30 17:13:26 2021 -0500

    Test for 100% width and height
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/595>

 tests/src/legacy_sizing.rs | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
---
diff --git a/tests/src/legacy_sizing.rs b/tests/src/legacy_sizing.rs
index 1e0cac9a..02588496 100644
--- a/tests/src/legacy_sizing.rs
+++ b/tests/src/legacy_sizing.rs
@@ -57,3 +57,29 @@ fn no_intrinsic_size_uses_element_geometries() {
          })
     );
 }
+
+#[test]
+fn hundred_percent_width_height_uses_viewbox() {
+    let svg = load_svg(
+        br#"<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg"; width="100%" height="100%" viewBox="0 0 100 200"/>
+"#,
+    )
+        .unwrap();
+
+    assert_eq!(
+        CairoRenderer::new(&svg).legacy_layer_geometry(None).unwrap(),
+        (cairo::Rectangle {
+            x: 0.0,
+            y: 0.0,
+            width: 100.0,
+            height: 200.0,
+        },
+         cairo::Rectangle {
+             x: 0.0,
+             y: 0.0,
+             width: 100.0,
+             height: 200.0,
+         })
+    );
+}


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