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 "cc/layers/painted_scrollbar_layer_impl.h" | 5 #include "cc/layers/painted_scrollbar_layer_impl.h" |
6 | 6 |
7 #include "cc/test/layer_test_common.h" | 7 #include "cc/test/layer_test_common.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 gfx::Rect thumb_rect = scrollbar_layer_impl->ComputeThumbQuadRect(); | 51 gfx::Rect thumb_rect = scrollbar_layer_impl->ComputeThumbQuadRect(); |
52 EXPECT_EQ(gfx::Rect(0, 500 / 4, 10, layer_size.height() / 2).ToString(), | 52 EXPECT_EQ(gfx::Rect(0, 500 / 4, 10, layer_size.height() / 2).ToString(), |
53 thumb_rect.ToString()); | 53 thumb_rect.ToString()); |
54 | 54 |
55 { | 55 { |
56 SCOPED_TRACE("No occlusion"); | 56 SCOPED_TRACE("No occlusion"); |
57 gfx::Rect occluded; | 57 gfx::Rect occluded; |
58 impl.AppendQuadsWithOcclusion(scrollbar_layer_impl, occluded); | 58 impl.AppendQuadsWithOcclusion(scrollbar_layer_impl, occluded); |
59 | 59 |
60 size_t partially_occluded_count = 0; | 60 size_t partially_occluded_count = 0; |
61 LayerTestCommon::VerifyQuadsCoverRectWithOcclusion( | 61 LayerTestCommon::VerifyQuadsAreOccluded( |
62 impl.quad_list(), | 62 impl.quad_list(), occluded, &partially_occluded_count); |
63 gfx::Rect(layer_size), | |
64 occluded, | |
65 &partially_occluded_count); | |
66 EXPECT_EQ(2u, impl.quad_list().size()); | 63 EXPECT_EQ(2u, impl.quad_list().size()); |
67 EXPECT_EQ(0u, partially_occluded_count); | 64 EXPECT_EQ(0u, partially_occluded_count); |
68 } | 65 } |
69 | 66 |
70 { | 67 { |
71 SCOPED_TRACE("Full occlusion"); | 68 SCOPED_TRACE("Full occlusion"); |
72 gfx::Rect occluded(scrollbar_layer_impl->visible_content_rect()); | 69 gfx::Rect occluded(scrollbar_layer_impl->visible_content_rect()); |
73 impl.AppendQuadsWithOcclusion(scrollbar_layer_impl, occluded); | 70 impl.AppendQuadsWithOcclusion(scrollbar_layer_impl, occluded); |
74 | 71 |
75 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect()); | 72 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect()); |
76 EXPECT_EQ(impl.quad_list().size(), 0u); | 73 EXPECT_EQ(impl.quad_list().size(), 0u); |
77 } | 74 } |
78 | 75 |
79 { | 76 { |
80 SCOPED_TRACE("Partial occlusion"); | 77 SCOPED_TRACE("Partial occlusion"); |
81 gfx::Rect occluded(0, 0, 5, 1000); | 78 gfx::Rect occluded(0, 0, 5, 1000); |
82 impl.AppendQuadsWithOcclusion(scrollbar_layer_impl, occluded); | 79 impl.AppendQuadsWithOcclusion(scrollbar_layer_impl, occluded); |
83 | 80 |
84 size_t partially_occluded_count = 0; | 81 size_t partially_occluded_count = 0; |
85 LayerTestCommon::VerifyQuadsCoverRectWithOcclusion( | 82 LayerTestCommon::VerifyQuadsAreOccluded( |
86 impl.quad_list(), thumb_rect, occluded, &partially_occluded_count); | 83 impl.quad_list(), occluded, &partially_occluded_count); |
87 // The layer outputs two quads, which is partially occluded. | 84 // The layer outputs two quads, which is partially occluded. |
88 EXPECT_EQ(2u, impl.quad_list().size()); | 85 EXPECT_EQ(2u, impl.quad_list().size()); |
89 EXPECT_EQ(2u, partially_occluded_count); | 86 EXPECT_EQ(2u, partially_occluded_count); |
90 } | 87 } |
91 } | 88 } |
92 | 89 |
93 } // namespace | 90 } // namespace |
94 } // namespace cc | 91 } // namespace cc |
OLD | NEW |