OLD | NEW |
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 "core/paint/PaintInfo.h" | 5 #include "core/paint/PaintInfo.h" |
6 | 6 |
7 #include "platform/graphics/paint/PaintController.h" | 7 #include "platform/graphics/paint/PaintController.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include <memory> | |
10 | 9 |
11 namespace blink { | 10 namespace blink { |
12 | 11 |
13 class PaintInfoTest : public testing::Test { | 12 class PaintInfoTest : public testing::Test { |
14 protected: | 13 protected: |
15 PaintInfoTest() | 14 PaintInfoTest() |
16 : m_paintController(PaintController::create()) | 15 : m_paintController(PaintController::create()) |
17 , m_context(*m_paintController) | 16 , m_context(*m_paintController) |
18 { } | 17 { } |
19 | 18 |
20 std::unique_ptr<PaintController> m_paintController; | 19 OwnPtr<PaintController> m_paintController; |
21 GraphicsContext m_context; | 20 GraphicsContext m_context; |
22 }; | 21 }; |
23 | 22 |
24 TEST_F(PaintInfoTest, intersectsCullRect) | 23 TEST_F(PaintInfoTest, intersectsCullRect) |
25 { | 24 { |
26 PaintInfo paintInfo(m_context, IntRect(0, 0, 50, 50), PaintPhaseSelfBlockBac
kgroundOnly, GlobalPaintNormalPhase, PaintLayerNoFlag); | 25 PaintInfo paintInfo(m_context, IntRect(0, 0, 50, 50), PaintPhaseSelfBlockBac
kgroundOnly, GlobalPaintNormalPhase, PaintLayerNoFlag); |
27 | 26 |
28 EXPECT_TRUE(paintInfo.cullRect().intersectsCullRect(IntRect(0, 0, 1, 1))); | 27 EXPECT_TRUE(paintInfo.cullRect().intersectsCullRect(IntRect(0, 0, 1, 1))); |
29 EXPECT_FALSE(paintInfo.cullRect().intersectsCullRect(IntRect(51, 51, 1, 1)))
; | 28 EXPECT_FALSE(paintInfo.cullRect().intersectsCullRect(IntRect(51, 51, 1, 1)))
; |
30 } | 29 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 67 |
69 TEST_F(PaintInfoTest, intersectsHorizontalRange) | 68 TEST_F(PaintInfoTest, intersectsHorizontalRange) |
70 { | 69 { |
71 PaintInfo paintInfo(m_context, IntRect(0, 0, 50, 100), PaintPhaseSelfBlockBa
ckgroundOnly, GlobalPaintNormalPhase, PaintLayerNoFlag); | 70 PaintInfo paintInfo(m_context, IntRect(0, 0, 50, 100), PaintPhaseSelfBlockBa
ckgroundOnly, GlobalPaintNormalPhase, PaintLayerNoFlag); |
72 | 71 |
73 EXPECT_TRUE(paintInfo.cullRect().intersectsHorizontalRange(LayoutUnit(), Lay
outUnit(1))); | 72 EXPECT_TRUE(paintInfo.cullRect().intersectsHorizontalRange(LayoutUnit(), Lay
outUnit(1))); |
74 EXPECT_FALSE(paintInfo.cullRect().intersectsHorizontalRange(LayoutUnit(50),
LayoutUnit(51))); | 73 EXPECT_FALSE(paintInfo.cullRect().intersectsHorizontalRange(LayoutUnit(50),
LayoutUnit(51))); |
75 } | 74 } |
76 | 75 |
77 } // namespace blink | 76 } // namespace blink |
OLD | NEW |