OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/util/fill_layout_manager.h" | 5 #include "athena/util/fill_layout_manager.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/wm/public/window_types.h" | 9 #include "ui/wm/public/window_types.h" |
10 | 10 |
11 namespace athena { | 11 namespace athena { |
12 | 12 |
13 TEST(FillLayoutManagerTest, ChildWindowSizedCorrectly) { | 13 TEST(FillLayoutManagerTest, ChildWindowSizedCorrectly) { |
14 scoped_ptr<aura::Window> parent(new aura::Window(NULL)); | 14 scoped_ptr<aura::Window> parent(new aura::Window(nullptr)); |
15 parent->SetBounds(gfx::Rect(10, 20, 30, 40)); | 15 parent->SetBounds(gfx::Rect(10, 20, 30, 40)); |
16 parent->SetLayoutManager(new FillLayoutManager(parent.get())); | 16 parent->SetLayoutManager(new FillLayoutManager(parent.get())); |
17 | 17 |
18 scoped_ptr<aura::Window> child(new aura::Window(NULL)); | 18 scoped_ptr<aura::Window> child(new aura::Window(nullptr)); |
19 child->SetBounds(gfx::Rect(0, 0, 5, 10)); | 19 child->SetBounds(gfx::Rect(0, 0, 5, 10)); |
20 | 20 |
21 EXPECT_NE(child->bounds().size().ToString(), | 21 EXPECT_NE(child->bounds().size().ToString(), |
22 parent->bounds().size().ToString()); | 22 parent->bounds().size().ToString()); |
23 | 23 |
24 parent->AddChild(child.get()); | 24 parent->AddChild(child.get()); |
25 EXPECT_EQ(child->bounds().size().ToString(), | 25 EXPECT_EQ(child->bounds().size().ToString(), |
26 parent->bounds().size().ToString()); | 26 parent->bounds().size().ToString()); |
27 | 27 |
28 parent->SetBounds(gfx::Rect(0, 0, 100, 200)); | 28 parent->SetBounds(gfx::Rect(0, 0, 100, 200)); |
29 EXPECT_EQ(child->bounds().size().ToString(), | 29 EXPECT_EQ(child->bounds().size().ToString(), |
30 parent->bounds().size().ToString()); | 30 parent->bounds().size().ToString()); |
31 | 31 |
32 // Menu and tooltip should not be filled. | 32 // Menu and tooltip should not be filled. |
33 scoped_ptr<aura::Window> menu(new aura::Window(NULL)); | 33 scoped_ptr<aura::Window> menu(new aura::Window(nullptr)); |
34 menu->SetType(ui::wm::WINDOW_TYPE_MENU); | 34 menu->SetType(ui::wm::WINDOW_TYPE_MENU); |
35 menu->SetBounds(gfx::Rect(0, 0, 5, 10)); | 35 menu->SetBounds(gfx::Rect(0, 0, 5, 10)); |
36 | 36 |
37 EXPECT_EQ(menu->bounds().ToString(), "0,0 5x10"); | 37 EXPECT_EQ(menu->bounds().ToString(), "0,0 5x10"); |
38 parent->AddChild(menu.get()); | 38 parent->AddChild(menu.get()); |
39 EXPECT_EQ(menu->bounds().ToString(), "0,0 5x10"); | 39 EXPECT_EQ(menu->bounds().ToString(), "0,0 5x10"); |
40 menu->SetBounds(gfx::Rect(0, 0, 100, 200)); | 40 menu->SetBounds(gfx::Rect(0, 0, 100, 200)); |
41 EXPECT_EQ(menu->bounds().ToString(), "0,0 100x200"); | 41 EXPECT_EQ(menu->bounds().ToString(), "0,0 100x200"); |
42 | 42 |
43 scoped_ptr<aura::Window> tooltip(new aura::Window(NULL)); | 43 scoped_ptr<aura::Window> tooltip(new aura::Window(nullptr)); |
44 tooltip->SetType(ui::wm::WINDOW_TYPE_TOOLTIP); | 44 tooltip->SetType(ui::wm::WINDOW_TYPE_TOOLTIP); |
45 tooltip->SetBounds(gfx::Rect(0, 0, 5, 10)); | 45 tooltip->SetBounds(gfx::Rect(0, 0, 5, 10)); |
46 | 46 |
47 EXPECT_EQ(tooltip->bounds().ToString(), "0,0 5x10"); | 47 EXPECT_EQ(tooltip->bounds().ToString(), "0,0 5x10"); |
48 parent->AddChild(tooltip.get()); | 48 parent->AddChild(tooltip.get()); |
49 EXPECT_EQ(tooltip->bounds().ToString(), "0,0 5x10"); | 49 EXPECT_EQ(tooltip->bounds().ToString(), "0,0 5x10"); |
50 tooltip->SetBounds(gfx::Rect(0, 0, 100, 200)); | 50 tooltip->SetBounds(gfx::Rect(0, 0, 100, 200)); |
51 EXPECT_EQ(tooltip->bounds().ToString(), "0,0 100x200"); | 51 EXPECT_EQ(tooltip->bounds().ToString(), "0,0 100x200"); |
52 } | 52 } |
53 | 53 |
54 } // namespace athena | 54 } // namespace athena |
OLD | NEW |