OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "cc/test/fake_picture_pile_impl.h" | 6 #include "cc/test/fake_picture_pile_impl.h" |
7 #include "cc/test/skia_common.h" | 7 #include "cc/test/skia_common.h" |
8 #include "skia/ext/lazy_pixel_ref.h" | 8 #include "skia/ext/lazy_pixel_ref.h" |
9 #include "skia/ext/refptr.h" | 9 #include "skia/ext/refptr.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 pile->AnalyzeInRect(gfx::Rect(0, 35, 10, 10), 0.1f, &analysis); | 124 pile->AnalyzeInRect(gfx::Rect(0, 35, 10, 10), 0.1f, &analysis); |
125 EXPECT_TRUE(analysis.is_solid_color); | 125 EXPECT_TRUE(analysis.is_solid_color); |
126 EXPECT_EQ(analysis.solid_color, solid_color); | 126 EXPECT_EQ(analysis.solid_color, solid_color); |
127 | 127 |
128 analysis.is_solid_color = false; | 128 analysis.is_solid_color = false; |
129 pile->AnalyzeInRect(gfx::Rect(35, 35, 10, 10), 0.1f, &analysis); | 129 pile->AnalyzeInRect(gfx::Rect(35, 35, 10, 10), 0.1f, &analysis); |
130 EXPECT_TRUE(analysis.is_solid_color); | 130 EXPECT_TRUE(analysis.is_solid_color); |
131 EXPECT_EQ(analysis.solid_color, solid_color); | 131 EXPECT_EQ(analysis.solid_color, solid_color); |
132 } | 132 } |
133 | 133 |
| 134 TEST(PicturePileImplTest, AnalyzeIsSolidEmpty) { |
| 135 gfx::Size tile_size(100, 100); |
| 136 gfx::Size layer_bounds(400, 400); |
| 137 |
| 138 scoped_refptr<FakePicturePileImpl> pile = |
| 139 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 140 PicturePileImpl::Analysis analysis; |
| 141 EXPECT_FALSE(analysis.is_solid_color); |
| 142 |
| 143 pile->AnalyzeInRect(gfx::Rect(0, 0, 400, 400), 1.f, &analysis); |
| 144 |
| 145 EXPECT_TRUE(analysis.is_solid_color); |
| 146 EXPECT_EQ(analysis.solid_color, SkColorSetARGB(0, 0, 0, 0)); |
| 147 } |
| 148 |
134 TEST(PicturePileImplTest, PixelRefIteratorEmpty) { | 149 TEST(PicturePileImplTest, PixelRefIteratorEmpty) { |
135 gfx::Size tile_size(128, 128); | 150 gfx::Size tile_size(128, 128); |
136 gfx::Size layer_bounds(256, 256); | 151 gfx::Size layer_bounds(256, 256); |
137 | 152 |
138 // Create a filled pile with no recording. | 153 // Create a filled pile with no recording. |
139 scoped_refptr<FakePicturePileImpl> pile = | 154 scoped_refptr<FakePicturePileImpl> pile = |
140 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 155 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
141 | 156 |
142 // Tile sized iterators. | 157 // Tile sized iterators. |
143 { | 158 { |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 PicturePileImpl::PixelRefIterator iterator( | 813 PicturePileImpl::PixelRefIterator iterator( |
799 gfx::Rect(0, 128, 128, 128), | 814 gfx::Rect(0, 128, 128, 128), |
800 1.0, | 815 1.0, |
801 pile); | 816 pile); |
802 EXPECT_FALSE(iterator); | 817 EXPECT_FALSE(iterator); |
803 } | 818 } |
804 } | 819 } |
805 | 820 |
806 } // namespace | 821 } // namespace |
807 } // namespace cc | 822 } // namespace cc |
OLD | NEW |