[librsvg: 3/4] tests: test the rsvg-convert --keep-aspect-ratio option



commit 5c0e4d25de24c68480c7663e4aff6e470101f2fd
Author: Sven Neumann <sven svenfoo org>
Date:   Mon Feb 24 11:42:46 2020 +0100

    tests: test the rsvg-convert --keep-aspect-ratio option
    
    Extend the tests to actually test the behavior.

 tests/src/cmdline/rsvg_convert.rs | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/tests/src/cmdline/rsvg_convert.rs b/tests/src/cmdline/rsvg_convert.rs
index 2ce4a187..9e4c575f 100644
--- a/tests/src/cmdline/rsvg_convert.rs
+++ b/tests/src/cmdline/rsvg_convert.rs
@@ -643,12 +643,38 @@ fn unlimited_short_option() {
 
 #[test]
 fn keep_aspect_ratio_option() {
-    RsvgConvert::accepts_option("--keep-aspect-ratio");
+    let input = Path::new("fixtures/api/dpi.svg");
+    RsvgConvert::new_with_input(input)
+        .arg("--width=500")
+        .arg("--height=1000")
+        .assert()
+        .success()
+        .stdout(file::is_png().with_size(500, 1000));
+    RsvgConvert::new_with_input(input)
+        .arg("--width=500")
+        .arg("--height=1000")
+        .arg("--keep-aspect-ratio")
+        .assert()
+        .success()
+        .stdout(file::is_png().with_size(500, 2000));
 }
 
 #[test]
 fn keep_aspect_ratio_short_option() {
-    RsvgConvert::accepts_option("-a");
+    let input = Path::new("fixtures/api/dpi.svg");
+    RsvgConvert::new_with_input(input)
+        .arg("--width=1000")
+        .arg("--height=500")
+        .assert()
+        .success()
+        .stdout(file::is_png().with_size(1000, 500));
+    RsvgConvert::new_with_input(input)
+        .arg("--width=1000")
+        .arg("--height=500")
+        .arg("-a")
+        .assert()
+        .success()
+        .stdout(file::is_png().with_size(125, 500));
 }
 
 #[test]


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