mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
add test
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This commit is contained in:
parent
4fd818d46d
commit
e8577efb56
1 changed files with 9 additions and 0 deletions
|
@ -187,4 +187,13 @@ fn test_hit_test_polygon() {
|
|||
points: vec![7.0, 7.5, 8.2, 9.0, 11.0, 12.0],
|
||||
};
|
||||
assert!(!poly2.hit_test(&Point2D::new(10.0, 5.0)));
|
||||
let poly3 = Area::Polygon {
|
||||
points: vec![0.0, 0.0, 5.0, 0.0, 5.0, 5.0, 0.0, 5.0],
|
||||
};
|
||||
assert!(poly3.hit_test(&Point2D::new(1.0, 1.0)));
|
||||
assert!(poly3.hit_test(&Point2D::new(2.0, 4.0)));
|
||||
assert!(poly3.hit_test(&Point2D::new(4.0, 2.0)));
|
||||
assert!(!poly3.hit_test(&Point2D::new(6.0, 0.0)));
|
||||
assert!(!poly3.hit_test(&Point2D::new(0.0, 6.0)));
|
||||
assert!(!poly3.hit_test(&Point2D::new(6.0, 6.0)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue