OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/wm/core/image_grid.h" | 5 #include "ui/wm/core/image_grid.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
9 #include "ui/aura/test/aura_test_base.h" | |
10 #include "ui/gfx/image/image.h" | 9 #include "ui/gfx/image/image.h" |
11 #include "ui/gfx/image/image_skia.h" | 10 #include "ui/gfx/image/image_skia.h" |
| 11 #include "ui/wm/test/wm_test_base.h" |
12 | 12 |
13 namespace wm { | 13 namespace wm { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 // Creates a gfx::Image with the requested dimensions. | 17 // Creates a gfx::Image with the requested dimensions. |
18 gfx::Image* CreateImage(const gfx::Size& size) { | 18 gfx::Image* CreateImage(const gfx::Size& size) { |
19 SkBitmap bitmap; | 19 SkBitmap bitmap; |
20 bitmap.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height()); | 20 bitmap.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height()); |
21 return new gfx::Image(gfx::ImageSkia::CreateFrom1xBitmap(bitmap)); | 21 return new gfx::Image(gfx::ImageSkia::CreateFrom1xBitmap(bitmap)); |
22 } | 22 } |
23 | 23 |
24 } // namespace | 24 } // namespace |
25 | 25 |
26 typedef aura::test::AuraTestBase ImageGridTest; | 26 typedef WMTestBase ImageGridTest; |
27 | 27 |
28 // Test that an ImageGrid's layers are transformed correctly when SetSize() is | 28 // Test that an ImageGrid's layers are transformed correctly when SetSize() is |
29 // called. | 29 // called. |
30 TEST_F(ImageGridTest, Basic) { | 30 TEST_F(ImageGridTest, Basic) { |
31 // Size of the images around the grid's border. | 31 // Size of the images around the grid's border. |
32 const int kBorder = 2; | 32 const int kBorder = 2; |
33 | 33 |
34 scoped_ptr<gfx::Image> image_1x1(CreateImage(gfx::Size(1, 1))); | 34 scoped_ptr<gfx::Image> image_1x1(CreateImage(gfx::Size(1, 1))); |
35 scoped_ptr<gfx::Image> image_1xB(CreateImage(gfx::Size(1, kBorder))); | 35 scoped_ptr<gfx::Image> image_1xB(CreateImage(gfx::Size(1, kBorder))); |
36 scoped_ptr<gfx::Image> image_Bx1(CreateImage(gfx::Size(kBorder, 1))); | 36 scoped_ptr<gfx::Image> image_Bx1(CreateImage(gfx::Size(kBorder, 1))); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 EXPECT_TRUE(grid.center_layer()->visible()); | 331 EXPECT_TRUE(grid.center_layer()->visible()); |
332 | 332 |
333 // We shouldn't be clipping the corner images anymore. | 333 // We shouldn't be clipping the corner images anymore. |
334 EXPECT_TRUE(test_api.top_left_clip_rect().IsEmpty()); | 334 EXPECT_TRUE(test_api.top_left_clip_rect().IsEmpty()); |
335 EXPECT_TRUE(test_api.top_right_clip_rect().IsEmpty()); | 335 EXPECT_TRUE(test_api.top_right_clip_rect().IsEmpty()); |
336 EXPECT_TRUE(test_api.bottom_left_clip_rect().IsEmpty()); | 336 EXPECT_TRUE(test_api.bottom_left_clip_rect().IsEmpty()); |
337 EXPECT_TRUE(test_api.bottom_right_clip_rect().IsEmpty()); | 337 EXPECT_TRUE(test_api.bottom_right_clip_rect().IsEmpty()); |
338 } | 338 } |
339 | 339 |
340 } // namespace wm | 340 } // namespace wm |
OLD | NEW |