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

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

Issue 744163002: Enable fast/images with slimming paint (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix compile 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/paint/ClipRecorder.h"
7
8 #include "core/rendering/RenderView.h"
9 #include "core/rendering/RenderingTestHelper.h"
10 #include "core/rendering/compositing/RenderLayerCompositor.h"
11 #include "platform/graphics/GraphicsContext.h"
12 #include <gtest/gtest.h>
13
14 namespace blink {
15 namespace {
16
17 class ClipRecorderTest : public RenderingTest {
18 public:
19 ClipRecorderTest() : m_renderView(nullptr) { }
20
21 protected:
22 RenderView* renderView() { return m_renderView; }
23
24 private:
25 virtual void SetUp() override
26 {
27 RuntimeEnabledFeatures::setSlimmingPaintEnabled(true);
28
29 RenderingTest::SetUp();
30
31 m_renderView = document().view()->renderView();
32 ASSERT_TRUE(m_renderView);
33 }
34
35 RenderView* m_renderView;
36 };
37
38 void drawClip(GraphicsContext* context, RenderView* renderer, PaintPhase phase, const FloatRect& bound)
39 {
40 IntRect rect(1, 1, 9, 9);
41 ClipRect clipRect(rect);
42 ClipRecorder clipRecorder(renderer->compositor()->rootRenderLayer()->rendere r(), context, DisplayItem::ClipLayerForeground, clipRect, 0, LayoutPoint(), Pain tLayerFlags());
43 }
44
45 TEST_F(ClipRecorderTest, ClipRecorderTest_Single)
46 {
47 GraphicsContext* context = new GraphicsContext(nullptr);
48 FloatRect bound = renderView()->viewRect();
49 EXPECT_EQ((size_t)0, renderView()->viewDisplayList().paintList().size());
50
51 drawClip(context, renderView(), PaintPhaseForeground, bound);
52 EXPECT_EQ((size_t)2, renderView()->viewDisplayList().paintList().size());
53 }
54
55 }
56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698