Skip to content

Commit 08d105d

Browse files
committed
Update unit test.
1 parent 54da537 commit 08d105d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

plotters/src/element/basic_shapes.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ impl<I0: Iterator + Clone, Size: SizeDesc, DB: DrawingBackend> Drawable<DB>
192192
for curr in points {
193193
let curr_f = to_f(curr);
194194
let (dx, dy) = (curr_f.0 - start.0, curr_f.1 - start.1);
195-
let mut d = dx.hypot(dy);
195+
let mut d = dx.hypot(dy).max(f32::EPSILON);
196196
let scale = size / d;
197197
let gap_scale = spacing / d;
198198
while d >= size {
@@ -218,10 +218,10 @@ impl<I0: Iterator + Clone, Size: SizeDesc, DB: DrawingBackend> Drawable<DB>
218218
fn test_dashed_path_element() {
219219
use crate::prelude::*;
220220
let check_list = std::cell::RefCell::new(vec![
221-
[(100, 100), (100, 105)],
222-
[(100, 107), (100, 112)],
223-
[(100, 114), (100, 119)],
224-
[(100, 121), (100, 126)],
221+
[(100, 100), (100, 103)],
222+
[(100, 103), (100, 108)],
223+
[(100, 110), (100, 115)],
224+
[(100, 117), (100, 120)],
225225
]);
226226
let da = crate::create_mocked_drawing_area(300, 300, |m| {
227227
m.check_draw_path(move |c, s, path| {

plotters/src/series/line_series.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ mod test {
144144
});
145145

146146
m.drop_check(|b| {
147-
assert_eq!(b.num_draw_path_call, 11);
148-
assert_eq!(b.draw_count, 11);
147+
assert_eq!(b.num_draw_path_call, 51);
148+
assert_eq!(b.draw_count, 51);
149149
});
150150
});
151151

@@ -161,7 +161,7 @@ mod test {
161161
.expect("Drawing Error");
162162
chart
163163
.draw_series(DashedLineSeries::new(
164-
(0..=50).map(|x| (x, x)),
164+
(0..=50).map(|x| (0, x)),
165165
10,
166166
5,
167167
RED.stroke_width(3),

0 commit comments

Comments
 (0)