| 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 "ash/test/aura_shell_test_base.h" | 5 #include "ash/test/aura_shell_test_base.h" |
| 6 #include "ash/wm/image_grid.h" | 6 #include "ash/wm/image_grid.h" |
| 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/gfx/image/image.h" | 9 #include "ui/gfx/image/image.h" |
| 10 | 10 |
| 11 using aura_shell::internal::ImageGrid; | 11 using ash::internal::ImageGrid; |
| 12 | 12 |
| 13 namespace aura_shell { | 13 namespace ash { |
| 14 namespace test { | 14 namespace test { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // Creates a gfx::Image with the requested dimensions. | 18 // Creates a gfx::Image with the requested dimensions. |
| 19 gfx::Image* CreateImage(const gfx::Size& size) { | 19 gfx::Image* CreateImage(const gfx::Size& size) { |
| 20 SkBitmap* bitmap = new SkBitmap(); | 20 SkBitmap* bitmap = new SkBitmap(); |
| 21 bitmap->setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height()); | 21 bitmap->setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height()); |
| 22 return new gfx::Image(bitmap); | 22 return new gfx::Image(bitmap); |
| 23 } | 23 } |
| 24 | 24 |
| 25 } // namespace | 25 } // namespace |
| 26 | 26 |
| 27 typedef aura_shell::test::AuraShellTestBase ImageGridTest; | 27 typedef ash::test::AuraShellTestBase ImageGridTest; |
| 28 | 28 |
| 29 // Test that an ImageGrid's layers are transformed correctly when SetSize() is | 29 // Test that an ImageGrid's layers are transformed correctly when SetSize() is |
| 30 // called. | 30 // called. |
| 31 TEST_F(ImageGridTest, Basic) { | 31 TEST_F(ImageGridTest, Basic) { |
| 32 // Size of the images around the grid's border. | 32 // Size of the images around the grid's border. |
| 33 const int kBorder = 2; | 33 const int kBorder = 2; |
| 34 | 34 |
| 35 scoped_ptr<gfx::Image> image_1x1(CreateImage(gfx::Size(1, 1))); | 35 scoped_ptr<gfx::Image> image_1x1(CreateImage(gfx::Size(1, 1))); |
| 36 scoped_ptr<gfx::Image> image_1xB(CreateImage(gfx::Size(1, kBorder))); | 36 scoped_ptr<gfx::Image> image_1xB(CreateImage(gfx::Size(1, kBorder))); |
| 37 scoped_ptr<gfx::Image> image_Bx1(CreateImage(gfx::Size(kBorder, 1))); | 37 scoped_ptr<gfx::Image> image_Bx1(CreateImage(gfx::Size(kBorder, 1))); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 EXPECT_TRUE(test_api.center_layer()->visible()); | 262 EXPECT_TRUE(test_api.center_layer()->visible()); |
| 263 | 263 |
| 264 // We shouldn't be clipping the corner images anymore. | 264 // We shouldn't be clipping the corner images anymore. |
| 265 EXPECT_TRUE(test_api.top_left_clip_rect().IsEmpty()); | 265 EXPECT_TRUE(test_api.top_left_clip_rect().IsEmpty()); |
| 266 EXPECT_TRUE(test_api.top_right_clip_rect().IsEmpty()); | 266 EXPECT_TRUE(test_api.top_right_clip_rect().IsEmpty()); |
| 267 EXPECT_TRUE(test_api.bottom_left_clip_rect().IsEmpty()); | 267 EXPECT_TRUE(test_api.bottom_left_clip_rect().IsEmpty()); |
| 268 EXPECT_TRUE(test_api.bottom_right_clip_rect().IsEmpty()); | 268 EXPECT_TRUE(test_api.bottom_right_clip_rect().IsEmpty()); |
| 269 } | 269 } |
| 270 | 270 |
| 271 } // namespace test | 271 } // namespace test |
| 272 } // namespace aura_shell | 272 } // namespace ash |
| OLD | NEW |