OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 root->Add(l1.get()); | 1188 root->Add(l1.get()); |
1189 EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); | 1189 EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); |
1190 size_in_pixel = l1->web_layer().bounds(); | 1190 size_in_pixel = l1->web_layer().bounds(); |
1191 EXPECT_EQ("280x360", size_in_pixel.ToString()); | 1191 EXPECT_EQ("280x360", size_in_pixel.ToString()); |
1192 EXPECT_EQ(2.0f, l1_delegate.device_scale_factor()); | 1192 EXPECT_EQ(2.0f, l1_delegate.device_scale_factor()); |
1193 RunPendingMessages(); | 1193 RunPendingMessages(); |
1194 EXPECT_EQ("280x360", l1_delegate.paint_size().ToString()); | 1194 EXPECT_EQ("280x360", l1_delegate.paint_size().ToString()); |
1195 EXPECT_EQ("2.0 2.0", l1_delegate.ToScaleString()); | 1195 EXPECT_EQ("2.0 2.0", l1_delegate.ToScaleString()); |
1196 } | 1196 } |
1197 | 1197 |
1198 // Tests layer::set_scale_canvas(false). | 1198 // Tests layer::set_scale_content(false). |
1199 TEST_F(LayerWithRealCompositorTest, MAYBE_NoScaleCanvas) { | 1199 TEST_F(LayerWithRealCompositorTest, MAYBE_NoScaleCanvas) { |
1200 scoped_ptr<Layer> root(CreateColorLayer(SK_ColorWHITE, | 1200 scoped_ptr<Layer> root(CreateColorLayer(SK_ColorWHITE, |
1201 gfx::Rect(10, 20, 200, 220))); | 1201 gfx::Rect(10, 20, 200, 220))); |
1202 scoped_ptr<Layer> l1(CreateColorLayer(SK_ColorWHITE, | 1202 scoped_ptr<Layer> l1(CreateColorLayer(SK_ColorWHITE, |
1203 gfx::Rect(10, 20, 140, 180))); | 1203 gfx::Rect(10, 20, 140, 180))); |
1204 l1->set_scale_canvas(false); | 1204 l1->set_scale_content(false); |
1205 root->Add(l1.get()); | 1205 root->Add(l1.get()); |
1206 TestLayerDelegate l1_delegate; | 1206 TestLayerDelegate l1_delegate; |
1207 l1_delegate.AddColor(SK_ColorWHITE); | 1207 l1_delegate.AddColor(SK_ColorWHITE); |
1208 l1->set_delegate(&l1_delegate); | 1208 l1->set_delegate(&l1_delegate); |
1209 | 1209 |
1210 GetCompositor()->SetScaleAndSize(2.0f, gfx::Size(500, 500)); | 1210 GetCompositor()->SetScaleAndSize(2.0f, gfx::Size(500, 500)); |
1211 GetCompositor()->SetRootLayer(root.get()); | 1211 GetCompositor()->SetRootLayer(root.get()); |
1212 // Scale factor change is notified regardless of scale_canvas flag. | 1212 // Scale factor change is notified regardless of scale_content flag. |
1213 EXPECT_EQ(2.0f, l1_delegate.device_scale_factor()); | 1213 EXPECT_EQ(2.0f, l1_delegate.device_scale_factor()); |
1214 | 1214 |
1215 RunPendingMessages(); | 1215 RunPendingMessages(); |
1216 EXPECT_EQ("280x360", l1_delegate.paint_size().ToString()); | 1216 EXPECT_EQ("280x360", l1_delegate.paint_size().ToString()); |
1217 EXPECT_EQ("1.0 1.0", l1_delegate.ToScaleString()); | 1217 EXPECT_EQ("1.0 1.0", l1_delegate.ToScaleString()); |
1218 } | 1218 } |
1219 | 1219 |
1220 // Verifies that when changing bounds on a layer that is invisible, and then | 1220 // Verifies that when changing bounds on a layer that is invisible, and then |
1221 // made visible, the right thing happens: | 1221 // made visible, the right thing happens: |
1222 // - if just a move, then no painting should happen. | 1222 // - if just a move, then no painting should happen. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 | 1255 |
1256 // Resize layer. | 1256 // Resize layer. |
1257 child->SetBounds(gfx::Rect(200, 200, 400, 400)); | 1257 child->SetBounds(gfx::Rect(200, 200, 400, 400)); |
1258 child->SetVisible(true); | 1258 child->SetVisible(true); |
1259 EXPECT_TRUE(schedule_draw_invoked_); | 1259 EXPECT_TRUE(schedule_draw_invoked_); |
1260 DrawTree(root.get()); | 1260 DrawTree(root.get()); |
1261 EXPECT_TRUE(delegate.painted()); | 1261 EXPECT_TRUE(delegate.painted()); |
1262 } | 1262 } |
1263 | 1263 |
1264 } // namespace ui | 1264 } // namespace ui |
OLD | NEW |