Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions iOverlay/src/string/clip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ impl IntClip for [IntPoint] {
#[cfg(test)]
mod tests {
use alloc::vec;
use i_float::int::point::IntPoint;
use i_float::int::point::IntPoint;
use i_shape::int::path::IntPath;
use crate::core::fill_rule::FillRule;
use crate::string::clip::{ClipRule, IntClip};
Expand Down Expand Up @@ -344,11 +344,11 @@ use i_float::int::point::IntPoint;
];

let result_0 = rect.clip_path(&path, FillRule::NonZero,
ClipRule { invert: false, boundary_included: false },
ClipRule { invert: false, boundary_included: false },
);

let result_1 = rect.clip_path(&path, FillRule::NonZero,
ClipRule { invert: false, boundary_included: true },
ClipRule { invert: false, boundary_included: true },
);

assert_eq!(result_0.len(), 3);
Expand Down
169 changes: 0 additions & 169 deletions iOverlay/src/string/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ mod tests {
use crate::core::fill_rule::FillRule;
use crate::string::overlay::StringOverlay;
use crate::string::rule::StringRule;
use crate::string::slice::IntSlice;
use alloc::vec;
use i_float::int::point::IntPoint;

Expand All @@ -238,56 +237,6 @@ mod tests {
IntPoint::new(10, 10),
]];

let result = paths.slice_by_line(
[IntPoint::new(-20, 0), IntPoint::new(20, 0)],
FillRule::NonZero,
);

assert_eq!(result.len(), 2);
assert_eq!(result[0].len(), 1);
assert_eq!(result[0][0].len(), 4);
assert_eq!(result[1].len(), 1);
assert_eq!(result[1][0].len(), 4);
}

#[test]
fn test_1() {
let paths = vec![
vec![
IntPoint::new(-10, 10),
IntPoint::new(-10, -10),
IntPoint::new(10, -10),
IntPoint::new(10, 10),
],
vec![
IntPoint::new(-5, -5),
IntPoint::new(-5, 5),
IntPoint::new(5, 5),
IntPoint::new(5, -5),
],
];

let result = paths.slice_by_line(
[IntPoint::new(-20, 0), IntPoint::new(20, 0)],
FillRule::NonZero,
);

assert_eq!(result.len(), 2);
assert_eq!(result[0].len(), 1);
assert_eq!(result[0][0].len(), 8);
assert_eq!(result[1].len(), 1);
assert_eq!(result[1][0].len(), 8);
}

#[test]
fn test_2() {
let paths = vec![vec![
IntPoint::new(-10, 10),
IntPoint::new(-10, -10),
IntPoint::new(10, -10),
IntPoint::new(10, 10),
]];

let window = vec![
IntPoint::new(-5, -5),
IntPoint::new(-5, 5),
Expand All @@ -303,122 +252,4 @@ mod tests {

assert_eq!(r.len(), 2);
}

#[test]
fn test_3() {
let paths = vec![
vec![
IntPoint::new(0, 0),
IntPoint::new(35, 0),
IntPoint::new(35, 20),
IntPoint::new(0, 20),
],
vec![
IntPoint::new(5, 5),
IntPoint::new(5, 15),
IntPoint::new(15, 15),
IntPoint::new(15, 5),
],
vec![
IntPoint::new(20, 5),
IntPoint::new(20, 15),
IntPoint::new(30, 15),
IntPoint::new(30, 5),
],
];

let result = paths.slice_by_line(
[IntPoint::new(15, 10), IntPoint::new(20, 10)],
FillRule::NonZero,
);

assert_eq!(result.len(), 1);
assert_eq!(result[0].len(), 3);
}

#[test]
fn test_4() {
let paths = vec![
vec![
IntPoint::new(0, 0),
IntPoint::new(35, 0),
IntPoint::new(35, 20),
IntPoint::new(0, 20),
],
vec![
IntPoint::new(5, 5),
IntPoint::new(5, 15),
IntPoint::new(15, 15),
IntPoint::new(15, 5),
],
vec![
IntPoint::new(20, 5),
IntPoint::new(20, 15),
IntPoint::new(30, 15),
IntPoint::new(30, 5),
],
];

let result = paths.slice_by_lines(
&vec![
[IntPoint::new(15, 5), IntPoint::new(20, 5)],
[IntPoint::new(15, 15), IntPoint::new(20, 15)],
],
FillRule::NonZero,
);

assert_eq!(result.len(), 2);
assert_eq!(result[0].len(), 2);
assert_eq!(result[1].len(), 1);
}

#[test]
fn test_5() {
let paths = vec![
vec![
IntPoint::new(0, 0),
IntPoint::new(35, 0),
IntPoint::new(35, 35),
IntPoint::new(0, 35),
],
vec![
IntPoint::new(5, 5),
IntPoint::new(5, 15),
IntPoint::new(15, 15),
IntPoint::new(15, 5),
],
vec![
IntPoint::new(20, 5),
IntPoint::new(20, 15),
IntPoint::new(30, 15),
IntPoint::new(30, 5),
],
vec![
IntPoint::new(5, 20),
IntPoint::new(5, 30),
IntPoint::new(15, 30),
IntPoint::new(15, 20),
],
vec![
IntPoint::new(20, 20),
IntPoint::new(20, 30),
IntPoint::new(30, 30),
IntPoint::new(30, 20),
],
];

let result = paths.slice_by_lines(
&vec![
[IntPoint::new(10, 15), IntPoint::new(10, 20)],
[IntPoint::new(25, 15), IntPoint::new(25, 20)],
[IntPoint::new(15, 10), IntPoint::new(20, 10)],
[IntPoint::new(15, 25), IntPoint::new(20, 25)],
],
FillRule::NonZero,
);

assert_eq!(result.len(), 2);
assert_eq!(result[0].len(), 2);
assert_eq!(result[1].len(), 1);
}
}
Loading