[librsvg/rustification] path_parser.rs: test for relative moveto-lineto-moveto
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/rustification] path_parser.rs: test for relative moveto-lineto-moveto
- Date: Fri, 4 Nov 2016 20:40:07 +0000 (UTC)
commit 955ebac31d0562cc50960effe907c089dded1dba
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Nov 4 14:16:53 2016 -0600
path_parser.rs: test for relative moveto-lineto-moveto
This test fails, as the parser is not done yet.
rust/src/path_parser.rs | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/rust/src/path_parser.rs b/rust/src/path_parser.rs
index 7a78d85..1207795 100644
--- a/rust/src/path_parser.rs
+++ b/rust/src/path_parser.rs
@@ -350,7 +350,7 @@ impl<'external> PathParser<'external> {
fn moveto_drawto_command_group (&mut self, is_initial_moveto: bool) -> bool {
if self.moveto (is_initial_moveto) {
return self.optional_whitespace () &&
- true; // FIXME self.optional_drawto_commands ();
+ { println! ("w00p"); true }; // FIXME self.optional_drawto_commands ();
} else {
false
}
@@ -691,4 +691,32 @@ mod tests {
lineto (90.0, 120.0)
]);
}
+
+ #[test]
+ fn path_parser_handles_absolute_moveto_moveto () {
+ test_parser ("M10 20 M 30 40",
+ &vec![
+ moveto (10.0, 20.0),
+ moveto (30.0, 40.0)
+ ]);
+ }
+
+ #[test]
+ fn path_parser_handles_relative_moveto_moveto () {
+ test_parser ("m10 20 m 30 40",
+ &vec![
+ moveto (10.0, 20.0),
+ moveto (40.0, 60.0)
+ ]);
+ }
+
+ #[test]
+ fn path_parser_handles_relative_moveto_lineto_moveto () {
+ test_parser ("m10 20 30 40 m 50 60",
+ &vec![
+ moveto (10.0, 20.0),
+ lineto (40.0, 60.0),
+ moveto (80.0, 120.0)
+ ]);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]