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

Unified Diff: chrome/renderer/paint_aggregator_unittest.cc

Issue 5613002: Allow painting multiple paint rects.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years 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
Index: chrome/renderer/paint_aggregator_unittest.cc
===================================================================
--- chrome/renderer/paint_aggregator_unittest.cc (revision 68349)
+++ chrome/renderer/paint_aggregator_unittest.cc (working copy)
@@ -26,8 +26,8 @@
TEST(PaintAggregator, DoubleDisjointInvalidation) {
PaintAggregator greg;
- gfx::Rect r1(2, 4, 2, 4);
- gfx::Rect r2(4, 2, 4, 2);
+ gfx::Rect r1(2, 4, 2, 40);
+ gfx::Rect r2(4, 2, 40, 2);
greg.InvalidateRect(r1);
greg.InvalidateRect(r2);
@@ -36,11 +36,29 @@
EXPECT_TRUE(greg.HasPendingUpdate());
EXPECT_TRUE(greg.GetPendingUpdate().scroll_rect.IsEmpty());
- ASSERT_EQ(2U, greg.GetPendingUpdate().paint_rects.size());
+ EXPECT_EQ(2U, greg.GetPendingUpdate().paint_rects.size());
EXPECT_EQ(expected_bounds, greg.GetPendingUpdate().GetPaintBounds());
}
+TEST(PaintAggregator, DisjointInvalidationsCombined) {
+ PaintAggregator greg;
+
+ gfx::Rect r1(2, 4, 2, 2);
+ gfx::Rect r2(4, 2, 2, 2);
+
+ greg.InvalidateRect(r1);
+ greg.InvalidateRect(r2);
+
+ gfx::Rect expected_bounds = r1.Union(r2);
+
+ EXPECT_TRUE(greg.HasPendingUpdate());
+ EXPECT_TRUE(greg.GetPendingUpdate().scroll_rect.IsEmpty());
+ ASSERT_EQ(1U, greg.GetPendingUpdate().paint_rects.size());
+
+ EXPECT_EQ(expected_bounds, greg.GetPendingUpdate().paint_rects[0]);
+}
+
TEST(PaintAggregator, SingleScroll) {
PaintAggregator greg;

Powered by Google App Engine
This is Rietveld 408576698