OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "base/containers/hash_tables.h" | 5 #include "base/containers/hash_tables.h" |
6 #include "cc/animation/scrollbar_animation_controller.h" | 6 #include "cc/animation/scrollbar_animation_controller.h" |
7 #include "cc/debug/test_web_graphics_context_3d.h" | 7 #include "cc/debug/test_web_graphics_context_3d.h" |
8 #include "cc/layers/append_quads_data.h" | 8 #include "cc/layers/append_quads_data.h" |
9 #include "cc/layers/painted_scrollbar_layer.h" | 9 #include "cc/layers/painted_scrollbar_layer.h" |
10 #include "cc/layers/painted_scrollbar_layer_impl.h" | 10 #include "cc/layers/painted_scrollbar_layer_impl.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 root_layer_impl->children()[1]); | 259 root_layer_impl->children()[1]); |
260 EXPECT_EQ(gfx::Rect(44, 0, 6, 4).ToString(), | 260 EXPECT_EQ(gfx::Rect(44, 0, 6, 4).ToString(), |
261 scrollbar_layer_impl->ComputeThumbQuadRect().ToString()); | 261 scrollbar_layer_impl->ComputeThumbQuadRect().ToString()); |
262 } | 262 } |
263 | 263 |
264 TEST(ScrollbarLayerTest, SolidColorDrawQuads) { | 264 TEST(ScrollbarLayerTest, SolidColorDrawQuads) { |
265 const int kThumbThickness = 3; | 265 const int kThumbThickness = 3; |
266 const int kTrackLength = 100; | 266 const int kTrackLength = 100; |
267 | 267 |
268 LayerTreeSettings layer_tree_settings; | 268 LayerTreeSettings layer_tree_settings; |
269 layer_tree_settings.solid_color_scrollbar_thickness_dip = kThumbThickness; | |
270 scoped_ptr<FakeLayerTreeHost> host = | 269 scoped_ptr<FakeLayerTreeHost> host = |
271 FakeLayerTreeHost::Create(layer_tree_settings); | 270 FakeLayerTreeHost::Create(layer_tree_settings); |
272 | 271 |
273 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, true)); | 272 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, true)); |
274 LayerImpl* layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( | 273 LayerImpl* layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( |
275 host.get(), scrollbar.Pass(), false, true, kThumbThickness); | 274 host.get(), scrollbar.Pass(), false, true, kThumbThickness); |
276 ScrollbarLayerImplBase* scrollbar_layer_impl = | 275 ScrollbarLayerImplBase* scrollbar_layer_impl = |
277 static_cast<SolidColorScrollbarLayerImpl*>( | 276 static_cast<SolidColorScrollbarLayerImpl*>( |
278 layer_impl_tree_root->children()[1]); | 277 layer_impl_tree_root->children()[1]); |
279 scrollbar_layer_impl->SetBounds(gfx::Size(kTrackLength, kThumbThickness)); | 278 scrollbar_layer_impl->SetBounds(gfx::Size(kTrackLength, kThumbThickness)); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material); | 321 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material); |
323 EXPECT_RECT_EQ(gfx::Rect(8, 0, 20, 3), quads[0]->rect); | 322 EXPECT_RECT_EQ(gfx::Rect(8, 0, 20, 3), quads[0]->rect); |
324 } | 323 } |
325 } | 324 } |
326 | 325 |
327 TEST(ScrollbarLayerTest, LayerDrivenSolidColorDrawQuads) { | 326 TEST(ScrollbarLayerTest, LayerDrivenSolidColorDrawQuads) { |
328 const int kThumbThickness = 3; | 327 const int kThumbThickness = 3; |
329 const int kTrackLength = 10; | 328 const int kTrackLength = 10; |
330 | 329 |
331 LayerTreeSettings layer_tree_settings; | 330 LayerTreeSettings layer_tree_settings; |
332 layer_tree_settings.solid_color_scrollbar_thickness_dip = 3; | |
333 scoped_ptr<FakeLayerTreeHost> host = | 331 scoped_ptr<FakeLayerTreeHost> host = |
334 FakeLayerTreeHost::Create(layer_tree_settings); | 332 FakeLayerTreeHost::Create(layer_tree_settings); |
335 | 333 |
336 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, true)); | 334 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, true)); |
337 LayerImpl* layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( | 335 LayerImpl* layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( |
338 host.get(), scrollbar.Pass(), false, true, kThumbThickness); | 336 host.get(), scrollbar.Pass(), false, true, kThumbThickness); |
339 ScrollbarLayerImplBase* scrollbar_layer_impl = | 337 ScrollbarLayerImplBase* scrollbar_layer_impl = |
340 static_cast<PaintedScrollbarLayerImpl*>( | 338 static_cast<PaintedScrollbarLayerImpl*>( |
341 layer_impl_tree_root->children()[1]); | 339 layer_impl_tree_root->children()[1]); |
342 | 340 |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 TEST_F(ScaledScrollbarLayerTestResourceCreation, ScaledResourceUpload) { | 729 TEST_F(ScaledScrollbarLayerTestResourceCreation, ScaledResourceUpload) { |
732 // Pick a test scale that moves the scrollbar's (non-zero) position to | 730 // Pick a test scale that moves the scrollbar's (non-zero) position to |
733 // a non-pixel-aligned location. | 731 // a non-pixel-aligned location. |
734 TestResourceUpload(.041f); | 732 TestResourceUpload(.041f); |
735 TestResourceUpload(1.41f); | 733 TestResourceUpload(1.41f); |
736 TestResourceUpload(4.1f); | 734 TestResourceUpload(4.1f); |
737 } | 735 } |
738 | 736 |
739 } // namespace | 737 } // namespace |
740 } // namespace cc | 738 } // namespace cc |
OLD | NEW |