[librsvg: 22/28] path_parser: Test smooth curveto args



commit 121b069c7491e618c05cf576b2009284906ab40f
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Jan 23 10:52:15 2018 -0600

    path_parser: Test smooth curveto args

 rust/src/path_parser.rs | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
---
diff --git a/rust/src/path_parser.rs b/rust/src/path_parser.rs
index c2fc619..966acd5 100644
--- a/rust/src/path_parser.rs
+++ b/rust/src/path_parser.rs
@@ -1771,4 +1771,44 @@ mod tests {
                           curveto(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)],
                     Some(ErrorKind::UnexpectedEof));
     }
+
+    #[test]
+    fn smooth_curveto_args() {
+        test_parser("M10-20S1",
+                    "        ^",
+                    &vec![moveto(10.0, -20.0)],
+                    Some(ErrorKind::UnexpectedEof));
+        test_parser("M10-20S1,",
+                    "         ^",
+                    &vec![moveto(10.0, -20.0)],
+                    Some(ErrorKind::UnexpectedEof));
+
+        test_parser("M10-20S1 2",
+                    "          ^",
+                    &vec![moveto(10.0, -20.0)],
+                    Some(ErrorKind::UnexpectedEof));
+        test_parser("M10-20S1,2,",
+                    "           ^",
+                    &vec![moveto(10.0, -20.0)],
+                    Some(ErrorKind::UnexpectedEof));
+
+        test_parser("M10-20S1 2 3",
+                    "            ^",
+                    &vec![moveto(10.0, -20.0)],
+                    Some(ErrorKind::UnexpectedEof));
+        test_parser("M10-20S1,2,3",
+                    "            ^",
+                    &vec![moveto(10.0, -20.0)],
+                    Some(ErrorKind::UnexpectedEof));
+        test_parser("M10-20S1,2,3,",
+                    "             ^",
+                    &vec![moveto(10.0, -20.0)],
+                    Some(ErrorKind::UnexpectedEof));
+
+        test_parser("M10-20S1,2,3,4,",
+                    "               ^",
+                    &vec![moveto(10.0, -20.0),
+                          curveto(10.0, -20.0, 1.0, 2.0, 3.0, 4.0)],
+                    Some(ErrorKind::UnexpectedEof));
+    }
 }


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