[librsvg/librsvg-2.50] Add test with a viewBox
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.50] Add test with a viewBox
- Date: Fri, 2 Oct 2020 19:24:37 +0000 (UTC)
commit 2207ed4537c657e8a2b21fe8ad3e47fc48588ff7
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Sep 29 16:06:10 2020 -0500
Add test with a viewBox
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 db06cd3c..10859c43 100644
--- a/librsvg_crate/tests/intrinsic_dimensions.rs
+++ b/librsvg_crate/tests/intrinsic_dimensions.rs
@@ -112,6 +112,37 @@ fn layer_geometry_with_offset_viewport() {
assert_eq!((ink_r, logical_r), (rect, rect));
}
+#[test]
+fn layer_geometry_with_viewbox_and_offset_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" viewBox="100 100 100 100">
+ <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: 110.0,
+ y: 120.0,
+ width: 30.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]