[librsvg: 4/17] Tests for fitting to width and height
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 4/17] Tests for fitting to width and height
- Date: Thu, 24 Feb 2022 03:22:56 +0000 (UTC)
commit bd3001f947e0878c2db21403320d473028bbda68
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Feb 21 12:39:31 2022 -0600
Tests for fitting to width and height
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/669>
src/bin/rsvg-convert.rs | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
---
diff --git a/src/bin/rsvg-convert.rs b/src/bin/rsvg-convert.rs
index 219daab32..2610e9ddc 100644
--- a/src/bin/rsvg-convert.rs
+++ b/src/bin/rsvg-convert.rs
@@ -1206,4 +1206,24 @@ mod sizing_tests {
Size::new(25.0, 50.0),
);
}
+
+ #[test]
+ fn fit_width() {
+ let strategy = ResizeStrategy::FitWidth(100.0);
+
+ assert_eq!(
+ strategy.apply(&Size::new(1.0, 2.0), false).unwrap(),
+ Size::new(100.0, 200.0),
+ );
+ }
+
+ #[test]
+ fn fit_height() {
+ let strategy = ResizeStrategy::FitHeight(100.0);
+
+ assert_eq!(
+ strategy.apply(&Size::new(1.0, 2.0), false).unwrap(),
+ Size::new(50.0, 100.0),
+ );
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]