[librsvg: 4/9] Add test for zero-length subpaths
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 4/9] Add test for zero-length subpaths
- Date: Sat, 29 May 2021 01:04:34 +0000 (UTC)
commit 6aceaec3bd773f32223107d2d4fdd04aca7eeae1
Author: Federico Mena Quintero <federico gnome org>
Date: Fri May 28 15:58:28 2021 -0500
Add test for zero-length subpaths
src/path_builder.rs | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
---
diff --git a/src/path_builder.rs b/src/path_builder.rs
index 71dba452..62d49dcf 100644
--- a/src/path_builder.rs
+++ b/src/path_builder.rs
@@ -857,4 +857,30 @@ mod tests {
]
);
}
+
+ #[test]
+ fn zero_length_subpaths() {
+ let mut builder = PathBuilder::default();
+ builder.move_to(42.0, 43.0);
+ builder.move_to(44.0, 45.0);
+ builder.close_path();
+ builder.move_to(46.0, 47.0);
+ builder.line_to(48.0, 49.0);
+
+ let path = builder.into_path();
+
+ let subpaths = path
+ .iter_subpath()
+ .map(|subpath| (subpath.is_zero_length(), subpath.origin()))
+ .collect::<Vec<(bool, (f64, f64))>>();
+
+ assert_eq!(
+ subpaths,
+ vec![
+ (true, (42.0, 43.0)),
+ (true, (44.0, 45.0)),
+ (false, (46.0, 47.0)),
+ ]
+ );
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]