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