diff --git a/engine/src/flutter/impeller/geometry/geometry_unittests.cc b/engine/src/flutter/impeller/geometry/geometry_unittests.cc index 13b45c613f..f9234ab506 100644 --- a/engine/src/flutter/impeller/geometry/geometry_unittests.cc +++ b/engine/src/flutter/impeller/geometry/geometry_unittests.cc @@ -904,6 +904,32 @@ TEST(GeometryTest, RectIntersection) { } } +TEST(GeometryTest, RectIntersectsWithRect) { + { + Rect a(100, 100, 100, 100); + Rect b(0, 0, 0, 0); + ASSERT_FALSE(a.IntersectsWithRect(b)); + } + + { + Rect a(100, 100, 100, 100); + Rect b(10, 10, 0, 0); + ASSERT_FALSE(a.IntersectsWithRect(b)); + } + + { + Rect a(0, 0, 100, 100); + Rect b(10, 10, 100, 100); + ASSERT_TRUE(a.IntersectsWithRect(b)); + } + + { + Rect a(0, 0, 100, 100); + Rect b(100, 100, 100, 100); + ASSERT_FALSE(a.IntersectsWithRect(b)); + } +} + TEST(GeometryTest, RectContainsPoint) { { // Origin is inclusive diff --git a/engine/src/flutter/impeller/geometry/rect.h b/engine/src/flutter/impeller/geometry/rect.h index ae2f89f905..524db20532 100644 --- a/engine/src/flutter/impeller/geometry/rect.h +++ b/engine/src/flutter/impeller/geometry/rect.h @@ -186,7 +186,7 @@ struct TRect { } constexpr bool IntersectsWithRect(const TRect& o) const { - return Interesection(o).has_value(); + return Intersection(o).has_value(); } };