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

Side by Side Diff: cc/picture_layer_tiling_set_unittest.cc

Issue 11417111: cc: Add PictureLayerTilingSet to manage PictureLayerTiling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win_rel Created 8 years 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/picture_layer_tiling_set.cc ('k') | cc/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "cc/picture_layer_tiling_set.h"
6
7 #include "cc/test/fake_picture_layer_tiling_client.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/gfx/size_conversions.h"
10
11 namespace cc {
12
13 TEST(PictureLayerTilingSetTest, NoResources) {
14 FakePictureLayerTilingClient client;
15 PictureLayerTilingSet set(&client);
16 gfx::Size default_tile_size(256, 256);
17
18 gfx::Size layer_bounds(1000, 800);
19 set.SetLayerBounds(layer_bounds);
20
21 set.AddTiling(1.0, default_tile_size);
22 set.AddTiling(1.5, default_tile_size);
23 set.AddTiling(2.0, default_tile_size);
24
25 float contents_scale = 2.0;
26 gfx::Size content_bounds(
27 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, contents_scale)));
28 gfx::Rect content_rect(gfx::Point(), content_bounds);
29
30 Region remaining(content_rect);
31 PictureLayerTilingSet::Iterator iter(&set, contents_scale, content_rect);
32 for (; iter; ++iter) {
33 gfx::Rect geometry_rect = iter.geometry_rect();
34 EXPECT_TRUE(content_rect.Contains(geometry_rect));
35 ASSERT_TRUE(remaining.Contains(geometry_rect));
36 remaining.Subtract(geometry_rect);
37
38 // No tiles have resources, so no iter represents a real tile.
39 EXPECT_FALSE(*iter);
40 }
41 EXPECT_TRUE(remaining.IsEmpty());
42 }
43
44 } // namespace cc
OLDNEW
« no previous file with comments | « cc/picture_layer_tiling_set.cc ('k') | cc/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698