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 16 matching lines...) Expand all Loading... |
27 track_sk_bitmap.allocN32Pixels(10, 10); | 27 track_sk_bitmap.allocN32Pixels(10, 10); |
28 track_sk_bitmap.setImmutable(); | 28 track_sk_bitmap.setImmutable(); |
29 UIResourceId track_uid = 6; | 29 UIResourceId track_uid = 6; |
30 UIResourceBitmap track_bitmap(track_sk_bitmap); | 30 UIResourceBitmap track_bitmap(track_sk_bitmap); |
31 impl.host_impl()->CreateUIResource(track_uid, track_bitmap); | 31 impl.host_impl()->CreateUIResource(track_uid, track_bitmap); |
32 | 32 |
33 ScrollbarOrientation orientation = VERTICAL; | 33 ScrollbarOrientation orientation = VERTICAL; |
34 | 34 |
35 PaintedScrollbarLayerImpl* scrollbar_layer_impl = | 35 PaintedScrollbarLayerImpl* scrollbar_layer_impl = |
36 impl.AddChildToRoot<PaintedScrollbarLayerImpl>(orientation); | 36 impl.AddChildToRoot<PaintedScrollbarLayerImpl>(orientation); |
37 scrollbar_layer_impl->SetAnchorPoint(gfx::PointF()); | |
38 scrollbar_layer_impl->SetBounds(layer_size); | 37 scrollbar_layer_impl->SetBounds(layer_size); |
39 scrollbar_layer_impl->SetContentBounds(layer_size); | 38 scrollbar_layer_impl->SetContentBounds(layer_size); |
40 scrollbar_layer_impl->SetDrawsContent(true); | 39 scrollbar_layer_impl->SetDrawsContent(true); |
41 scrollbar_layer_impl->SetThumbThickness(layer_size.width()); | 40 scrollbar_layer_impl->SetThumbThickness(layer_size.width()); |
42 scrollbar_layer_impl->SetThumbLength(500); | 41 scrollbar_layer_impl->SetThumbLength(500); |
43 scrollbar_layer_impl->SetTrackLength(layer_size.height()); | 42 scrollbar_layer_impl->SetTrackLength(layer_size.height()); |
44 scrollbar_layer_impl->SetCurrentPos(100.f / 4); | 43 scrollbar_layer_impl->SetCurrentPos(100.f / 4); |
45 scrollbar_layer_impl->SetMaximum(100); | 44 scrollbar_layer_impl->SetMaximum(100); |
46 scrollbar_layer_impl->SetVisibleToTotalLengthRatio(1.f / 2); | 45 scrollbar_layer_impl->SetVisibleToTotalLengthRatio(1.f / 2); |
47 scrollbar_layer_impl->set_track_ui_resource_id(track_uid); | 46 scrollbar_layer_impl->set_track_ui_resource_id(track_uid); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 LayerTestCommon::VerifyQuadsCoverRectWithOcclusion( | 85 LayerTestCommon::VerifyQuadsCoverRectWithOcclusion( |
87 impl.quad_list(), thumb_rect, occluded, &partially_occluded_count); | 86 impl.quad_list(), thumb_rect, occluded, &partially_occluded_count); |
88 // The layer outputs two quads, which is partially occluded. | 87 // The layer outputs two quads, which is partially occluded. |
89 EXPECT_EQ(2u, impl.quad_list().size()); | 88 EXPECT_EQ(2u, impl.quad_list().size()); |
90 EXPECT_EQ(2u, partially_occluded_count); | 89 EXPECT_EQ(2u, partially_occluded_count); |
91 } | 90 } |
92 } | 91 } |
93 | 92 |
94 } // namespace | 93 } // namespace |
95 } // namespace cc | 94 } // namespace cc |
OLD | NEW |