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 "platform/graphics/paint/CullRect.h" | 5 #include "platform/graphics/paint/CullRect.h" |
6 | 6 |
7 #include "platform/geometry/FloatRect.h" | 7 #include "platform/geometry/FloatRect.h" |
8 #include "platform/geometry/LayoutRect.h" | 8 #include "platform/geometry/LayoutRect.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class CullRectTest : public testing::Test { | 13 class CullRectTest : public ::testing::Test { |
14 protected: | 14 protected: |
15 IntRect Rect(const CullRect& cull_rect) { return cull_rect.rect_; } | 15 IntRect Rect(const CullRect& cull_rect) { return cull_rect.rect_; } |
16 }; | 16 }; |
17 | 17 |
18 TEST_F(CullRectTest, IntersectsCullRect) { | 18 TEST_F(CullRectTest, IntersectsCullRect) { |
19 CullRect cull_rect(IntRect(0, 0, 50, 50)); | 19 CullRect cull_rect(IntRect(0, 0, 50, 50)); |
20 | 20 |
21 EXPECT_TRUE(cull_rect.IntersectsCullRect(IntRect(0, 0, 1, 1))); | 21 EXPECT_TRUE(cull_rect.IntersectsCullRect(IntRect(0, 0, 1, 1))); |
22 EXPECT_FALSE(cull_rect.IntersectsCullRect(IntRect(51, 51, 1, 1))); | 22 EXPECT_FALSE(cull_rect.IntersectsCullRect(IntRect(51, 51, 1, 1))); |
23 } | 23 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 transform.Translate(10, 15); | 70 transform.Translate(10, 15); |
71 cull_rect.UpdateForScrollingContents(IntRect(20, 10, 40, 50), transform); | 71 cull_rect.UpdateForScrollingContents(IntRect(20, 10, 40, 50), transform); |
72 | 72 |
73 // Clipped: (20, 10, 30, 50) | 73 // Clipped: (20, 10, 30, 50) |
74 // Expanded: (-3980, -3990, 8030, 8050) | 74 // Expanded: (-3980, -3990, 8030, 8050) |
75 // Inverse transformed: (-3990, -4005, 8030, 8050) | 75 // Inverse transformed: (-3990, -4005, 8030, 8050) |
76 EXPECT_EQ(IntRect(-3990, -4005, 8030, 8050), Rect(cull_rect)); | 76 EXPECT_EQ(IntRect(-3990, -4005, 8030, 8050), Rect(cull_rect)); |
77 } | 77 } |
78 | 78 |
79 } // namespace blink | 79 } // namespace blink |
OLD | NEW |