OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 | 1236 |
1237 l0->Add(l11.get()); | 1237 l0->Add(l11.get()); |
1238 l11->Add(l21.get()); | 1238 l11->Add(l21.get()); |
1239 l0->Add(l12.get()); | 1239 l0->Add(l12.get()); |
1240 DrawTree(l0.get()); | 1240 DrawTree(l0.get()); |
1241 ASSERT_TRUE(ReadPixels(&bitmap)); | 1241 ASSERT_TRUE(ReadPixels(&bitmap)); |
1242 ASSERT_FALSE(bitmap.empty()); | 1242 ASSERT_FALSE(bitmap.empty()); |
1243 // WritePNGFile(bitmap, ref_img1); | 1243 // WritePNGFile(bitmap, ref_img1); |
1244 EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img1)); | 1244 EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img1)); |
1245 | 1245 |
1246 l0->MoveToFront(l11.get()); | 1246 l0->StackAtTop(l11.get()); |
1247 DrawTree(l0.get()); | 1247 DrawTree(l0.get()); |
1248 ASSERT_TRUE(ReadPixels(&bitmap)); | 1248 ASSERT_TRUE(ReadPixels(&bitmap)); |
1249 ASSERT_FALSE(bitmap.empty()); | 1249 ASSERT_FALSE(bitmap.empty()); |
1250 // WritePNGFile(bitmap, ref_img2); | 1250 // WritePNGFile(bitmap, ref_img2); |
1251 EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img2)); | 1251 EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img2)); |
1252 | 1252 |
1253 // l11 is already at the front, should have no effect. | 1253 // l11 is already at the front, should have no effect. |
1254 l0->MoveToFront(l11.get()); | 1254 l0->StackAtTop(l11.get()); |
1255 DrawTree(l0.get()); | 1255 DrawTree(l0.get()); |
1256 ASSERT_TRUE(ReadPixels(&bitmap)); | 1256 ASSERT_TRUE(ReadPixels(&bitmap)); |
1257 ASSERT_FALSE(bitmap.empty()); | 1257 ASSERT_FALSE(bitmap.empty()); |
1258 EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img2)); | 1258 EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img2)); |
1259 | 1259 |
1260 // l11 is already at the front, should have no effect. | 1260 // l11 is already at the front, should have no effect. |
1261 l0->MoveAbove(l11.get(), l12.get()); | 1261 l0->StackAbove(l11.get(), l12.get()); |
1262 DrawTree(l0.get()); | 1262 DrawTree(l0.get()); |
1263 ASSERT_TRUE(ReadPixels(&bitmap)); | 1263 ASSERT_TRUE(ReadPixels(&bitmap)); |
1264 ASSERT_FALSE(bitmap.empty()); | 1264 ASSERT_FALSE(bitmap.empty()); |
1265 EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img2)); | 1265 EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img2)); |
1266 | 1266 |
1267 // should restore to original configuration | 1267 // should restore to original configuration |
1268 l0->MoveAbove(l12.get(), l11.get()); | 1268 l0->StackAbove(l12.get(), l11.get()); |
1269 DrawTree(l0.get()); | 1269 DrawTree(l0.get()); |
1270 ASSERT_TRUE(ReadPixels(&bitmap)); | 1270 ASSERT_TRUE(ReadPixels(&bitmap)); |
1271 ASSERT_FALSE(bitmap.empty()); | 1271 ASSERT_FALSE(bitmap.empty()); |
1272 EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img1)); | 1272 EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img1)); |
1273 } | 1273 } |
1274 | 1274 |
1275 // Opacity is rendered correctly. | 1275 // Opacity is rendered correctly. |
1276 // Checks that modifying the hierarchy correctly affects final composite. | 1276 // Checks that modifying the hierarchy correctly affects final composite. |
1277 TEST_F(LayerWithRealCompositorTest, MAYBE_Opacity) { | 1277 TEST_F(LayerWithRealCompositorTest, MAYBE_Opacity) { |
1278 GetCompositor()->WidgetSizeChanged(gfx::Size(50, 50)); | 1278 GetCompositor()->WidgetSizeChanged(gfx::Size(50, 50)); |
(...skipping 11 matching lines...) Expand all Loading... |
1290 l0->Add(l11.get()); | 1290 l0->Add(l11.get()); |
1291 DrawTree(l0.get()); | 1291 DrawTree(l0.get()); |
1292 SkBitmap bitmap; | 1292 SkBitmap bitmap; |
1293 ASSERT_TRUE(ReadPixels(&bitmap)); | 1293 ASSERT_TRUE(ReadPixels(&bitmap)); |
1294 ASSERT_FALSE(bitmap.empty()); | 1294 ASSERT_FALSE(bitmap.empty()); |
1295 // WritePNGFile(bitmap, ref_img); | 1295 // WritePNGFile(bitmap, ref_img); |
1296 EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img)); | 1296 EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img)); |
1297 } | 1297 } |
1298 | 1298 |
1299 } // namespace ui | 1299 } // namespace ui |
OLD | NEW |