[librsvg/rustification] marker.rs: Test for not having a moveto after a closepath



commit 971ee4110e625f49d5b7f2cfb1b8544fc84694c1
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Oct 26 20:40:13 2016 -0500

    marker.rs: Test for not having a moveto after a closepath

 rust/src/marker.rs |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/rust/src/marker.rs b/rust/src/marker.rs
index 3d8f80c..fdb6494 100644
--- a/rust/src/marker.rs
+++ b/rust/src/marker.rs
@@ -334,4 +334,31 @@ mod tests {
 
         test_path_to_segments (setup_multiple_closed_subpaths (), expected_segments);
     }
+
+    fn setup_no_moveto_after_closepath () -> cairo::Path {
+        let cr = create_cr ();
+
+        cr.move_to (10.0, 10.0);
+        cr.line_to (20.0, 10.0);
+        cr.line_to (20.0, 20.0);
+        cr.close_path ();
+
+        cr.line_to (40.0, 30.0);
+
+        let path = cr.copy_path ();
+        path
+    }
+
+    #[test]
+    fn path_to_segments_handles_no_moveto_after_closepath () {
+        let expected_segments: Vec<Segment> = vec![
+            line  (10.0, 10.0, 20.0, 10.0),
+            line  (20.0, 10.0, 20.0, 20.0),
+            line  (20.0, 20.0, 10.0, 10.0),
+
+            line  (10.0, 10.0, 40.0, 30.0)
+        ];
+
+        test_path_to_segments (setup_no_moveto_after_closepath (), expected_segments);
+    }
 }


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