[librsvg/rustification] marker.rs: Test for a closed subpath. We	found a bug!
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [librsvg/rustification] marker.rs: Test for a closed subpath. We	found a bug!
- Date: Thu, 27 Oct 2016 02:10:23 +0000 (UTC)
commit d25221549a39c7b8630a34e370318f54c4b86334
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Oct 26 18:46:18 2016 -0500
    marker.rs: Test for a closed subpath.  We found a bug!
 rust/src/marker.rs |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/rust/src/marker.rs b/rust/src/marker.rs
index aa03ed1..de4e3b3 100644
--- a/rust/src/marker.rs
+++ b/rust/src/marker.rs
@@ -268,4 +268,27 @@ mod tests {
 
         test_path_to_segments (setup_multiple_open_subpaths (), expected_segments);
     }
+
+    fn setup_closed_subpath () -> 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 ();
+
+        let path = cr.copy_path ();
+        path
+    }
+
+    #[test]
+    fn path_to_segments_handles_closed_subpath () {
+        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)
+        ];
+
+        test_path_to_segments (setup_closed_subpath (), expected_segments);
+    }
 }
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]