[librsvg/librsvg-2.44] gradient: add a test for fix_focus_point



commit 61012d2a0415ceac1f6fd196d178b01d8349eac1
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Sep 8 18:39:24 2018 +0200

    gradient: add a test for fix_focus_point

 rsvg_internals/src/gradient.rs | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/rsvg_internals/src/gradient.rs b/rsvg_internals/src/gradient.rs
index 904f7259..ac1e3738 100644
--- a/rsvg_internals/src/gradient.rs
+++ b/rsvg_internals/src/gradient.rs
@@ -723,6 +723,18 @@ mod tests {
         assert!(SpreadMethod::parse_str("foobar", ()).is_err());
     }
 
+    #[test]
+    fn fixes_focus_point() {
+        // inside the circle
+        assert_eq!(fix_focus_point(1.0, 1.0, 2.0, 1.0, 3.0), (1.0, 1.0));
+
+        // on the edge
+        assert_eq!(fix_focus_point(1.0, 1.0, 2.0, 1.0, 2.0), (1.0, 1.0));
+
+        // outside the circle
+        assert_eq!(fix_focus_point(1.0, 1.0, 3.0, 1.0, 1.0), (2.0, 1.0));
+    }
+
     #[test]
     fn gradient_resolved_from_defaults_is_really_resolved() {
         let mut gradient = Gradient {


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