From e8577efb564946971538fed91ecb84549cb7be2c Mon Sep 17 00:00:00 2001 From: Ashwin Naren Date: Wed, 21 May 2025 14:18:15 -0700 Subject: [PATCH] add test Signed-off-by: Ashwin Naren --- tests/unit/script/htmlareaelement.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/unit/script/htmlareaelement.rs b/tests/unit/script/htmlareaelement.rs index be4cb12c0cc..faa33c25940 100644 --- a/tests/unit/script/htmlareaelement.rs +++ b/tests/unit/script/htmlareaelement.rs @@ -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))); }