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

Side by Side Diff: cc/blink/web_layer_impl_fixed_bounds_unittest.cc

Issue 1357423009: gfx: Make conversions from Size to SizeF be explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sizefconvert-gfx: . Created 5 years, 2 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
« no previous file with comments | « cc/base/math_util.h ('k') | cc/input/input_handler.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 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 <vector> 5 #include <vector>
6 #include "cc/blink/web_layer_impl_fixed_bounds.h" 6 #include "cc/blink/web_layer_impl_fixed_bounds.h"
7 #include "cc/layers/picture_image_layer.h" 7 #include "cc/layers/picture_image_layer.h"
8 #include "cc/test/fake_layer_tree_host.h" 8 #include "cc/test/fake_layer_tree_host.h"
9 #include "cc/test/geometry_test_utils.h" 9 #include "cc/test/geometry_test_utils.h"
10 #include "cc/test/test_task_graph_runner.h" 10 #include "cc/test/test_task_graph_runner.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 TEST(WebLayerImplFixedBoundsTest, BoundsScaleSimple) { 61 TEST(WebLayerImplFixedBoundsTest, BoundsScaleSimple) {
62 scoped_ptr<WebLayerImplFixedBounds> layer(new WebLayerImplFixedBounds()); 62 scoped_ptr<WebLayerImplFixedBounds> layer(new WebLayerImplFixedBounds());
63 CheckBoundsScaleSimple(layer.get(), WebSize(100, 200), gfx::Size(150, 250)); 63 CheckBoundsScaleSimple(layer.get(), WebSize(100, 200), gfx::Size(150, 250));
64 // Change fixed_bounds. 64 // Change fixed_bounds.
65 CheckBoundsScaleSimple(layer.get(), WebSize(100, 200), gfx::Size(75, 100)); 65 CheckBoundsScaleSimple(layer.get(), WebSize(100, 200), gfx::Size(75, 100));
66 // Change bounds. 66 // Change bounds.
67 CheckBoundsScaleSimple(layer.get(), WebSize(300, 100), gfx::Size(75, 100)); 67 CheckBoundsScaleSimple(layer.get(), WebSize(300, 100), gfx::Size(75, 100));
68 } 68 }
69 69
70 void ExpectEqualLayerRectsInTarget(cc::Layer* layer1, cc::Layer* layer2) { 70 void ExpectEqualLayerRectsInTarget(cc::Layer* layer1, cc::Layer* layer2) {
71 gfx::RectF layer1_rect_in_target(layer1->bounds()); 71 gfx::RectF layer1_rect_in_target(gfx::SizeF(layer1->bounds()));
72 layer1->draw_transform().TransformRect(&layer1_rect_in_target); 72 layer1->draw_transform().TransformRect(&layer1_rect_in_target);
73 73
74 gfx::RectF layer2_rect_in_target(layer2->bounds()); 74 gfx::RectF layer2_rect_in_target(gfx::SizeF(layer2->bounds()));
75 layer2->draw_transform().TransformRect(&layer2_rect_in_target); 75 layer2->draw_transform().TransformRect(&layer2_rect_in_target);
76 76
77 EXPECT_FLOAT_RECT_EQ(layer1_rect_in_target, layer2_rect_in_target); 77 EXPECT_FLOAT_RECT_EQ(layer1_rect_in_target, layer2_rect_in_target);
78 } 78 }
79 79
80 void CompareFixedBoundsLayerAndNormalLayer(const WebFloatPoint& anchor_point, 80 void CompareFixedBoundsLayerAndNormalLayer(const WebFloatPoint& anchor_point,
81 const gfx::Transform& transform) { 81 const gfx::Transform& transform) {
82 const gfx::Size kDeviceViewportSize(800, 600); 82 const gfx::Size kDeviceViewportSize(800, 600);
83 const float kDeviceScaleFactor = 2.f; 83 const float kDeviceScaleFactor = 2.f;
84 const float kPageScaleFactor = 1.5f; 84 const float kPageScaleFactor = 1.5f;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0, 0), transform); 171 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0, 0), transform);
172 172
173 // With non-zero anchor point, WebLayerImplFixedBounds will fall back to 173 // With non-zero anchor point, WebLayerImplFixedBounds will fall back to
174 // WebLayerImpl. 174 // WebLayerImpl.
175 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0.4f, 0.6f), transform); 175 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0.4f, 0.6f), transform);
176 } 176 }
177 177
178 } // namespace 178 } // namespace
179 } // namespace cc_blink 179 } // namespace cc_blink
OLDNEW
« no previous file with comments | « cc/base/math_util.h ('k') | cc/input/input_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698