Skip to content

Commit 1c4a931

Browse files
committed
add unit test for the previously failing case
1 parent 91dfbc8 commit 1c4a931

File tree

1 file changed

+17
-0
lines changed
  • plotters-backend/src/rasterizer

1 file changed

+17
-0
lines changed

plotters-backend/src/rasterizer/path.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,20 @@ pub fn polygonize(vertices: &[BackendCoord], stroke_width: u32) -> Vec<BackendCo
161161

162162
ret
163163
}
164+
165+
166+
#[cfg(test)]
167+
mod test
168+
{
169+
use super::*;
170+
/// Test for regression with respect to https://github.com/plotters-rs/plotters/issues/562
171+
#[test]
172+
fn test_no_inf_in_compute_polygon_vertex() {
173+
let path = [(335, 386), (338, 326), (340, 286)];
174+
let mut buf = Vec::new();
175+
compute_polygon_vertex(&path, 2.0, buf.as_mut());
176+
assert!(!buf.is_empty());
177+
let nani32 = f64::INFINITY as i32;
178+
assert!(!buf.iter().any(|&v| v.0 == nani32 || v.1 == nani32));
179+
}
180+
}

0 commit comments

Comments
 (0)