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 "cc/resources/picture_layer_tiling.h" | 5 #include "cc/resources/picture_layer_tiling.h" |
6 | 6 |
7 #include "cc/test/fake_picture_layer_tiling_client.h" | 7 #include "cc/test/fake_picture_layer_tiling_client.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "ui/gfx/rect_conversions.h" | 9 #include "ui/gfx/rect_conversions.h" |
10 #include "ui/gfx/size_conversions.h" | 10 #include "ui/gfx/size_conversions.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 TEST_F(PictureLayerTilingIteratorTest, NonIntersectingRect) { | 150 TEST_F(PictureLayerTilingIteratorTest, NonIntersectingRect) { |
151 Initialize(gfx::Size(100, 100), 1.0f, gfx::Size(800, 600)); | 151 Initialize(gfx::Size(100, 100), 1.0f, gfx::Size(800, 600)); |
152 gfx::Rect non_intersecting(1000, 1000, 50, 50); | 152 gfx::Rect non_intersecting(1000, 1000, 50, 50); |
153 PictureLayerTiling::Iterator iter(tiling_.get(), 1, non_intersecting); | 153 PictureLayerTiling::Iterator iter(tiling_.get(), 1, non_intersecting); |
154 EXPECT_FALSE(iter); | 154 EXPECT_FALSE(iter); |
155 } | 155 } |
156 | 156 |
157 TEST_F(PictureLayerTilingIteratorTest, LayerEdgeTextureCoordinates) { | 157 TEST_F(PictureLayerTilingIteratorTest, LayerEdgeTextureCoordinates) { |
158 Initialize(gfx::Size(300, 300), 1.0f, gfx::Size(256, 256)); | 158 Initialize(gfx::Size(300, 300), 1.0f, gfx::Size(256, 256)); |
159 // All of these sizes are 256x256, scaled and ceiled. | 159 // All of these sizes are 256x256, scaled and ceiled. |
160 VerifyTilesExactlyCoverRect(1.0f, gfx::Rect(gfx::Size(256, 256))); | 160 VerifyTilesExactlyCoverRect(1.0f, gfx::Rect(0, 0, 256, 256)); |
161 VerifyTilesExactlyCoverRect(0.8f, gfx::Rect(gfx::Size(205, 205))); | 161 VerifyTilesExactlyCoverRect(0.8f, gfx::Rect(0, 0, 205, 205)); |
162 VerifyTilesExactlyCoverRect(1.2f, gfx::Rect(gfx::Size(308, 308))); | 162 VerifyTilesExactlyCoverRect(1.2f, gfx::Rect(0, 0, 308, 308)); |
163 } | 163 } |
164 | 164 |
165 TEST_F(PictureLayerTilingIteratorTest, NonContainedDestRect) { | 165 TEST_F(PictureLayerTilingIteratorTest, NonContainedDestRect) { |
166 Initialize(gfx::Size(100, 100), 1.0f, gfx::Size(400, 400)); | 166 Initialize(gfx::Size(100, 100), 1.0f, gfx::Size(400, 400)); |
167 | 167 |
168 // Too large in all dimensions | 168 // Too large in all dimensions |
169 VerifyTilesCoverNonContainedRect(1.0f, gfx::Rect(-1000, -1000, 2000, 2000)); | 169 VerifyTilesCoverNonContainedRect(1.0f, gfx::Rect(-1000, -1000, 2000, 2000)); |
170 VerifyTilesCoverNonContainedRect(1.5f, gfx::Rect(-1000, -1000, 2000, 2000)); | 170 VerifyTilesCoverNonContainedRect(1.5f, gfx::Rect(-1000, -1000, 2000, 2000)); |
171 VerifyTilesCoverNonContainedRect(0.5f, gfx::Rect(-1000, -1000, 2000, 2000)); | 171 VerifyTilesCoverNonContainedRect(0.5f, gfx::Rect(-1000, -1000, 2000, 2000)); |
172 | 172 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 gfx::Rect in(40, 50, 100, 200); | 355 gfx::Rect in(40, 50, 100, 200); |
356 gfx::Rect bounds(0, 0, 10, 10); | 356 gfx::Rect bounds(0, 0, 10, 10); |
357 int64 target_area = 400 * 400; | 357 int64 target_area = 400 * 400; |
358 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( | 358 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
359 in, target_area, bounds); | 359 in, target_area, bounds); |
360 EXPECT_TRUE(out.IsEmpty()); | 360 EXPECT_TRUE(out.IsEmpty()); |
361 } | 361 } |
362 | 362 |
363 } // namespace | 363 } // namespace |
364 } // namespace cc | 364 } // namespace cc |
OLD | NEW |