OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "components/exo/buffer.h" | 7 #include "components/exo/buffer.h" |
8 #include "components/exo/shell_surface.h" | 8 #include "components/exo/shell_surface.h" |
9 #include "components/exo/surface.h" | 9 #include "components/exo/surface.h" |
10 #include "components/exo/test/exo_test_base.h" | 10 #include "components/exo/test/exo_test_base.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 std::unique_ptr<Surface> surface(new Surface); | 101 std::unique_ptr<Surface> surface(new Surface); |
102 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); | 102 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); |
103 | 103 |
104 surface->Attach(buffer.get()); | 104 surface->Attach(buffer.get()); |
105 shell_surface->Maximize(); | 105 shell_surface->Maximize(); |
106 surface->Commit(); | 106 surface->Commit(); |
107 EXPECT_EQ(CurrentContext()->bounds().width(), | 107 EXPECT_EQ(CurrentContext()->bounds().width(), |
108 shell_surface->GetWidget()->GetWindowBoundsInScreen().width()); | 108 shell_surface->GetWidget()->GetWindowBoundsInScreen().width()); |
109 } | 109 } |
110 | 110 |
| 111 TEST_P(ShellSurfaceTest, Minimize) { |
| 112 gfx::Size buffer_size(256, 256); |
| 113 std::unique_ptr<Buffer> buffer( |
| 114 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
| 115 std::unique_ptr<Surface> surface(new Surface); |
| 116 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); |
| 117 |
| 118 surface->Attach(buffer.get()); |
| 119 surface->Commit(); |
| 120 shell_surface->Minimize(); |
| 121 EXPECT_TRUE(shell_surface->GetWidget()->IsMinimized()); |
| 122 } |
| 123 |
111 TEST_P(ShellSurfaceTest, Restore) { | 124 TEST_P(ShellSurfaceTest, Restore) { |
112 gfx::Size buffer_size(256, 256); | 125 gfx::Size buffer_size(256, 256); |
113 std::unique_ptr<Buffer> buffer( | 126 std::unique_ptr<Buffer> buffer( |
114 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); | 127 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
115 std::unique_ptr<Surface> surface(new Surface); | 128 std::unique_ptr<Surface> surface(new Surface); |
116 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); | 129 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); |
117 | 130 |
118 surface->Attach(buffer.get()); | 131 surface->Attach(buffer.get()); |
119 surface->Commit(); | 132 surface->Commit(); |
120 // Note: Remove contents to avoid issues with maximize animations in tests. | 133 // Note: Remove contents to avoid issues with maximize animations in tests. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 surface->Attach(buffer.get()); | 216 surface->Attach(buffer.get()); |
204 surface->Commit(); | 217 surface->Commit(); |
205 EXPECT_EQ( | 218 EXPECT_EQ( |
206 geometry.size().ToString(), | 219 geometry.size().ToString(), |
207 shell_surface->GetWidget()->GetWindowBoundsInScreen().size().ToString()); | 220 shell_surface->GetWidget()->GetWindowBoundsInScreen().size().ToString()); |
208 EXPECT_EQ(gfx::Rect(gfx::Point() - geometry.OffsetFromOrigin(), buffer_size) | 221 EXPECT_EQ(gfx::Rect(gfx::Point() - geometry.OffsetFromOrigin(), buffer_size) |
209 .ToString(), | 222 .ToString(), |
210 surface->bounds().ToString()); | 223 surface->bounds().ToString()); |
211 } | 224 } |
212 | 225 |
213 TEST_F(ShellSurfaceTest, SetScale) { | 226 TEST_P(ShellSurfaceTest, SetScale) { |
214 gfx::Size buffer_size(64, 64); | 227 gfx::Size buffer_size(64, 64); |
215 std::unique_ptr<Buffer> buffer( | 228 std::unique_ptr<Buffer> buffer( |
216 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); | 229 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
217 std::unique_ptr<Surface> surface(new Surface); | 230 std::unique_ptr<Surface> surface(new Surface); |
218 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); | 231 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); |
219 | 232 |
220 double scale = 1.5; | 233 double scale = 1.5; |
221 shell_surface->SetScale(scale); | 234 shell_surface->SetScale(scale); |
222 surface->Attach(buffer.get()); | 235 surface->Attach(buffer.get()); |
223 surface->Commit(); | 236 surface->Commit(); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 EXPECT_FALSE(is_resizing); | 335 EXPECT_FALSE(is_resizing); |
323 shell_surface->Resize(HTBOTTOMRIGHT); | 336 shell_surface->Resize(HTBOTTOMRIGHT); |
324 shell_surface->AcknowledgeConfigure(0); | 337 shell_surface->AcknowledgeConfigure(0); |
325 EXPECT_TRUE(is_resizing); | 338 EXPECT_TRUE(is_resizing); |
326 } | 339 } |
327 | 340 |
328 INSTANTIATE_TEST_CASE_P(, ShellSurfaceTest, ::testing::Bool()); | 341 INSTANTIATE_TEST_CASE_P(, ShellSurfaceTest, ::testing::Bool()); |
329 | 342 |
330 } // namespace | 343 } // namespace |
331 } // namespace exo | 344 } // namespace exo |
OLD | NEW |