Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: cc/layers/scrollbar_layer_unittest.cc

Issue 23112020: Remove solid_color_scrollbar_thickness_dip from LayerTreeSettings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layers/painted_scrollbar_layer.cc ('k') | cc/trees/layer_tree_settings.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 root_layer_impl = host->CommitAndCreateLayerImplTree(); 245 root_layer_impl = host->CommitAndCreateLayerImplTree();
246 scrollbar_layer_impl = static_cast<PaintedScrollbarLayerImpl*>( 246 scrollbar_layer_impl = static_cast<PaintedScrollbarLayerImpl*>(
247 root_layer_impl->children()[1]); 247 root_layer_impl->children()[1]);
248 EXPECT_EQ(gfx::Rect(44, 0, 6, 4).ToString(), 248 EXPECT_EQ(gfx::Rect(44, 0, 6, 4).ToString(),
249 scrollbar_layer_impl->ComputeThumbQuadRect().ToString()); 249 scrollbar_layer_impl->ComputeThumbQuadRect().ToString());
250 } 250 }
251 251
252 TEST(ScrollbarLayerTest, SolidColorDrawQuads) { 252 TEST(ScrollbarLayerTest, SolidColorDrawQuads) {
253 LayerTreeSettings layer_tree_settings; 253 LayerTreeSettings layer_tree_settings;
254 layer_tree_settings.solid_color_scrollbars = true; 254 layer_tree_settings.solid_color_scrollbars = true;
255 layer_tree_settings.solid_color_scrollbar_thickness_dip = 3;
256 scoped_ptr<FakeLayerTreeHost> host = 255 scoped_ptr<FakeLayerTreeHost> host =
257 FakeLayerTreeHost::Create(layer_tree_settings); 256 FakeLayerTreeHost::Create(layer_tree_settings);
258 257
259 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, true)); 258 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, true));
260 LayerImpl* layer_impl_tree_root = 259 LayerImpl* layer_impl_tree_root =
261 LayerImplForScrollAreaAndScrollbar(host.get(), scrollbar.Pass(), false); 260 LayerImplForScrollAreaAndScrollbar(host.get(), scrollbar.Pass(), false);
262 PaintedScrollbarLayerImpl* scrollbar_layer_impl = 261 PaintedScrollbarLayerImpl* scrollbar_layer_impl =
263 static_cast<PaintedScrollbarLayerImpl*>( 262 static_cast<PaintedScrollbarLayerImpl*>(
264 layer_impl_tree_root->children()[1]); 263 layer_impl_tree_root->children()[1]);
265 scrollbar_layer_impl->SetThumbThickness(3); 264 scrollbar_layer_impl->SetThumbThickness(3);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 const QuadList& quads = quad_culler.quad_list(); 306 const QuadList& quads = quad_culler.quad_list();
308 ASSERT_EQ(1u, quads.size()); 307 ASSERT_EQ(1u, quads.size());
309 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material); 308 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material);
310 EXPECT_RECT_EQ(gfx::Rect(8, 0, 20, 3), quads[0]->rect); 309 EXPECT_RECT_EQ(gfx::Rect(8, 0, 20, 3), quads[0]->rect);
311 } 310 }
312 } 311 }
313 312
314 TEST(ScrollbarLayerTest, LayerDrivenSolidColorDrawQuads) { 313 TEST(ScrollbarLayerTest, LayerDrivenSolidColorDrawQuads) {
315 LayerTreeSettings layer_tree_settings; 314 LayerTreeSettings layer_tree_settings;
316 layer_tree_settings.solid_color_scrollbars = true; 315 layer_tree_settings.solid_color_scrollbars = true;
317 layer_tree_settings.solid_color_scrollbar_thickness_dip = 3;
318 scoped_ptr<FakeLayerTreeHost> host = 316 scoped_ptr<FakeLayerTreeHost> host =
319 FakeLayerTreeHost::Create(layer_tree_settings); 317 FakeLayerTreeHost::Create(layer_tree_settings);
320 318
321 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, true)); 319 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, true));
322 LayerImpl* layer_impl_tree_root = 320 LayerImpl* layer_impl_tree_root =
323 LayerImplForScrollAreaAndScrollbar(host.get(), scrollbar.Pass(), false); 321 LayerImplForScrollAreaAndScrollbar(host.get(), scrollbar.Pass(), false);
324 PaintedScrollbarLayerImpl* scrollbar_layer_impl = 322 PaintedScrollbarLayerImpl* scrollbar_layer_impl =
325 static_cast<PaintedScrollbarLayerImpl*>( 323 static_cast<PaintedScrollbarLayerImpl*>(
326 layer_impl_tree_root->children()[1]); 324 layer_impl_tree_root->children()[1]);
327 325
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 layer_tree_settings_.solid_color_scrollbars = false; 698 layer_tree_settings_.solid_color_scrollbars = false;
701 // Pick a test scale that moves the scrollbar's (non-zero) position to 699 // Pick a test scale that moves the scrollbar's (non-zero) position to
702 // a non-pixel-aligned location. 700 // a non-pixel-aligned location.
703 TestResourceUpload(.041f); 701 TestResourceUpload(.041f);
704 TestResourceUpload(1.41f); 702 TestResourceUpload(1.41f);
705 TestResourceUpload(4.1f); 703 TestResourceUpload(4.1f);
706 } 704 }
707 705
708 } // namespace 706 } // namespace
709 } // namespace cc 707 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/painted_scrollbar_layer.cc ('k') | cc/trees/layer_tree_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698