[librsvg/rustification] marker.rs: In tests, factor out creation of helper cairo::Context



commit b52c851754f90176f5441b9277ba4e23b1597d74
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Oct 26 12:10:05 2016 -0500

    marker.rs: In tests, factor out creation of helper cairo::Context

 rust/src/marker.rs |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/rust/src/marker.rs b/rust/src/marker.rs
index 4b0f17a..d6a8ad8 100644
--- a/rust/src/marker.rs
+++ b/rust/src/marker.rs
@@ -209,10 +209,16 @@ mod tests {
     use super::*;
     extern crate cairo;
 
-    fn setup_open_path () -> cairo::Path {
+    fn create_cr () -> cairo::Context {
         let surf = cairo::ImageSurface::create (cairo::Format::Rgb24, 1, 1);
         let cr = cairo::Context::new (&surf);
 
+        cr
+    }
+
+    fn setup_open_path () -> 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);


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