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

Side by Side Diff: Source/core/paint/DrawingRecorderTest.cpp

Issue 794323004: Emit dummy display item when recorded picture is empty (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/paint/ViewDisplayListTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/RenderDrawingRecorder.h" 6 #include "core/paint/RenderDrawingRecorder.h"
7 7
8 #include "core/rendering/RenderLayer.h" 8 #include "core/rendering/RenderLayer.h"
9 #include "core/rendering/RenderView.h" 9 #include "core/rendering/RenderView.h"
10 #include "core/rendering/RenderingTestHelper.h" 10 #include "core/rendering/RenderingTestHelper.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 55
56 56
57 TEST_F(DrawingRecorderTest, DrawingRecorderTest_Nothing) 57 TEST_F(DrawingRecorderTest, DrawingRecorderTest_Nothing)
58 { 58 {
59 GraphicsContext context(nullptr, &rootDisplayItemList()); 59 GraphicsContext context(nullptr, &rootDisplayItemList());
60 FloatRect bound = renderView()->viewRect(); 60 FloatRect bound = renderView()->viewRect();
61 EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size()); 61 EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size());
62 62
63 drawNothing(&context, renderView(), PaintPhaseForeground, bound); 63 drawNothing(&context, renderView(), PaintPhaseForeground, bound);
64 EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size()); 64 EXPECT_EQ((size_t)1, rootDisplayItemList().paintList().size());
65 #ifndef NDEBUG
66 EXPECT_STREQ("Dummy", rootDisplayItemList().paintList()[0]->name());
67 #endif
65 } 68 }
66 69
67 TEST_F(DrawingRecorderTest, DrawingRecorderTest_Rect) 70 TEST_F(DrawingRecorderTest, DrawingRecorderTest_Rect)
68 { 71 {
69 GraphicsContext context(nullptr, &rootDisplayItemList()); 72 GraphicsContext context(nullptr, &rootDisplayItemList());
70 FloatRect bound = renderView()->viewRect(); 73 FloatRect bound = renderView()->viewRect();
71 drawRect(&context, renderView(), PaintPhaseForeground, bound); 74 drawRect(&context, renderView(), PaintPhaseForeground, bound);
72 EXPECT_EQ((size_t)1, rootDisplayItemList().paintList().size()); 75 EXPECT_EQ((size_t)1, rootDisplayItemList().paintList().size());
76 #ifndef NDEBUG
77 EXPECT_STREQ("Drawing", rootDisplayItemList().paintList()[0]->name());
78 #endif
79 }
80
81 TEST_F(DrawingRecorderTest, DrawingRecorderTest_Cached)
82 {
83 GraphicsContext context(nullptr, &rootDisplayItemList());
84 FloatRect bound = renderView()->viewRect();
85 drawNothing(&context, renderView(), PaintPhaseBlockBackground, bound);
86 drawRect(&context, renderView(), PaintPhaseForeground, bound);
87 EXPECT_EQ((size_t)2, rootDisplayItemList().paintList().size());
88 #ifndef NDEBUG
89 EXPECT_STREQ("Dummy", rootDisplayItemList().paintList()[0]->name());
90 EXPECT_STREQ("Drawing", rootDisplayItemList().paintList()[1]->name());
91 #endif
92
93 drawNothing(&context, renderView(), PaintPhaseBlockBackground, bound);
94 drawRect(&context, renderView(), PaintPhaseForeground, bound);
95 EXPECT_EQ((size_t)2, rootDisplayItemList().paintList().size());
96 #ifndef NDEBUG
97 EXPECT_STREQ("Dummy", rootDisplayItemList().paintList()[0]->name());
98 EXPECT_STREQ("Drawing", rootDisplayItemList().paintList()[1]->name());
99 #endif
73 } 100 }
74 101
75 } 102 }
76 } 103 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/paint/ViewDisplayListTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698