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/quads/draw_quad.h" | 7 #include "cc/quads/draw_quad.h" |
8 #include "cc/test/layer_test_common.h" | 8 #include "cc/test/layer_test_common.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 gfx::Rect(scaled_layer_size).ToString()); | 81 gfx::Rect(scaled_layer_size).ToString()); |
82 EXPECT_EQ(track_quad->visible_rect.ToString(), | 82 EXPECT_EQ(track_quad->visible_rect.ToString(), |
83 gfx::Rect(scaled_layer_size).ToString()); | 83 gfx::Rect(scaled_layer_size).ToString()); |
84 EXPECT_EQ(thumb_quad->rect.ToString(), scaled_thumb_rect.ToString()); | 84 EXPECT_EQ(thumb_quad->rect.ToString(), scaled_thumb_rect.ToString()); |
85 EXPECT_EQ(thumb_quad->visible_rect.ToString(), | 85 EXPECT_EQ(thumb_quad->visible_rect.ToString(), |
86 scaled_thumb_rect.ToString()); | 86 scaled_thumb_rect.ToString()); |
87 } | 87 } |
88 | 88 |
89 { | 89 { |
90 SCOPED_TRACE("Full occlusion"); | 90 SCOPED_TRACE("Full occlusion"); |
91 gfx::Rect occluded(scrollbar_layer_impl->visible_content_rect()); | 91 gfx::Rect occluded(scrollbar_layer_impl->visible_layer_rect()); |
92 impl.AppendQuadsWithOcclusion(scrollbar_layer_impl, occluded); | 92 impl.AppendQuadsWithOcclusion(scrollbar_layer_impl, occluded); |
93 | 93 |
94 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect()); | 94 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect()); |
95 EXPECT_EQ(impl.quad_list().size(), 0u); | 95 EXPECT_EQ(impl.quad_list().size(), 0u); |
96 } | 96 } |
97 | 97 |
98 { | 98 { |
99 SCOPED_TRACE("Partial occlusion"); | 99 SCOPED_TRACE("Partial occlusion"); |
100 gfx::Rect occluded(0, 0, 5, 1000); | 100 gfx::Rect occluded(0, 0, 5, 1000); |
101 impl.AppendQuadsWithOcclusion(scrollbar_layer_impl, occluded); | 101 impl.AppendQuadsWithOcclusion(scrollbar_layer_impl, occluded); |
102 | 102 |
103 size_t partially_occluded_count = 0; | 103 size_t partially_occluded_count = 0; |
104 LayerTestCommon::VerifyQuadsAreOccluded( | 104 LayerTestCommon::VerifyQuadsAreOccluded( |
105 impl.quad_list(), occluded, &partially_occluded_count); | 105 impl.quad_list(), occluded, &partially_occluded_count); |
106 // The layer outputs two quads, which is partially occluded. | 106 // The layer outputs two quads, which is partially occluded. |
107 EXPECT_EQ(2u, impl.quad_list().size()); | 107 EXPECT_EQ(2u, impl.quad_list().size()); |
108 EXPECT_EQ(2u, partially_occluded_count); | 108 EXPECT_EQ(2u, partially_occluded_count); |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
112 } // namespace | 112 } // namespace |
113 } // namespace cc | 113 } // namespace cc |
OLD | NEW |