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 "ui/aura_shell/default_container_layout_manager.h" | 5 #include "ui/aura_shell/default_container_layout_manager.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "ui/aura/test/aura_test_base.h" | 10 #include "ui/aura/test/aura_test_base.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 parent, | 60 parent, |
61 Widget::InitParams::TYPE_WINDOW); | 61 Widget::InitParams::TYPE_WINDOW); |
62 } | 62 } |
63 | 63 |
64 aura::Window* container() { return container_.get(); } | 64 aura::Window* container() { return container_.get(); } |
65 | 65 |
66 DefaultContainerLayoutManager* default_container_layout_manager() { | 66 DefaultContainerLayoutManager* default_container_layout_manager() { |
67 return workspace_controller_->layout_manager(); | 67 return workspace_controller_->layout_manager(); |
68 } | 68 } |
69 | 69 |
70 private: | 70 protected: |
71 scoped_ptr<aura::Window> container_; | 71 scoped_ptr<aura::Window> container_; |
72 ScopedVector<ui::ViewProp> props_; | 72 ScopedVector<ui::ViewProp> props_; |
73 scoped_ptr<aura_shell::internal::WorkspaceController> workspace_controller_; | 73 scoped_ptr<aura_shell::internal::WorkspaceController> workspace_controller_; |
74 | 74 |
75 private: | |
75 DISALLOW_COPY_AND_ASSIGN(DefaultContainerLayoutManagerTest); | 76 DISALLOW_COPY_AND_ASSIGN(DefaultContainerLayoutManagerTest); |
76 }; | 77 }; |
77 | 78 |
78 } // namespace | 79 } // namespace |
79 | 80 |
80 #if !defined(OS_WIN) | 81 #if !defined(OS_WIN) |
81 TEST_F(DefaultContainerLayoutManagerTest, SetBounds) { | 82 TEST_F(DefaultContainerLayoutManagerTest, SetBounds) { |
82 // Layout Manager moves the window to (0,0) to fit to draggable area. | 83 // Layout Manager moves the window to (0,0) to fit to draggable area. |
83 scoped_ptr<aura::Window> child( | 84 scoped_ptr<aura::Window> child( |
84 CreateTestWindow(gfx::Rect(0, -1000, 100, 100), container())); | 85 CreateTestWindow(gfx::Rect(0, -1000, 100, 100), container())); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 | 130 |
130 // A popup window can be moved to outside of draggable area. | 131 // A popup window can be moved to outside of draggable area. |
131 popup->SetBounds(gfx::Rect(-100, 0, 100, 100)); | 132 popup->SetBounds(gfx::Rect(-100, 0, 100, 100)); |
132 EXPECT_EQ("-100,0 100x100", popup->bounds().ToString()); | 133 EXPECT_EQ("-100,0 100x100", popup->bounds().ToString()); |
133 | 134 |
134 // A popup window can be resized to the size bigger than draggable area. | 135 // A popup window can be resized to the size bigger than draggable area. |
135 popup->SetBounds(gfx::Rect(0, 0, 1000, 1000)); | 136 popup->SetBounds(gfx::Rect(0, 0, 1000, 1000)); |
136 EXPECT_EQ("0,0 1000x1000", popup->bounds().ToString()); | 137 EXPECT_EQ("0,0 1000x1000", popup->bounds().ToString()); |
137 } | 138 } |
138 | 139 |
140 // Make sure a window with a transient parent isn't resized by the layout | |
141 // manager. | |
142 TEST_F(DefaultContainerLayoutManagerTest, IgnoreTransient) { | |
143 scoped_ptr<aura::Window> window(new aura::Window(NULL)); | |
144 props_.push_back( | |
145 new ui::ViewProp( | |
146 window.get(), views::NativeWidgetAura::kWindowTypeKey, | |
147 reinterpret_cast<void*>(Widget::InitParams::TYPE_WINDOW))); | |
Ben Goodger (Google)
2011/10/31 18:24:27
It seems like we should have a utility function do
oshima
2011/10/31 19:48:47
I'm adding Widow::SetIntProperty, which should be
| |
148 window->SetType(Widget::InitParams::TYPE_WINDOW); | |
149 window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); | |
150 aura::Desktop::GetInstance()->AddTransientChild(window.get()); | |
151 window->SetBounds(gfx::Rect(0, 0, 200, 200)); | |
152 window->Show(); | |
153 window->SetParent(container()); | |
154 | |
155 EXPECT_EQ("0,0 200x200", window->bounds().ToString()); | |
156 } | |
157 | |
139 } // namespace test | 158 } // namespace test |
140 } // namespace aura_shell | 159 } // namespace aura_shell |
OLD | NEW |