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

Unified Diff: cc/layers/scrollbar_layer_unittest.cc

Issue 524373003: Scrollbar ThumbLength is not updated when window size is changed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modified Variable Name Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: cc/layers/scrollbar_layer_unittest.cc
diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc
index bcec55ac145bf6bd931ec92dd28e9574efc8c168..29e3bd804bea7fe35b01841d321da5056f4cf40e 100644
--- a/cc/layers/scrollbar_layer_unittest.cc
+++ b/cc/layers/scrollbar_layer_unittest.cc
@@ -192,6 +192,52 @@ TEST(PaintedScrollbarLayerTest, ScrollOffsetSynchronization) {
scrollbar_layer_impl->ScrollbarParametersDidChange(); \
} while (false)
+TEST(ScrollbarLayerTest, UpdatePropertiesOfScrollBarWhenThumbRemoved) {
+ scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
+ scoped_refptr<Layer> root_clip_layer = Layer::Create();
+ scoped_refptr<Layer> root_layer = Layer::Create();
+ scoped_refptr<Layer> content_layer = Layer::Create();
+ scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer =
+ FakePaintedScrollbarLayer::Create(false, true, root_layer->id());
+
+ root_layer->SetScrollClipLayerId(root_clip_layer->id());
+ // Give the root-clip a size that will result in MaxScrollOffset = (80, 0).
+ root_clip_layer->SetBounds(gfx::Size(20, 50));
+ root_layer->SetBounds(gfx::Size(100, 50));
+ content_layer->SetBounds(gfx::Size(100, 50));
+
+ host->SetRootLayer(root_clip_layer);
+ root_clip_layer->AddChild(root_layer);
+ root_layer->AddChild(content_layer);
+ root_layer->AddChild(scrollbar_layer);
+
+ root_layer->SetScrollOffset(gfx::Vector2d(0, 0));
+ scrollbar_layer->SetBounds(gfx::Size(70, 10));
+ scrollbar_layer->SetScrollLayer(root_layer->id());
+ scrollbar_layer->SetClipLayer(root_clip_layer->id());
+ scrollbar_layer->fake_scrollbar()->set_location(gfx::Point(20, 10));
+ scrollbar_layer->fake_scrollbar()->set_track_rect(gfx::Rect(30, 10, 50, 10));
+ scrollbar_layer->fake_scrollbar()->set_thumb_thickness(10);
+ scrollbar_layer->fake_scrollbar()->set_thumb_length(4);
+
+ scrollbar_layer->UpdateThumbAndTrackGeometry();
+ LayerImpl* root_clip_layer_impl = NULL;
+ LayerImpl* root_layer_impl = NULL;
+ PaintedScrollbarLayerImpl* scrollbar_layer_impl = NULL;
+
+ UPDATE_AND_EXTRACT_LAYER_POINTERS();
+ EXPECT_EQ(gfx::Rect(10, 0, 4, 10).ToString(),
+ scrollbar_layer_impl->ComputeThumbQuadRect().ToString());
+
+ scrollbar_layer->fake_scrollbar()->set_thumb_thickness(0);
+ scrollbar_layer->fake_scrollbar()->set_thumb_length(0);
+ scrollbar_layer->fake_scrollbar()->set_has_thumb(false);
+
+ UPDATE_AND_EXTRACT_LAYER_POINTERS();
+ EXPECT_EQ(gfx::Rect(10, 0, 0, 0).ToString(),
+ scrollbar_layer_impl->ComputeThumbQuadRect().ToString());
+}
+
TEST(ScrollbarLayerTest, ThumbRect) {
scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
scoped_refptr<Layer> root_clip_layer = Layer::Create();

Powered by Google App Engine
This is Rietveld 408576698