Mir

Merge lp:~alan-griffiths/mir/migrate-tests-to-miral into lp:mir

Proposed by Alan Griffiths
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
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

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4267
https://mir-jenkins.ubuntu.com/job/mir-ci/3681/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/5047/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5283
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5271
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5271
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5271
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5090/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5090/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5090/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5090/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5090/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5090/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5090/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5090/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3681/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

ClientLatency.async_swap_dropping_latency_is_closer_to_zero_than_one - sounds similar to LP:1640366

Real time for tests is an issue in our CI infrastructure.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> ClientLatency.async_swap_dropping_latency_is_closer_to_zero_than_one - sounds
> similar to LP:1640366
>
> Real time for tests is an issue in our CI infrastructure.

Oops! wrong tab.

Revision history for this message
Gerry Boland (gerboland) wrote :

Nais!

review: Approve
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4269
https://mir-jenkins.ubuntu.com/job/mir-ci/3683/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/5049
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5285
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5273
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5273
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5273
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5093
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5093/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5093
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5093/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5093
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5093/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5093
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5093/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5093
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5093/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5093
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5093/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5093
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5093/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5093
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5093/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3683/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
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 #ifndef MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_WINDOW_MANAGER_POLICY_H_
6 #define MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_WINDOW_MANAGER_POLICY_H_
7
8-#include "mir/shell/canonical_window_manager.h"
9+#include "mir_test_framework/canonical_window_manager_policy.h"
10 #include "mir/geometry/rectangle.h"
11
12 #include <memory>
13@@ -34,18 +34,17 @@
14 /// a static list of surface geometries and relative depths. Used, for example,
15 /// in input tests where it is necessary to set up scenarios depending on
16 /// multiple surfaces geometry and stacking.
17-class DeclarativePlacementWindowManagerPolicy : public mir::shell::CanonicalWindowManagerPolicy
18+class DeclarativePlacementWindowManagerPolicy : public mir_test_framework::CanonicalWindowManagerPolicy
19 {
20 public:
21 DeclarativePlacementWindowManagerPolicy(
22- mir::shell::WindowManagerTools* const tools,
23- SurfaceGeometries const& positions_by_name,
24- std::shared_ptr<mir::shell::DisplayLayout> const& display_layout);
25+ miral::WindowManagerTools const& tools,
26+ SurfaceGeometries const& positions_by_name);
27
28- auto handle_place_new_surface(
29- std::shared_ptr<mir::scene::Session> const& session,
30- mir::scene::SurfaceCreationParameters const& request_parameters)
31- -> mir::scene::SurfaceCreationParameters;
32+ virtual auto place_new_window(
33+ miral::ApplicationInfo const& app_info,
34+ miral::WindowSpecification const& request_parameters)
35+ -> miral::WindowSpecification override;
36
37 private:
38 SurfaceGeometries const& surface_geometries_by_name;
39
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 test_client_extensions.cpp
45 test_client_cursor_api.cpp
46 test_client_library_errors.cpp
47- test_shell_control_of_surface_configuration.cpp
48 test_client_library.cpp
49 test_presentation_chain.cpp
50 test_render_surface.cpp
51
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 #include <mir_toolkit/mir_window.h>
57 #include <mir_toolkit/mir_blob.h>
58
59+#include <miral/window_management_policy_addendum2.h>
60+
61 #include <mir/geometry/displacement.h>
62 #include <mir/input/input_device_info.h>
63 #include <mir/input/device_capability.h>
64-#include <mir/shell/canonical_window_manager.h>
65-#include <mir/shell/shell.h>
66
67+#include <mir_test_framework/canonical_window_manager_policy.h>
68 #include <mir_test_framework/connected_client_with_a_window.h>
69 #include <mir_test_framework/fake_input_device.h>
70 #include <mir_test_framework/stub_server_platform_factory.h>
71@@ -70,16 +71,20 @@
72
73 void mir_cookie_release(Cookie const&) = delete;
74
75-#pragma GCC diagnostic push
76-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
77-struct MockWindowManager : mir::shell::CanonicalWindowManager
78+struct MockWindowManagementPolicy : mir_test_framework::CanonicalWindowManagerPolicy,
79+ miral::WindowManagementPolicyAddendum2
80 {
81- using mir::shell::CanonicalWindowManager::CanonicalWindowManager;
82+ MockWindowManagementPolicy(
83+ miral::WindowManagerTools const& tools,
84+ MockWindowManagementPolicy*& self) :
85+ mir_test_framework::CanonicalWindowManagerPolicy(tools)
86+ {
87+ self = this;
88+ }
89
90- MOCK_METHOD3(handle_request_move,
91- void(std::shared_ptr<mir::scene::Session> const&, std::shared_ptr<mir::scene::Surface> const&, uint64_t));
92+ MOCK_METHOD2(handle_request_move, void(miral::WindowInfo&, MirInputEvent const*));
93+ MOCK_METHOD1(handle_request_drag_and_drop, void(miral::WindowInfo&));
94 };
95-#pragma GCC diagnostic pop
96
97 struct MouseMoverAndFaker
98 {
99@@ -117,13 +122,10 @@
100 void SetUp() override
101 {
102 initial_display_layout({screen_geometry});
103- server.override_the_window_manager_builder([this](mir::shell::FocusController* focus_controller)
104- {
105- return window_manager =
106- std::make_shared<MockWindowManager>(focus_controller, server.the_shell_display_layout());
107- });
108-
109+ override_window_management_policy<MockWindowManagementPolicy>(mock_wm_policy);
110 mir_test_framework::ConnectedClientWithAWindow::SetUp();
111+ ASSERT_THAT(mock_wm_policy, NotNull());
112+
113 mir_window_set_event_handler(window, &window_event_handler, this);
114
115 paint_window();
116@@ -134,13 +136,12 @@
117 void TearDown() override
118 {
119 reset_window_event_handler();
120- window_manager.reset();
121 mir_test_framework::ConnectedClientWithAWindow::TearDown();
122 }
123
124 auto user_initiates_gesture() -> Cookie;
125
126- std::shared_ptr<MockWindowManager> window_manager;
127+ MockWindowManagementPolicy* mock_wm_policy = 0;
128
129 private:
130 void center_mouse();
131@@ -197,7 +198,7 @@
132 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
133 mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(window));
134 #pragma GCC diagnostic pop
135-
136+
137 EXPECT_THAT(have_focus.wait_for(receive_event_timeout), Eq(true));
138
139 reset_window_event_handler();
140@@ -280,7 +281,7 @@
141 {
142 auto const cookie = user_initiates_gesture();
143 Signal have_request;
144- EXPECT_CALL(*window_manager, handle_request_move(_, _, _)).WillOnce(InvokeWithoutArgs([&]{ have_request.raise(); }));
145+ EXPECT_CALL(*mock_wm_policy, handle_request_move(_, _)).WillOnce(InvokeWithoutArgs([&]{ have_request.raise(); }));
146
147 mir_window_request_user_move(window, cookie);
148
149
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
155 server.override_the_cursor_images([]() { return std::make_shared<NamedCursorImages>(); });
156
157- server.override_the_window_manager_builder([this](msh::FocusController* focus_controller)
158- {
159-#pragma GCC diagnostic push
160-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
161- using PlacementWindowManager = msh::WindowManagerConstructor<mtf::DeclarativePlacementWindowManagerPolicy>;
162- return std::make_shared<PlacementWindowManager>(
163- focus_controller,
164- client_geometries,
165- server.the_shell_display_layout());
166-#pragma GCC diagnostic pop
167- });
168+ override_window_management_policy<mtf::DeclarativePlacementWindowManagerPolicy>(client_geometries);
169
170 server.wrap_shell([&, this](auto const& wrapped)
171 {
172
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-/*
178- * Copyright © 2013-2015 Canonical Ltd.
179- *
180- * This program is free software: you can redistribute it and/or modify
181- * it under the terms of the GNU General Public License version 2 or 3 as
182- * published by the Free Software Foundation.
183- *
184- * This program is distributed in the hope that it will be useful,
185- * but WITHOUT ANY WARRANTY; without even the implied warranty of
186- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
187- * GNU General Public License for more details.
188- *
189- * You should have received a copy of the GNU General Public License
190- * along with this program. If not, see <http://www.gnu.org/licenses/>.
191- *
192- * Authored by: Robert Carr <robert.carr@canonical.com>
193- */
194-
195-#include "mir/scene/surface.h"
196-
197-#include "mir_test_framework/connected_client_with_a_window.h"
198-
199-#include "mir/shell/canonical_window_manager.h"
200-
201-#include "mir_toolkit/mir_client_library.h"
202-
203-#include <gtest/gtest.h>
204-#include <gmock/gmock.h>
205-#include <mir/test/signal.h>
206-
207-namespace ms = mir::scene;
208-namespace msh = mir::shell;
209-
210-namespace mt = mir::test;
211-namespace mtf = mir_test_framework;
212-using namespace ::testing;
213-
214-using namespace std::literals::chrono_literals;
215-
216-namespace
217-{
218-#pragma GCC diagnostic push
219-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
220-struct MockWindowManager : msh::CanonicalWindowManager
221-{
222- using msh::CanonicalWindowManager::CanonicalWindowManager;
223-
224- MOCK_METHOD4(set_surface_attribute,
225- int(std::shared_ptr<ms::Session> const& session,
226- std::shared_ptr<ms::Surface> const& surface,
227- MirWindowAttrib attrib,
228- int value));
229-
230- int real_set_surface_attribute(std::shared_ptr<ms::Session> const& session,
231- std::shared_ptr<ms::Surface> const& surface,
232- MirWindowAttrib attrib,
233- int value)
234- {
235- return msh::CanonicalWindowManager::set_surface_attribute(session, surface, attrib, value);
236- }
237-};
238-#pragma GCC diagnostic pop
239-
240-void signal_state_change(MirWindow*, MirEvent const* event, void* context)
241-{
242- if (mir_event_get_type(event) != mir_event_type_window)
243- return;
244-
245- auto const window_event = mir_event_get_window_event(event);
246-
247- if (mir_window_event_get_attribute(window_event) != mir_window_attrib_state)
248- return;
249-
250- static_cast<mt::Signal*>(context)->raise();
251-}
252-
253-struct ShellSurfaceConfiguration : mtf::ConnectedClientWithAWindow
254-{
255- void SetUp() override
256- {
257- server.override_the_window_manager_builder([this]
258- (msh::FocusController* focus_controller) -> std::shared_ptr<msh::WindowManager>
259- {
260- mock_window_manager = std::make_shared<MockWindowManager>(
261- focus_controller,
262- server.the_shell_display_layout());
263-
264- ON_CALL(*mock_window_manager, set_surface_attribute(_, _, _, _))
265- .WillByDefault(Invoke(
266- mock_window_manager.get(), &MockWindowManager::real_set_surface_attribute));
267-
268- EXPECT_CALL(*mock_window_manager,
269- set_surface_attribute(_, _, Ne(mir_window_attrib_state), _))
270- .Times(AnyNumber());
271-
272- return mock_window_manager;
273- });
274-
275- mtf::ConnectedClientWithAWindow::SetUp();
276-
277- auto const spec = mir_create_window_spec(connection);
278- mir_window_spec_set_event_handler(spec, &signal_state_change, &received);
279- mir_window_apply_spec(window, spec);
280- mir_window_spec_release(spec);
281- }
282-
283- std::shared_ptr<MockWindowManager> mock_window_manager;
284- mt::Signal received;
285-};
286-}
287-
288-TEST_F(ShellSurfaceConfiguration, the_window_manager_is_notified_of_attribute_changes)
289-{
290- EXPECT_CALL(*mock_window_manager,
291- set_surface_attribute(_, _, mir_window_attrib_state, Eq(mir_window_state_maximized)));
292-
293- mir_window_set_state(window, mir_window_state_maximized);
294-
295- EXPECT_TRUE(received.wait_for(400ms));
296- EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_maximized));
297-}
298-
299-TEST_F(ShellSurfaceConfiguration, the_window_manager_may_interfere_with_attribute_changes)
300-{
301- auto const set_to_vertmax = [this](
302- std::shared_ptr<ms::Session> const& session,
303- std::shared_ptr<ms::Surface> const& surface,
304- MirWindowAttrib attrib,
305- int /*value*/)
306- {
307- return mock_window_manager->real_set_surface_attribute(
308- session, surface, attrib, mir_window_state_vertmaximized);
309- };
310-
311- EXPECT_CALL(*mock_window_manager,
312- set_surface_attribute(_, _, mir_window_attrib_state, Eq(mir_window_state_maximized)))
313- .WillOnce(Invoke(set_to_vertmax));
314-
315- mir_window_set_state(window, mir_window_state_maximized);
316-
317- EXPECT_TRUE(received.wait_for(400ms));
318- EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_vertmaximized));
319-}
320
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 visible_surface.cpp
327 stub_client_platform_options.cpp
328 ${PROJECT_SOURCE_DIR}/include/test/mir_test_framework/stub_client_platform_options.h
329- basic_window_manager.cpp ${PROJECT_SOURCE_DIR}/include/test/mir/shell/basic_window_manager.h
330- canonical_window_manager.cpp ${PROJECT_SOURCE_DIR}/include/test/mir/shell/canonical_window_manager.h
331+ basic_window_manager.cpp ${PROJECT_SOURCE_DIR}/tests/include/mir/shell/basic_window_manager.h
332+ canonical_window_manager.cpp ${PROJECT_SOURCE_DIR}/tests/include/mir/shell/canonical_window_manager.h
333 )
334
335 # Umockdev uses glib, which uses the deprecated "register" storage qualifier
336@@ -120,7 +120,7 @@
337
338 add_library(
339 mir-test-input-framework OBJECT
340-
341+
342 stub_input.cpp
343 fake_input_device_impl.cpp
344 stub_input_platform.cpp
345@@ -177,7 +177,7 @@
346 )
347
348 target_link_libraries(
349- mirplatformgraphicsthrow
350+ mirplatformgraphicsthrow
351
352 mirplatform
353 )
354
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 namespace mtf = mir_test_framework;
360
361 mtf::DeclarativePlacementWindowManagerPolicy::DeclarativePlacementWindowManagerPolicy(
362- mir::shell::WindowManagerTools* const tools,
363- SurfaceGeometries const& positions_by_name,
364- std::shared_ptr<mir::shell::DisplayLayout> const& display_layout) :
365- mir::shell::CanonicalWindowManagerPolicy{tools, display_layout},
366+ miral::WindowManagerTools const& tools,
367+ SurfaceGeometries const& positions_by_name) :
368+ mir_test_framework::CanonicalWindowManagerPolicy{tools},
369 surface_geometries_by_name{positions_by_name}
370 {
371 }
372
373-ms::SurfaceCreationParameters mtf::DeclarativePlacementWindowManagerPolicy::handle_place_new_surface(
374- std::shared_ptr<mir::scene::Session> const& /*session*/,
375- ms::SurfaceCreationParameters const& request_parameters)
376+auto mtf::DeclarativePlacementWindowManagerPolicy::place_new_window(
377+ miral::ApplicationInfo const& /*app_info*/,
378+ miral::WindowSpecification const& request_parameters)
379+-> miral::WindowSpecification
380 {
381 auto placed = request_parameters;
382
383- auto const& name = request_parameters.name;
384-
385+ auto const& name = request_parameters.name().value();
386+
387 if (surface_geometries_by_name.find(name) != surface_geometries_by_name.end())
388 {
389 auto const& geometry = surface_geometries_by_name.at(name);
390- placed.top_left = geometry.top_left;
391- placed.size = geometry.size;
392+ placed.top_left() = geometry.top_left;
393+ placed.size() = geometry.size;
394 }
395
396 return placed;
397
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 #include <mir_toolkit/mir_window.h>
403 #include <mir_toolkit/mir_blob.h>
404
405+#include <miral/window_management_policy_addendum2.h>
406+
407 #include <mir/geometry/displacement.h>
408 #include <mir/input/input_device_info.h>
409 #include <mir/input/device_capability.h>
410-#include <mir/shell/canonical_window_manager.h>
411-#include <mir/shell/shell.h>
412
413+#include <mir_test_framework/canonical_window_manager_policy.h>
414 #include <mir_test_framework/connected_client_with_a_window.h>
415 #include <mir_test_framework/fake_input_device.h>
416 #include <mir_test_framework/stub_server_platform_factory.h>
417@@ -73,19 +74,19 @@
418
419 void mir_cookie_release(Cookie const&) = delete;
420
421-struct MockWindowManager : mir::shell::CanonicalWindowManager
422+struct MockWindowManagementPolicy : mir_test_framework::CanonicalWindowManagerPolicy,
423+ miral::WindowManagementPolicyAddendum2
424 {
425-#if defined(__clang__)
426- #pragma GCC diagnostic push
427- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
428-#endif
429- using mir::shell::CanonicalWindowManager::CanonicalWindowManager;
430-#if defined(__clang__)
431- #pragma GCC diagnostic pop
432-#endif
433+ MockWindowManagementPolicy(
434+ miral::WindowManagerTools const& tools,
435+ MockWindowManagementPolicy*& self) :
436+ mir_test_framework::CanonicalWindowManagerPolicy(tools)
437+ {
438+ self = this;
439+ }
440
441- MOCK_METHOD3(handle_request_move,
442- void(std::shared_ptr<mir::scene::Session> const&, std::shared_ptr<mir::scene::Surface> const&, uint64_t));
443+ MOCK_METHOD2(handle_request_move, void(miral::WindowInfo&, MirInputEvent const*));
444+ MOCK_METHOD1(handle_request_drag_and_drop, void(miral::WindowInfo&));
445 };
446
447 struct MouseMoverAndFaker
448@@ -124,13 +125,10 @@
449 void SetUp() override
450 {
451 initial_display_layout({screen_geometry});
452- server.override_the_window_manager_builder([this](mir::shell::FocusController* focus_controller)
453- {
454- return window_manager =
455- std::make_shared<MockWindowManager>(focus_controller, server.the_shell_display_layout());
456- });
457-
458+ override_window_management_policy<MockWindowManagementPolicy>(mock_wm_policy);
459 mir_test_framework::ConnectedClientWithAWindow::SetUp();
460+ ASSERT_THAT(mock_wm_policy, NotNull());
461+
462 mir_window_set_event_handler(window, &window_event_handler, this);
463
464 paint_window();
465@@ -141,14 +139,13 @@
466 void TearDown() override
467 {
468 reset_window_event_handler();
469- window_manager.reset();
470 surface.reset();
471 mir_test_framework::ConnectedClientWithAWindow::TearDown();
472 }
473
474 auto user_initiates_gesture() -> Cookie;
475
476- std::shared_ptr<MockWindowManager> window_manager;
477+ MockWindowManagementPolicy* mock_wm_policy = 0;
478
479 private:
480 void center_mouse();
481@@ -294,7 +291,7 @@
482 {
483 auto const cookie = user_initiates_gesture();
484 Signal have_request;
485- EXPECT_CALL(*window_manager, handle_request_move(_, _, _)).WillOnce(InvokeWithoutArgs([&]{ have_request.raise(); }));
486+ EXPECT_CALL(*mock_wm_policy, handle_request_move(_, _)).WillOnce(InvokeWithoutArgs([&]{ have_request.raise(); }));
487
488 mir_window_request_user_move(window, cookie);
489

Subscribers

People subscribed via source and target branches