[librsvg/rustification] path_parser.rs: Tests for various representations of numbers



commit 21a00eae92018b900e810daabc3f6844fef09a3d
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Nov 4 14:06:36 2016 -0600

    path_parser.rs: Tests for various representations of numbers
    
    SVG allows optional punctuation and spaces between numbers, which makes
    things hard.

 rust/src/path_parser.rs |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/rust/src/path_parser.rs b/rust/src/path_parser.rs
index 226b32c..4c259cc 100644
--- a/rust/src/path_parser.rs
+++ b/rust/src/path_parser.rs
@@ -487,10 +487,50 @@ mod tests {
                          moveto (10.0, 20.0)
                      ]);
 
+        test_parser ("M -10 -20",
+                     &vec![
+                         moveto (-10.0, -20.0)
+                     ]);
+
         test_parser ("M .10 0.20",
                      &vec![
                          moveto (0.10, 0.20)
                      ]);
+
+        test_parser ("M -.10 -0.20",
+                     &vec![
+                         moveto (-0.10, -0.20)
+                     ]);
+
+        test_parser ("M-.10-0.20",
+                     &vec![
+                         moveto (-0.10, -0.20)
+                     ]);
+
+        test_parser ("M.10.20",
+                     &vec![
+                         moveto (0.10, 0.20)
+                     ]);
+
+        test_parser ("M .10E1 .20e-4",
+                     &vec![
+                         moveto (1.0, 0.000020)
+                     ]);
+
+        test_parser ("M-.10E1-.20",
+                     &vec![
+                         moveto (-1.0, -0.20)
+                     ]);
+
+        test_parser ("M10.10E2 -0.20e3",
+                     &vec![
+                         moveto (1010.0, -200.0)
+                     ]);
+
+        test_parser ("M-10.10E2-0.20e-3",
+                     &vec![
+                         moveto (-1010.0, -0.00020)
+                     ]);
     }
 
     #[test]


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