[librsvg/librsvg-2.50] Add test with no intrinsic dimensions
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.50] Add test with no intrinsic dimensions
- Date: Fri, 2 Oct 2020 19:24:37 +0000 (UTC)
commit 47ccb40964642881ae469b12bea07ad4e500f0b4
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Sep 29 16:16:58 2020 -0500
Add test with no intrinsic dimensions
librsvg_crate/tests/intrinsic_dimensions.rs | 34 +++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
---
diff --git a/librsvg_crate/tests/intrinsic_dimensions.rs b/librsvg_crate/tests/intrinsic_dimensions.rs
index 8307361f..ff0363ea 100644
--- a/librsvg_crate/tests/intrinsic_dimensions.rs
+++ b/librsvg_crate/tests/intrinsic_dimensions.rs
@@ -174,6 +174,40 @@ fn layer_geometry_with_no_width_height() {
assert_eq!((ink_r, logical_r), (rect, rect));
}
+#[test]
+fn layer_geometry_with_no_intrinsic_dimensions() {
+ let svg = load_svg(
+ br#"<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg">
+ <rect x="110" y="120" width="50" 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();
+
+ // The SVG document above has no width/height nor viewBox, which means it should
+ // start with an identity transform for its coordinate space. Since the viewport
+ // is just offset by (100, 100), this just translates the coordinates of the <rect>.
+ let rect = cairo::Rectangle {
+ x: 210.0,
+ y: 220.0,
+ width: 50.0,
+ height: 40.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]