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 "ash/shell.h" | 5 #include "ash/shell.h" |
6 #include "components/exo/buffer.h" | 6 #include "components/exo/buffer.h" |
7 #include "components/exo/pointer.h" | 7 #include "components/exo/pointer.h" |
8 #include "components/exo/pointer_delegate.h" | 8 #include "components/exo/pointer_delegate.h" |
9 #include "components/exo/shell_surface.h" | 9 #include "components/exo/shell_surface.h" |
10 #include "components/exo/surface.h" | 10 #include "components/exo/surface.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(surface.get())) | 100 EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(surface.get())) |
101 .WillRepeatedly(testing::Return(true)); | 101 .WillRepeatedly(testing::Return(true)); |
102 EXPECT_CALL(delegate, OnPointerEnter(surface.get(), gfx::Point(), 0)); | 102 EXPECT_CALL(delegate, OnPointerEnter(surface.get(), gfx::Point(), 0)); |
103 generator.MoveMouseTo(surface->GetBoundsInScreen().origin()); | 103 generator.MoveMouseTo(surface->GetBoundsInScreen().origin()); |
104 | 104 |
105 EXPECT_CALL(delegate, OnPointerMotion(testing::_, gfx::Point(1, 1))); | 105 EXPECT_CALL(delegate, OnPointerMotion(testing::_, gfx::Point(1, 1))); |
106 generator.MoveMouseTo(surface->GetBoundsInScreen().origin() + | 106 generator.MoveMouseTo(surface->GetBoundsInScreen().origin() + |
107 gfx::Vector2d(1, 1)); | 107 gfx::Vector2d(1, 1)); |
108 | 108 |
| 109 scoped_ptr<Surface> sub_surface(new Surface); |
| 110 surface->AddSubSurface(sub_surface.get()); |
| 111 surface->SetSubSurfacePosition(sub_surface.get(), gfx::Point(5, 5)); |
| 112 gfx::Size sub_buffer_size(5, 5); |
| 113 scoped_ptr<Buffer> sub_buffer( |
| 114 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(sub_buffer_size), |
| 115 GL_TEXTURE_2D)); |
| 116 sub_surface->Attach(sub_buffer.get()); |
| 117 sub_surface->Commit(); |
| 118 surface->Commit(); |
| 119 |
| 120 EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(sub_surface.get())) |
| 121 .WillRepeatedly(testing::Return(true)); |
| 122 EXPECT_CALL(delegate, OnPointerLeave(surface.get())); |
| 123 EXPECT_CALL(delegate, OnPointerEnter(sub_surface.get(), gfx::Point(), 0)); |
| 124 generator.MoveMouseTo(sub_surface->GetBoundsInScreen().origin()); |
| 125 |
| 126 EXPECT_CALL(delegate, OnPointerMotion(testing::_, gfx::Point(1, 1))); |
| 127 generator.MoveMouseTo(sub_surface->GetBoundsInScreen().origin() + |
| 128 gfx::Vector2d(1, 1)); |
| 129 |
109 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get())); | 130 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get())); |
110 pointer.reset(); | 131 pointer.reset(); |
111 } | 132 } |
112 | 133 |
113 TEST_F(PointerTest, OnPointerButton) { | 134 TEST_F(PointerTest, OnPointerButton) { |
114 scoped_ptr<Surface> surface(new Surface); | 135 scoped_ptr<Surface> surface(new Surface); |
115 scoped_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); | 136 scoped_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); |
116 shell_surface->Init(); | 137 shell_surface->Init(); |
117 gfx::Size buffer_size(10, 10); | 138 gfx::Size buffer_size(10, 10); |
118 scoped_ptr<Buffer> buffer(new Buffer( | 139 scoped_ptr<Buffer> buffer(new Buffer( |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 1 /* y_offset */, 1 /* x_offset_ordinal */, | 212 1 /* y_offset */, 1 /* x_offset_ordinal */, |
192 1 /* y_offset_ordinal */, 1 /* finger_count */); | 213 1 /* y_offset_ordinal */, 1 /* finger_count */); |
193 generator.Dispatch(&scroll_event); | 214 generator.Dispatch(&scroll_event); |
194 | 215 |
195 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get())); | 216 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get())); |
196 pointer.reset(); | 217 pointer.reset(); |
197 } | 218 } |
198 | 219 |
199 } // namespace | 220 } // namespace |
200 } // namespace exo | 221 } // namespace exo |
OLD | NEW |