Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(932)

Unified Diff: third_party/WebKit/Source/platform/geometry/LayoutRectTest.cpp

Issue 1817693002: Support edge-inclusive intersections in mapToVisibleRectInAncestorSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src@intersection-observer-idle-callback
Patch Set: more tests Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/geometry/LayoutRect.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/geometry/LayoutRectTest.cpp
diff --git a/third_party/WebKit/Source/platform/geometry/LayoutRectTest.cpp b/third_party/WebKit/Source/platform/geometry/LayoutRectTest.cpp
index 305810f40ba3e8ef38b86423fad3d5fd6798f9f8..0b98a55d3e3eaee4ccf4749361c2c0e272586c67 100644
--- a/third_party/WebKit/Source/platform/geometry/LayoutRectTest.cpp
+++ b/third_party/WebKit/Source/platform/geometry/LayoutRectTest.cpp
@@ -21,6 +21,25 @@ TEST(LayoutRectTest, ToString)
LayoutRect granularRect(LayoutUnit(1.6f), LayoutUnit(2.7f), LayoutUnit(3.8f), LayoutUnit(4.9f));
EXPECT_EQ(String("1.593750,2.687500 3.796875x4.890625"), granularRect.toString());
}
+
+TEST(LayoutRectTest, InclusiveIntersect)
+{
+ LayoutRect rect(11, 12, 0, 0);
+ EXPECT_TRUE(rect.inclusiveIntersect(LayoutRect(11, 12, 13, 14)));
+ EXPECT_EQ(rect, LayoutRect(11, 12, 0, 0));
+
+ rect = LayoutRect(11, 12, 13, 14);
+ EXPECT_TRUE(rect.inclusiveIntersect(LayoutRect(24, 8, 0, 7)));
+ EXPECT_EQ(rect, LayoutRect(24, 12, 0, 3));
+
+ rect = LayoutRect(11, 12, 13, 14);
+ EXPECT_TRUE(rect.inclusiveIntersect(LayoutRect(9, 15, 4, 0)));
+ EXPECT_EQ(rect, LayoutRect(11, 15, 2, 0));
+
+ rect = LayoutRect(11, 12, 0, 14);
+ EXPECT_FALSE(rect.inclusiveIntersect(LayoutRect(12, 13, 15, 16)));
+ EXPECT_EQ(rect, LayoutRect());
+}
#endif
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/geometry/LayoutRect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698