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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 // Post a task that will destroy the shell surface and then start an | 111 // Post a task that will destroy the shell surface and then start an |
112 // interactive move. The interactive move should end when surface is | 112 // interactive move. The interactive move should end when surface is |
113 // destroyed. | 113 // destroyed. |
114 base::MessageLoopForUI::current()->PostTask( | 114 base::MessageLoopForUI::current()->PostTask( |
115 FROM_HERE, | 115 FROM_HERE, |
116 base::Bind(&DestroyShellSurface, base::Unretained(&shell_surface))); | 116 base::Bind(&DestroyShellSurface, base::Unretained(&shell_surface))); |
117 shell_surface->Move(); | 117 shell_surface->Move(); |
118 } | 118 } |
119 | 119 |
| 120 TEST_F(ShellSurfaceTest, SetGeometry) { |
| 121 gfx::Size buffer_size(64, 64); |
| 122 scoped_ptr<Buffer> buffer(new Buffer( |
| 123 exo_test_helper()->CreateGpuMemoryBuffer(buffer_size), GL_TEXTURE_2D)); |
| 124 scoped_ptr<Surface> surface(new Surface); |
| 125 scoped_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); |
| 126 |
| 127 shell_surface->SetToplevel(); |
| 128 gfx::Rect geometry(16, 16, 32, 32); |
| 129 shell_surface->SetGeometry(geometry); |
| 130 surface->Attach(buffer.get()); |
| 131 surface->Commit(); |
| 132 EXPECT_EQ( |
| 133 geometry.size().ToString(), |
| 134 shell_surface->GetWidget()->GetWindowBoundsInScreen().size().ToString()); |
| 135 EXPECT_EQ(gfx::Rect(gfx::Point() - geometry.OffsetFromOrigin(), buffer_size) |
| 136 .ToString(), |
| 137 surface->bounds().ToString()); |
| 138 } |
| 139 |
120 } // namespace | 140 } // namespace |
121 } // namespace exo | 141 } // namespace exo |
OLD | NEW |