Merge lp:~alan-griffiths/mir/migrate-tests-to-miral into lp:mir
- migrate-tests-to-miral
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Gerry Boland |
Approved revision: | no longer in the source branch. |
Merged at revision: | 4266 |
Proposed branch: | lp:~alan-griffiths/mir/migrate-tests-to-miral |
Merge into: | lp:mir |
Diff against target: |
488 lines (+63/-220) 8 files modified
include/test/mir_test_framework/declarative_placement_window_manage_policy.h (+8/-9) tests/acceptance-tests/CMakeLists.txt (+0/-1) tests/acceptance-tests/client_mediated_user_gestures.cpp (+20/-19) tests/acceptance-tests/test_client_cursor_api.cpp (+1/-11) tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp (+0/-143) tests/mir_test_framework/CMakeLists.txt (+4/-4) tests/mir_test_framework/declarative_placement_window_manage_policy.cpp (+11/-11) tests/miral/client_mediated_gestures.cpp (+19/-22) |
To merge this branch: | bzr merge lp:~alan-griffiths/mir/migrate-tests-to-miral |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Approve | |
Gerry Boland (community) | Approve | ||
Review via email: mp+331255@code.launchpad.net |
Commit message
Migrate more tests away from legacy implementation
Description of the change
Mir CI Bot (mir-ci-bot) wrote : | # |
Alan Griffiths (alan-griffiths) wrote : | # |
ClientLatency.
Real time for tests is an issue in our CI infrastructure.
Alan Griffiths (alan-griffiths) wrote : | # |
> ClientLatency.
> similar to LP:1640366
>
> Real time for tests is an issue in our CI infrastructure.
Oops! wrong tab.
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:4269
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'include/test/mir_test_framework/declarative_placement_window_manage_policy.h' | |||
2 | --- include/test/mir_test_framework/declarative_placement_window_manage_policy.h 2017-07-28 17:00:43 +0000 | |||
3 | +++ include/test/mir_test_framework/declarative_placement_window_manage_policy.h 2017-09-25 13:41:00 +0000 | |||
4 | @@ -19,7 +19,7 @@ | |||
5 | 19 | #ifndef MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_WINDOW_MANAGER_POLICY_H_ | 19 | #ifndef MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_WINDOW_MANAGER_POLICY_H_ |
6 | 20 | #define MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_WINDOW_MANAGER_POLICY_H_ | 20 | #define MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_WINDOW_MANAGER_POLICY_H_ |
7 | 21 | 21 | ||
9 | 22 | #include "mir/shell/canonical_window_manager.h" | 22 | #include "mir_test_framework/canonical_window_manager_policy.h" |
10 | 23 | #include "mir/geometry/rectangle.h" | 23 | #include "mir/geometry/rectangle.h" |
11 | 24 | 24 | ||
12 | 25 | #include <memory> | 25 | #include <memory> |
13 | @@ -34,18 +34,17 @@ | |||
14 | 34 | /// a static list of surface geometries and relative depths. Used, for example, | 34 | /// a static list of surface geometries and relative depths. Used, for example, |
15 | 35 | /// in input tests where it is necessary to set up scenarios depending on | 35 | /// in input tests where it is necessary to set up scenarios depending on |
16 | 36 | /// multiple surfaces geometry and stacking. | 36 | /// multiple surfaces geometry and stacking. |
18 | 37 | class DeclarativePlacementWindowManagerPolicy : public mir::shell::CanonicalWindowManagerPolicy | 37 | class DeclarativePlacementWindowManagerPolicy : public mir_test_framework::CanonicalWindowManagerPolicy |
19 | 38 | { | 38 | { |
20 | 39 | public: | 39 | public: |
21 | 40 | DeclarativePlacementWindowManagerPolicy( | 40 | DeclarativePlacementWindowManagerPolicy( |
25 | 41 | mir::shell::WindowManagerTools* const tools, | 41 | miral::WindowManagerTools const& tools, |
26 | 42 | SurfaceGeometries const& positions_by_name, | 42 | SurfaceGeometries const& positions_by_name); |
24 | 43 | std::shared_ptr<mir::shell::DisplayLayout> const& display_layout); | ||
27 | 44 | 43 | ||
32 | 45 | auto handle_place_new_surface( | 44 | virtual auto place_new_window( |
33 | 46 | std::shared_ptr<mir::scene::Session> const& session, | 45 | miral::ApplicationInfo const& app_info, |
34 | 47 | mir::scene::SurfaceCreationParameters const& request_parameters) | 46 | miral::WindowSpecification const& request_parameters) |
35 | 48 | -> mir::scene::SurfaceCreationParameters; | 47 | -> miral::WindowSpecification override; |
36 | 49 | 48 | ||
37 | 50 | private: | 49 | private: |
38 | 51 | SurfaceGeometries const& surface_geometries_by_name; | 50 | SurfaceGeometries const& surface_geometries_by_name; |
39 | 52 | 51 | ||
40 | === modified file 'tests/acceptance-tests/CMakeLists.txt' | |||
41 | --- tests/acceptance-tests/CMakeLists.txt 2017-06-01 13:04:37 +0000 | |||
42 | +++ tests/acceptance-tests/CMakeLists.txt 2017-09-25 13:41:00 +0000 | |||
43 | @@ -62,7 +62,6 @@ | |||
44 | 62 | test_client_extensions.cpp | 62 | test_client_extensions.cpp |
45 | 63 | test_client_cursor_api.cpp | 63 | test_client_cursor_api.cpp |
46 | 64 | test_client_library_errors.cpp | 64 | test_client_library_errors.cpp |
47 | 65 | test_shell_control_of_surface_configuration.cpp | ||
48 | 66 | test_client_library.cpp | 65 | test_client_library.cpp |
49 | 67 | test_presentation_chain.cpp | 66 | test_presentation_chain.cpp |
50 | 68 | test_render_surface.cpp | 67 | test_render_surface.cpp |
51 | 69 | 68 | ||
52 | === modified file 'tests/acceptance-tests/client_mediated_user_gestures.cpp' | |||
53 | --- tests/acceptance-tests/client_mediated_user_gestures.cpp 2017-07-28 17:00:43 +0000 | |||
54 | +++ tests/acceptance-tests/client_mediated_user_gestures.cpp 2017-09-25 13:41:00 +0000 | |||
55 | @@ -19,12 +19,13 @@ | |||
56 | 19 | #include <mir_toolkit/mir_window.h> | 19 | #include <mir_toolkit/mir_window.h> |
57 | 20 | #include <mir_toolkit/mir_blob.h> | 20 | #include <mir_toolkit/mir_blob.h> |
58 | 21 | 21 | ||
59 | 22 | #include <miral/window_management_policy_addendum2.h> | ||
60 | 23 | |||
61 | 22 | #include <mir/geometry/displacement.h> | 24 | #include <mir/geometry/displacement.h> |
62 | 23 | #include <mir/input/input_device_info.h> | 25 | #include <mir/input/input_device_info.h> |
63 | 24 | #include <mir/input/device_capability.h> | 26 | #include <mir/input/device_capability.h> |
64 | 25 | #include <mir/shell/canonical_window_manager.h> | ||
65 | 26 | #include <mir/shell/shell.h> | ||
66 | 27 | 27 | ||
67 | 28 | #include <mir_test_framework/canonical_window_manager_policy.h> | ||
68 | 28 | #include <mir_test_framework/connected_client_with_a_window.h> | 29 | #include <mir_test_framework/connected_client_with_a_window.h> |
69 | 29 | #include <mir_test_framework/fake_input_device.h> | 30 | #include <mir_test_framework/fake_input_device.h> |
70 | 30 | #include <mir_test_framework/stub_server_platform_factory.h> | 31 | #include <mir_test_framework/stub_server_platform_factory.h> |
71 | @@ -70,16 +71,20 @@ | |||
72 | 70 | 71 | ||
73 | 71 | void mir_cookie_release(Cookie const&) = delete; | 72 | void mir_cookie_release(Cookie const&) = delete; |
74 | 72 | 73 | ||
78 | 73 | #pragma GCC diagnostic push | 74 | struct MockWindowManagementPolicy : mir_test_framework::CanonicalWindowManagerPolicy, |
79 | 74 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | 75 | miral::WindowManagementPolicyAddendum2 |
77 | 75 | struct MockWindowManager : mir::shell::CanonicalWindowManager | ||
80 | 76 | { | 76 | { |
82 | 77 | using mir::shell::CanonicalWindowManager::CanonicalWindowManager; | 77 | MockWindowManagementPolicy( |
83 | 78 | miral::WindowManagerTools const& tools, | ||
84 | 79 | MockWindowManagementPolicy*& self) : | ||
85 | 80 | mir_test_framework::CanonicalWindowManagerPolicy(tools) | ||
86 | 81 | { | ||
87 | 82 | self = this; | ||
88 | 83 | } | ||
89 | 78 | 84 | ||
92 | 79 | MOCK_METHOD3(handle_request_move, | 85 | MOCK_METHOD2(handle_request_move, void(miral::WindowInfo&, MirInputEvent const*)); |
93 | 80 | void(std::shared_ptr<mir::scene::Session> const&, std::shared_ptr<mir::scene::Surface> const&, uint64_t)); | 86 | MOCK_METHOD1(handle_request_drag_and_drop, void(miral::WindowInfo&)); |
94 | 81 | }; | 87 | }; |
95 | 82 | #pragma GCC diagnostic pop | ||
96 | 83 | 88 | ||
97 | 84 | struct MouseMoverAndFaker | 89 | struct MouseMoverAndFaker |
98 | 85 | { | 90 | { |
99 | @@ -117,13 +122,10 @@ | |||
100 | 117 | void SetUp() override | 122 | void SetUp() override |
101 | 118 | { | 123 | { |
102 | 119 | initial_display_layout({screen_geometry}); | 124 | initial_display_layout({screen_geometry}); |
109 | 120 | server.override_the_window_manager_builder([this](mir::shell::FocusController* focus_controller) | 125 | override_window_management_policy<MockWindowManagementPolicy>(mock_wm_policy); |
104 | 121 | { | ||
105 | 122 | return window_manager = | ||
106 | 123 | std::make_shared<MockWindowManager>(focus_controller, server.the_shell_display_layout()); | ||
107 | 124 | }); | ||
108 | 125 | |||
110 | 126 | mir_test_framework::ConnectedClientWithAWindow::SetUp(); | 126 | mir_test_framework::ConnectedClientWithAWindow::SetUp(); |
111 | 127 | ASSERT_THAT(mock_wm_policy, NotNull()); | ||
112 | 128 | |||
113 | 127 | mir_window_set_event_handler(window, &window_event_handler, this); | 129 | mir_window_set_event_handler(window, &window_event_handler, this); |
114 | 128 | 130 | ||
115 | 129 | paint_window(); | 131 | paint_window(); |
116 | @@ -134,13 +136,12 @@ | |||
117 | 134 | void TearDown() override | 136 | void TearDown() override |
118 | 135 | { | 137 | { |
119 | 136 | reset_window_event_handler(); | 138 | reset_window_event_handler(); |
120 | 137 | window_manager.reset(); | ||
121 | 138 | mir_test_framework::ConnectedClientWithAWindow::TearDown(); | 139 | mir_test_framework::ConnectedClientWithAWindow::TearDown(); |
122 | 139 | } | 140 | } |
123 | 140 | 141 | ||
124 | 141 | auto user_initiates_gesture() -> Cookie; | 142 | auto user_initiates_gesture() -> Cookie; |
125 | 142 | 143 | ||
127 | 143 | std::shared_ptr<MockWindowManager> window_manager; | 144 | MockWindowManagementPolicy* mock_wm_policy = 0; |
128 | 144 | 145 | ||
129 | 145 | private: | 146 | private: |
130 | 146 | void center_mouse(); | 147 | void center_mouse(); |
131 | @@ -197,7 +198,7 @@ | |||
132 | 197 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | 198 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
133 | 198 | mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(window)); | 199 | mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(window)); |
134 | 199 | #pragma GCC diagnostic pop | 200 | #pragma GCC diagnostic pop |
136 | 200 | 201 | ||
137 | 201 | EXPECT_THAT(have_focus.wait_for(receive_event_timeout), Eq(true)); | 202 | EXPECT_THAT(have_focus.wait_for(receive_event_timeout), Eq(true)); |
138 | 202 | 203 | ||
139 | 203 | reset_window_event_handler(); | 204 | reset_window_event_handler(); |
140 | @@ -280,7 +281,7 @@ | |||
141 | 280 | { | 281 | { |
142 | 281 | auto const cookie = user_initiates_gesture(); | 282 | auto const cookie = user_initiates_gesture(); |
143 | 282 | Signal have_request; | 283 | Signal have_request; |
145 | 283 | EXPECT_CALL(*window_manager, handle_request_move(_, _, _)).WillOnce(InvokeWithoutArgs([&]{ have_request.raise(); })); | 284 | EXPECT_CALL(*mock_wm_policy, handle_request_move(_, _)).WillOnce(InvokeWithoutArgs([&]{ have_request.raise(); })); |
146 | 284 | 285 | ||
147 | 285 | mir_window_request_user_move(window, cookie); | 286 | mir_window_request_user_move(window, cookie); |
148 | 286 | 287 | ||
149 | 287 | 288 | ||
150 | === modified file 'tests/acceptance-tests/test_client_cursor_api.cpp' | |||
151 | --- tests/acceptance-tests/test_client_cursor_api.cpp 2017-07-28 17:00:43 +0000 | |||
152 | +++ tests/acceptance-tests/test_client_cursor_api.cpp 2017-09-25 13:41:00 +0000 | |||
153 | @@ -456,17 +456,7 @@ | |||
154 | 456 | 456 | ||
155 | 457 | server.override_the_cursor_images([]() { return std::make_shared<NamedCursorImages>(); }); | 457 | server.override_the_cursor_images([]() { return std::make_shared<NamedCursorImages>(); }); |
156 | 458 | 458 | ||
168 | 459 | server.override_the_window_manager_builder([this](msh::FocusController* focus_controller) | 459 | override_window_management_policy<mtf::DeclarativePlacementWindowManagerPolicy>(client_geometries); |
158 | 460 | { | ||
159 | 461 | #pragma GCC diagnostic push | ||
160 | 462 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | ||
161 | 463 | using PlacementWindowManager = msh::WindowManagerConstructor<mtf::DeclarativePlacementWindowManagerPolicy>; | ||
162 | 464 | return std::make_shared<PlacementWindowManager>( | ||
163 | 465 | focus_controller, | ||
164 | 466 | client_geometries, | ||
165 | 467 | server.the_shell_display_layout()); | ||
166 | 468 | #pragma GCC diagnostic pop | ||
167 | 469 | }); | ||
169 | 470 | 460 | ||
170 | 471 | server.wrap_shell([&, this](auto const& wrapped) | 461 | server.wrap_shell([&, this](auto const& wrapped) |
171 | 472 | { | 462 | { |
172 | 473 | 463 | ||
173 | === removed file 'tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp' | |||
174 | --- tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp 2017-07-28 17:00:43 +0000 | |||
175 | +++ tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp 1970-01-01 00:00:00 +0000 | |||
176 | @@ -1,143 +0,0 @@ | |||
177 | 1 | /* | ||
178 | 2 | * Copyright © 2013-2015 Canonical Ltd. | ||
179 | 3 | * | ||
180 | 4 | * This program is free software: you can redistribute it and/or modify | ||
181 | 5 | * it under the terms of the GNU General Public License version 2 or 3 as | ||
182 | 6 | * published by the Free Software Foundation. | ||
183 | 7 | * | ||
184 | 8 | * This program is distributed in the hope that it will be useful, | ||
185 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
186 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
187 | 11 | * GNU General Public License for more details. | ||
188 | 12 | * | ||
189 | 13 | * You should have received a copy of the GNU General Public License | ||
190 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
191 | 15 | * | ||
192 | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> | ||
193 | 17 | */ | ||
194 | 18 | |||
195 | 19 | #include "mir/scene/surface.h" | ||
196 | 20 | |||
197 | 21 | #include "mir_test_framework/connected_client_with_a_window.h" | ||
198 | 22 | |||
199 | 23 | #include "mir/shell/canonical_window_manager.h" | ||
200 | 24 | |||
201 | 25 | #include "mir_toolkit/mir_client_library.h" | ||
202 | 26 | |||
203 | 27 | #include <gtest/gtest.h> | ||
204 | 28 | #include <gmock/gmock.h> | ||
205 | 29 | #include <mir/test/signal.h> | ||
206 | 30 | |||
207 | 31 | namespace ms = mir::scene; | ||
208 | 32 | namespace msh = mir::shell; | ||
209 | 33 | |||
210 | 34 | namespace mt = mir::test; | ||
211 | 35 | namespace mtf = mir_test_framework; | ||
212 | 36 | using namespace ::testing; | ||
213 | 37 | |||
214 | 38 | using namespace std::literals::chrono_literals; | ||
215 | 39 | |||
216 | 40 | namespace | ||
217 | 41 | { | ||
218 | 42 | #pragma GCC diagnostic push | ||
219 | 43 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | ||
220 | 44 | struct MockWindowManager : msh::CanonicalWindowManager | ||
221 | 45 | { | ||
222 | 46 | using msh::CanonicalWindowManager::CanonicalWindowManager; | ||
223 | 47 | |||
224 | 48 | MOCK_METHOD4(set_surface_attribute, | ||
225 | 49 | int(std::shared_ptr<ms::Session> const& session, | ||
226 | 50 | std::shared_ptr<ms::Surface> const& surface, | ||
227 | 51 | MirWindowAttrib attrib, | ||
228 | 52 | int value)); | ||
229 | 53 | |||
230 | 54 | int real_set_surface_attribute(std::shared_ptr<ms::Session> const& session, | ||
231 | 55 | std::shared_ptr<ms::Surface> const& surface, | ||
232 | 56 | MirWindowAttrib attrib, | ||
233 | 57 | int value) | ||
234 | 58 | { | ||
235 | 59 | return msh::CanonicalWindowManager::set_surface_attribute(session, surface, attrib, value); | ||
236 | 60 | } | ||
237 | 61 | }; | ||
238 | 62 | #pragma GCC diagnostic pop | ||
239 | 63 | |||
240 | 64 | void signal_state_change(MirWindow*, MirEvent const* event, void* context) | ||
241 | 65 | { | ||
242 | 66 | if (mir_event_get_type(event) != mir_event_type_window) | ||
243 | 67 | return; | ||
244 | 68 | |||
245 | 69 | auto const window_event = mir_event_get_window_event(event); | ||
246 | 70 | |||
247 | 71 | if (mir_window_event_get_attribute(window_event) != mir_window_attrib_state) | ||
248 | 72 | return; | ||
249 | 73 | |||
250 | 74 | static_cast<mt::Signal*>(context)->raise(); | ||
251 | 75 | } | ||
252 | 76 | |||
253 | 77 | struct ShellSurfaceConfiguration : mtf::ConnectedClientWithAWindow | ||
254 | 78 | { | ||
255 | 79 | void SetUp() override | ||
256 | 80 | { | ||
257 | 81 | server.override_the_window_manager_builder([this] | ||
258 | 82 | (msh::FocusController* focus_controller) -> std::shared_ptr<msh::WindowManager> | ||
259 | 83 | { | ||
260 | 84 | mock_window_manager = std::make_shared<MockWindowManager>( | ||
261 | 85 | focus_controller, | ||
262 | 86 | server.the_shell_display_layout()); | ||
263 | 87 | |||
264 | 88 | ON_CALL(*mock_window_manager, set_surface_attribute(_, _, _, _)) | ||
265 | 89 | .WillByDefault(Invoke( | ||
266 | 90 | mock_window_manager.get(), &MockWindowManager::real_set_surface_attribute)); | ||
267 | 91 | |||
268 | 92 | EXPECT_CALL(*mock_window_manager, | ||
269 | 93 | set_surface_attribute(_, _, Ne(mir_window_attrib_state), _)) | ||
270 | 94 | .Times(AnyNumber()); | ||
271 | 95 | |||
272 | 96 | return mock_window_manager; | ||
273 | 97 | }); | ||
274 | 98 | |||
275 | 99 | mtf::ConnectedClientWithAWindow::SetUp(); | ||
276 | 100 | |||
277 | 101 | auto const spec = mir_create_window_spec(connection); | ||
278 | 102 | mir_window_spec_set_event_handler(spec, &signal_state_change, &received); | ||
279 | 103 | mir_window_apply_spec(window, spec); | ||
280 | 104 | mir_window_spec_release(spec); | ||
281 | 105 | } | ||
282 | 106 | |||
283 | 107 | std::shared_ptr<MockWindowManager> mock_window_manager; | ||
284 | 108 | mt::Signal received; | ||
285 | 109 | }; | ||
286 | 110 | } | ||
287 | 111 | |||
288 | 112 | TEST_F(ShellSurfaceConfiguration, the_window_manager_is_notified_of_attribute_changes) | ||
289 | 113 | { | ||
290 | 114 | EXPECT_CALL(*mock_window_manager, | ||
291 | 115 | set_surface_attribute(_, _, mir_window_attrib_state, Eq(mir_window_state_maximized))); | ||
292 | 116 | |||
293 | 117 | mir_window_set_state(window, mir_window_state_maximized); | ||
294 | 118 | |||
295 | 119 | EXPECT_TRUE(received.wait_for(400ms)); | ||
296 | 120 | EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_maximized)); | ||
297 | 121 | } | ||
298 | 122 | |||
299 | 123 | TEST_F(ShellSurfaceConfiguration, the_window_manager_may_interfere_with_attribute_changes) | ||
300 | 124 | { | ||
301 | 125 | auto const set_to_vertmax = [this]( | ||
302 | 126 | std::shared_ptr<ms::Session> const& session, | ||
303 | 127 | std::shared_ptr<ms::Surface> const& surface, | ||
304 | 128 | MirWindowAttrib attrib, | ||
305 | 129 | int /*value*/) | ||
306 | 130 | { | ||
307 | 131 | return mock_window_manager->real_set_surface_attribute( | ||
308 | 132 | session, surface, attrib, mir_window_state_vertmaximized); | ||
309 | 133 | }; | ||
310 | 134 | |||
311 | 135 | EXPECT_CALL(*mock_window_manager, | ||
312 | 136 | set_surface_attribute(_, _, mir_window_attrib_state, Eq(mir_window_state_maximized))) | ||
313 | 137 | .WillOnce(Invoke(set_to_vertmax)); | ||
314 | 138 | |||
315 | 139 | mir_window_set_state(window, mir_window_state_maximized); | ||
316 | 140 | |||
317 | 141 | EXPECT_TRUE(received.wait_for(400ms)); | ||
318 | 142 | EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_vertmaximized)); | ||
319 | 143 | } | ||
320 | 144 | 0 | ||
321 | === renamed directory 'include/test/mir/shell' => 'tests/include/mir/shell' | |||
322 | === modified file 'tests/mir_test_framework/CMakeLists.txt' | |||
323 | --- tests/mir_test_framework/CMakeLists.txt 2017-09-07 05:58:13 +0000 | |||
324 | +++ tests/mir_test_framework/CMakeLists.txt 2017-09-25 13:41:00 +0000 | |||
325 | @@ -58,8 +58,8 @@ | |||
326 | 58 | visible_surface.cpp | 58 | visible_surface.cpp |
327 | 59 | stub_client_platform_options.cpp | 59 | stub_client_platform_options.cpp |
328 | 60 | ${PROJECT_SOURCE_DIR}/include/test/mir_test_framework/stub_client_platform_options.h | 60 | ${PROJECT_SOURCE_DIR}/include/test/mir_test_framework/stub_client_platform_options.h |
331 | 61 | basic_window_manager.cpp ${PROJECT_SOURCE_DIR}/include/test/mir/shell/basic_window_manager.h | 61 | basic_window_manager.cpp ${PROJECT_SOURCE_DIR}/tests/include/mir/shell/basic_window_manager.h |
332 | 62 | canonical_window_manager.cpp ${PROJECT_SOURCE_DIR}/include/test/mir/shell/canonical_window_manager.h | 62 | canonical_window_manager.cpp ${PROJECT_SOURCE_DIR}/tests/include/mir/shell/canonical_window_manager.h |
333 | 63 | ) | 63 | ) |
334 | 64 | 64 | ||
335 | 65 | # Umockdev uses glib, which uses the deprecated "register" storage qualifier | 65 | # Umockdev uses glib, which uses the deprecated "register" storage qualifier |
336 | @@ -120,7 +120,7 @@ | |||
337 | 120 | 120 | ||
338 | 121 | add_library( | 121 | add_library( |
339 | 122 | mir-test-input-framework OBJECT | 122 | mir-test-input-framework OBJECT |
341 | 123 | 123 | ||
342 | 124 | stub_input.cpp | 124 | stub_input.cpp |
343 | 125 | fake_input_device_impl.cpp | 125 | fake_input_device_impl.cpp |
344 | 126 | stub_input_platform.cpp | 126 | stub_input_platform.cpp |
345 | @@ -177,7 +177,7 @@ | |||
346 | 177 | ) | 177 | ) |
347 | 178 | 178 | ||
348 | 179 | target_link_libraries( | 179 | target_link_libraries( |
350 | 180 | mirplatformgraphicsthrow | 180 | mirplatformgraphicsthrow |
351 | 181 | 181 | ||
352 | 182 | mirplatform | 182 | mirplatform |
353 | 183 | ) | 183 | ) |
354 | 184 | 184 | ||
355 | === modified file 'tests/mir_test_framework/declarative_placement_window_manage_policy.cpp' | |||
356 | --- tests/mir_test_framework/declarative_placement_window_manage_policy.cpp 2017-07-28 17:00:43 +0000 | |||
357 | +++ tests/mir_test_framework/declarative_placement_window_manage_policy.cpp 2017-09-25 13:41:00 +0000 | |||
358 | @@ -24,27 +24,27 @@ | |||
359 | 24 | namespace mtf = mir_test_framework; | 24 | namespace mtf = mir_test_framework; |
360 | 25 | 25 | ||
361 | 26 | mtf::DeclarativePlacementWindowManagerPolicy::DeclarativePlacementWindowManagerPolicy( | 26 | mtf::DeclarativePlacementWindowManagerPolicy::DeclarativePlacementWindowManagerPolicy( |
366 | 27 | mir::shell::WindowManagerTools* const tools, | 27 | miral::WindowManagerTools const& tools, |
367 | 28 | SurfaceGeometries const& positions_by_name, | 28 | SurfaceGeometries const& positions_by_name) : |
368 | 29 | std::shared_ptr<mir::shell::DisplayLayout> const& display_layout) : | 29 | mir_test_framework::CanonicalWindowManagerPolicy{tools}, |
365 | 30 | mir::shell::CanonicalWindowManagerPolicy{tools, display_layout}, | ||
369 | 31 | surface_geometries_by_name{positions_by_name} | 30 | surface_geometries_by_name{positions_by_name} |
370 | 32 | { | 31 | { |
371 | 33 | } | 32 | } |
372 | 34 | 33 | ||
376 | 35 | ms::SurfaceCreationParameters mtf::DeclarativePlacementWindowManagerPolicy::handle_place_new_surface( | 34 | auto mtf::DeclarativePlacementWindowManagerPolicy::place_new_window( |
377 | 36 | std::shared_ptr<mir::scene::Session> const& /*session*/, | 35 | miral::ApplicationInfo const& /*app_info*/, |
378 | 37 | ms::SurfaceCreationParameters const& request_parameters) | 36 | miral::WindowSpecification const& request_parameters) |
379 | 37 | -> miral::WindowSpecification | ||
380 | 38 | { | 38 | { |
381 | 39 | auto placed = request_parameters; | 39 | auto placed = request_parameters; |
382 | 40 | 40 | ||
385 | 41 | auto const& name = request_parameters.name; | 41 | auto const& name = request_parameters.name().value(); |
386 | 42 | 42 | ||
387 | 43 | if (surface_geometries_by_name.find(name) != surface_geometries_by_name.end()) | 43 | if (surface_geometries_by_name.find(name) != surface_geometries_by_name.end()) |
388 | 44 | { | 44 | { |
389 | 45 | auto const& geometry = surface_geometries_by_name.at(name); | 45 | auto const& geometry = surface_geometries_by_name.at(name); |
392 | 46 | placed.top_left = geometry.top_left; | 46 | placed.top_left() = geometry.top_left; |
393 | 47 | placed.size = geometry.size; | 47 | placed.size() = geometry.size; |
394 | 48 | } | 48 | } |
395 | 49 | 49 | ||
396 | 50 | return placed; | 50 | return placed; |
397 | 51 | 51 | ||
398 | === modified file 'tests/miral/client_mediated_gestures.cpp' | |||
399 | --- tests/miral/client_mediated_gestures.cpp 2017-08-24 15:12:39 +0000 | |||
400 | +++ tests/miral/client_mediated_gestures.cpp 2017-09-25 13:41:00 +0000 | |||
401 | @@ -22,12 +22,13 @@ | |||
402 | 22 | #include <mir_toolkit/mir_window.h> | 22 | #include <mir_toolkit/mir_window.h> |
403 | 23 | #include <mir_toolkit/mir_blob.h> | 23 | #include <mir_toolkit/mir_blob.h> |
404 | 24 | 24 | ||
405 | 25 | #include <miral/window_management_policy_addendum2.h> | ||
406 | 26 | |||
407 | 25 | #include <mir/geometry/displacement.h> | 27 | #include <mir/geometry/displacement.h> |
408 | 26 | #include <mir/input/input_device_info.h> | 28 | #include <mir/input/input_device_info.h> |
409 | 27 | #include <mir/input/device_capability.h> | 29 | #include <mir/input/device_capability.h> |
410 | 28 | #include <mir/shell/canonical_window_manager.h> | ||
411 | 29 | #include <mir/shell/shell.h> | ||
412 | 30 | 30 | ||
413 | 31 | #include <mir_test_framework/canonical_window_manager_policy.h> | ||
414 | 31 | #include <mir_test_framework/connected_client_with_a_window.h> | 32 | #include <mir_test_framework/connected_client_with_a_window.h> |
415 | 32 | #include <mir_test_framework/fake_input_device.h> | 33 | #include <mir_test_framework/fake_input_device.h> |
416 | 33 | #include <mir_test_framework/stub_server_platform_factory.h> | 34 | #include <mir_test_framework/stub_server_platform_factory.h> |
417 | @@ -73,19 +74,19 @@ | |||
418 | 73 | 74 | ||
419 | 74 | void mir_cookie_release(Cookie const&) = delete; | 75 | void mir_cookie_release(Cookie const&) = delete; |
420 | 75 | 76 | ||
422 | 76 | struct MockWindowManager : mir::shell::CanonicalWindowManager | 77 | struct MockWindowManagementPolicy : mir_test_framework::CanonicalWindowManagerPolicy, |
423 | 78 | miral::WindowManagementPolicyAddendum2 | ||
424 | 77 | { | 79 | { |
433 | 78 | #if defined(__clang__) | 80 | MockWindowManagementPolicy( |
434 | 79 | #pragma GCC diagnostic push | 81 | miral::WindowManagerTools const& tools, |
435 | 80 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | 82 | MockWindowManagementPolicy*& self) : |
436 | 81 | #endif | 83 | mir_test_framework::CanonicalWindowManagerPolicy(tools) |
437 | 82 | using mir::shell::CanonicalWindowManager::CanonicalWindowManager; | 84 | { |
438 | 83 | #if defined(__clang__) | 85 | self = this; |
439 | 84 | #pragma GCC diagnostic pop | 86 | } |
432 | 85 | #endif | ||
440 | 86 | 87 | ||
443 | 87 | MOCK_METHOD3(handle_request_move, | 88 | MOCK_METHOD2(handle_request_move, void(miral::WindowInfo&, MirInputEvent const*)); |
444 | 88 | void(std::shared_ptr<mir::scene::Session> const&, std::shared_ptr<mir::scene::Surface> const&, uint64_t)); | 89 | MOCK_METHOD1(handle_request_drag_and_drop, void(miral::WindowInfo&)); |
445 | 89 | }; | 90 | }; |
446 | 90 | 91 | ||
447 | 91 | struct MouseMoverAndFaker | 92 | struct MouseMoverAndFaker |
448 | @@ -124,13 +125,10 @@ | |||
449 | 124 | void SetUp() override | 125 | void SetUp() override |
450 | 125 | { | 126 | { |
451 | 126 | initial_display_layout({screen_geometry}); | 127 | initial_display_layout({screen_geometry}); |
458 | 127 | server.override_the_window_manager_builder([this](mir::shell::FocusController* focus_controller) | 128 | override_window_management_policy<MockWindowManagementPolicy>(mock_wm_policy); |
453 | 128 | { | ||
454 | 129 | return window_manager = | ||
455 | 130 | std::make_shared<MockWindowManager>(focus_controller, server.the_shell_display_layout()); | ||
456 | 131 | }); | ||
457 | 132 | |||
459 | 133 | mir_test_framework::ConnectedClientWithAWindow::SetUp(); | 129 | mir_test_framework::ConnectedClientWithAWindow::SetUp(); |
460 | 130 | ASSERT_THAT(mock_wm_policy, NotNull()); | ||
461 | 131 | |||
462 | 134 | mir_window_set_event_handler(window, &window_event_handler, this); | 132 | mir_window_set_event_handler(window, &window_event_handler, this); |
463 | 135 | 133 | ||
464 | 136 | paint_window(); | 134 | paint_window(); |
465 | @@ -141,14 +139,13 @@ | |||
466 | 141 | void TearDown() override | 139 | void TearDown() override |
467 | 142 | { | 140 | { |
468 | 143 | reset_window_event_handler(); | 141 | reset_window_event_handler(); |
469 | 144 | window_manager.reset(); | ||
470 | 145 | surface.reset(); | 142 | surface.reset(); |
471 | 146 | mir_test_framework::ConnectedClientWithAWindow::TearDown(); | 143 | mir_test_framework::ConnectedClientWithAWindow::TearDown(); |
472 | 147 | } | 144 | } |
473 | 148 | 145 | ||
474 | 149 | auto user_initiates_gesture() -> Cookie; | 146 | auto user_initiates_gesture() -> Cookie; |
475 | 150 | 147 | ||
477 | 151 | std::shared_ptr<MockWindowManager> window_manager; | 148 | MockWindowManagementPolicy* mock_wm_policy = 0; |
478 | 152 | 149 | ||
479 | 153 | private: | 150 | private: |
480 | 154 | void center_mouse(); | 151 | void center_mouse(); |
481 | @@ -294,7 +291,7 @@ | |||
482 | 294 | { | 291 | { |
483 | 295 | auto const cookie = user_initiates_gesture(); | 292 | auto const cookie = user_initiates_gesture(); |
484 | 296 | Signal have_request; | 293 | Signal have_request; |
486 | 297 | EXPECT_CALL(*window_manager, handle_request_move(_, _, _)).WillOnce(InvokeWithoutArgs([&]{ have_request.raise(); })); | 294 | EXPECT_CALL(*mock_wm_policy, handle_request_move(_, _)).WillOnce(InvokeWithoutArgs([&]{ have_request.raise(); })); |
487 | 298 | 295 | ||
488 | 299 | mir_window_request_user_move(window, cookie); | 296 | mir_window_request_user_move(window, cookie); |
489 | 300 | 297 |
FAILED: Continuous integration, rev:4267 /mir-jenkins. ubuntu. com/job/ mir-ci/ 3681/ /mir-jenkins. ubuntu. com/job/ build-mir/ 5047/console /mir-jenkins. ubuntu. com/job/ build-0- fetch/5283 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= artful/ 5271 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial/ 5271 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= zesty/5271 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= artful/ 5090/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= zesty/5090/ console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= artful/ 5090/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial/ 5090/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= zesty/5090/ console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= mesa,release= artful/ 5090/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= mesa,release= zesty/5090/ console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial/ 5090/console
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 3681/rebuild
https:/