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
=== modified file 'include/test/mir_test_framework/declarative_placement_window_manage_policy.h'
--- include/test/mir_test_framework/declarative_placement_window_manage_policy.h 2017-07-28 17:00:43 +0000
+++ include/test/mir_test_framework/declarative_placement_window_manage_policy.h 2017-09-25 13:41:00 +0000
@@ -19,7 +19,7 @@
19#ifndef MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_WINDOW_MANAGER_POLICY_H_19#ifndef MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_WINDOW_MANAGER_POLICY_H_
20#define MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_WINDOW_MANAGER_POLICY_H_20#define MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_WINDOW_MANAGER_POLICY_H_
2121
22#include "mir/shell/canonical_window_manager.h"22#include "mir_test_framework/canonical_window_manager_policy.h"
23#include "mir/geometry/rectangle.h"23#include "mir/geometry/rectangle.h"
2424
25#include <memory>25#include <memory>
@@ -34,18 +34,17 @@
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,
35/// in input tests where it is necessary to set up scenarios depending on35/// in input tests where it is necessary to set up scenarios depending on
36/// multiple surfaces geometry and stacking.36/// multiple surfaces geometry and stacking.
37class DeclarativePlacementWindowManagerPolicy : public mir::shell::CanonicalWindowManagerPolicy37class DeclarativePlacementWindowManagerPolicy : public mir_test_framework::CanonicalWindowManagerPolicy
38{38{
39public:39public:
40 DeclarativePlacementWindowManagerPolicy(40 DeclarativePlacementWindowManagerPolicy(
41 mir::shell::WindowManagerTools* const tools,41 miral::WindowManagerTools const& tools,
42 SurfaceGeometries const& positions_by_name, 42 SurfaceGeometries const& positions_by_name);
43 std::shared_ptr<mir::shell::DisplayLayout> const& display_layout);
4443
45 auto handle_place_new_surface(44 virtual auto place_new_window(
46 std::shared_ptr<mir::scene::Session> const& session,45 miral::ApplicationInfo const& app_info,
47 mir::scene::SurfaceCreationParameters const& request_parameters)46 miral::WindowSpecification const& request_parameters)
48 -> mir::scene::SurfaceCreationParameters;47 -> miral::WindowSpecification override;
4948
50private:49private:
51 SurfaceGeometries const& surface_geometries_by_name;50 SurfaceGeometries const& surface_geometries_by_name;
5251
=== modified file 'tests/acceptance-tests/CMakeLists.txt'
--- tests/acceptance-tests/CMakeLists.txt 2017-06-01 13:04:37 +0000
+++ tests/acceptance-tests/CMakeLists.txt 2017-09-25 13:41:00 +0000
@@ -62,7 +62,6 @@
62 test_client_extensions.cpp62 test_client_extensions.cpp
63 test_client_cursor_api.cpp63 test_client_cursor_api.cpp
64 test_client_library_errors.cpp64 test_client_library_errors.cpp
65 test_shell_control_of_surface_configuration.cpp
66 test_client_library.cpp65 test_client_library.cpp
67 test_presentation_chain.cpp66 test_presentation_chain.cpp
68 test_render_surface.cpp67 test_render_surface.cpp
6968
=== modified file 'tests/acceptance-tests/client_mediated_user_gestures.cpp'
--- tests/acceptance-tests/client_mediated_user_gestures.cpp 2017-07-28 17:00:43 +0000
+++ tests/acceptance-tests/client_mediated_user_gestures.cpp 2017-09-25 13:41:00 +0000
@@ -19,12 +19,13 @@
19#include <mir_toolkit/mir_window.h>19#include <mir_toolkit/mir_window.h>
20#include <mir_toolkit/mir_blob.h>20#include <mir_toolkit/mir_blob.h>
2121
22#include <miral/window_management_policy_addendum2.h>
23
22#include <mir/geometry/displacement.h>24#include <mir/geometry/displacement.h>
23#include <mir/input/input_device_info.h>25#include <mir/input/input_device_info.h>
24#include <mir/input/device_capability.h>26#include <mir/input/device_capability.h>
25#include <mir/shell/canonical_window_manager.h>
26#include <mir/shell/shell.h>
2727
28#include <mir_test_framework/canonical_window_manager_policy.h>
28#include <mir_test_framework/connected_client_with_a_window.h>29#include <mir_test_framework/connected_client_with_a_window.h>
29#include <mir_test_framework/fake_input_device.h>30#include <mir_test_framework/fake_input_device.h>
30#include <mir_test_framework/stub_server_platform_factory.h>31#include <mir_test_framework/stub_server_platform_factory.h>
@@ -70,16 +71,20 @@
7071
71void mir_cookie_release(Cookie const&) = delete;72void mir_cookie_release(Cookie const&) = delete;
7273
73#pragma GCC diagnostic push74struct MockWindowManagementPolicy : mir_test_framework::CanonicalWindowManagerPolicy,
74#pragma GCC diagnostic ignored "-Wdeprecated-declarations"75 miral::WindowManagementPolicyAddendum2
75struct MockWindowManager : mir::shell::CanonicalWindowManager
76{76{
77 using mir::shell::CanonicalWindowManager::CanonicalWindowManager;77 MockWindowManagementPolicy(
78 miral::WindowManagerTools const& tools,
79 MockWindowManagementPolicy*& self) :
80 mir_test_framework::CanonicalWindowManagerPolicy(tools)
81 {
82 self = this;
83 }
7884
79 MOCK_METHOD3(handle_request_move,85 MOCK_METHOD2(handle_request_move, void(miral::WindowInfo&, MirInputEvent const*));
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&));
81};87};
82#pragma GCC diagnostic pop
8388
84struct MouseMoverAndFaker89struct MouseMoverAndFaker
85{90{
@@ -117,13 +122,10 @@
117 void SetUp() override122 void SetUp() override
118 {123 {
119 initial_display_layout({screen_geometry});124 initial_display_layout({screen_geometry});
120 server.override_the_window_manager_builder([this](mir::shell::FocusController* focus_controller)125 override_window_management_policy<MockWindowManagementPolicy>(mock_wm_policy);
121 {
122 return window_manager =
123 std::make_shared<MockWindowManager>(focus_controller, server.the_shell_display_layout());
124 });
125
126 mir_test_framework::ConnectedClientWithAWindow::SetUp();126 mir_test_framework::ConnectedClientWithAWindow::SetUp();
127 ASSERT_THAT(mock_wm_policy, NotNull());
128
127 mir_window_set_event_handler(window, &window_event_handler, this);129 mir_window_set_event_handler(window, &window_event_handler, this);
128130
129 paint_window();131 paint_window();
@@ -134,13 +136,12 @@
134 void TearDown() override136 void TearDown() override
135 {137 {
136 reset_window_event_handler();138 reset_window_event_handler();
137 window_manager.reset();
138 mir_test_framework::ConnectedClientWithAWindow::TearDown();139 mir_test_framework::ConnectedClientWithAWindow::TearDown();
139 }140 }
140141
141 auto user_initiates_gesture() -> Cookie;142 auto user_initiates_gesture() -> Cookie;
142143
143 std::shared_ptr<MockWindowManager> window_manager;144 MockWindowManagementPolicy* mock_wm_policy = 0;
144145
145private:146private:
146 void center_mouse();147 void center_mouse();
@@ -197,7 +198,7 @@
197#pragma GCC diagnostic ignored "-Wdeprecated-declarations"198#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
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));
199#pragma GCC diagnostic pop200#pragma GCC diagnostic pop
200 201
201 EXPECT_THAT(have_focus.wait_for(receive_event_timeout), Eq(true));202 EXPECT_THAT(have_focus.wait_for(receive_event_timeout), Eq(true));
202203
203 reset_window_event_handler();204 reset_window_event_handler();
@@ -280,7 +281,7 @@
280{281{
281 auto const cookie = user_initiates_gesture();282 auto const cookie = user_initiates_gesture();
282 Signal have_request;283 Signal have_request;
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(); }));
284285
285 mir_window_request_user_move(window, cookie);286 mir_window_request_user_move(window, cookie);
286287
287288
=== modified file 'tests/acceptance-tests/test_client_cursor_api.cpp'
--- tests/acceptance-tests/test_client_cursor_api.cpp 2017-07-28 17:00:43 +0000
+++ tests/acceptance-tests/test_client_cursor_api.cpp 2017-09-25 13:41:00 +0000
@@ -456,17 +456,7 @@
456456
457 server.override_the_cursor_images([]() { return std::make_shared<NamedCursorImages>(); });457 server.override_the_cursor_images([]() { return std::make_shared<NamedCursorImages>(); });
458458
459 server.override_the_window_manager_builder([this](msh::FocusController* focus_controller)459 override_window_management_policy<mtf::DeclarativePlacementWindowManagerPolicy>(client_geometries);
460 {
461#pragma GCC diagnostic push
462#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
463 using PlacementWindowManager = msh::WindowManagerConstructor<mtf::DeclarativePlacementWindowManagerPolicy>;
464 return std::make_shared<PlacementWindowManager>(
465 focus_controller,
466 client_geometries,
467 server.the_shell_display_layout());
468#pragma GCC diagnostic pop
469 });
470460
471 server.wrap_shell([&, this](auto const& wrapped)461 server.wrap_shell([&, this](auto const& wrapped)
472 {462 {
473463
=== removed file 'tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp'
--- tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp 2017-07-28 17:00:43 +0000
+++ tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp 1970-01-01 00:00:00 +0000
@@ -1,143 +0,0 @@
1/*
2 * Copyright © 2013-2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 or 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */
18
19#include "mir/scene/surface.h"
20
21#include "mir_test_framework/connected_client_with_a_window.h"
22
23#include "mir/shell/canonical_window_manager.h"
24
25#include "mir_toolkit/mir_client_library.h"
26
27#include <gtest/gtest.h>
28#include <gmock/gmock.h>
29#include <mir/test/signal.h>
30
31namespace ms = mir::scene;
32namespace msh = mir::shell;
33
34namespace mt = mir::test;
35namespace mtf = mir_test_framework;
36using namespace ::testing;
37
38using namespace std::literals::chrono_literals;
39
40namespace
41{
42#pragma GCC diagnostic push
43#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
44struct MockWindowManager : msh::CanonicalWindowManager
45{
46 using msh::CanonicalWindowManager::CanonicalWindowManager;
47
48 MOCK_METHOD4(set_surface_attribute,
49 int(std::shared_ptr<ms::Session> const& session,
50 std::shared_ptr<ms::Surface> const& surface,
51 MirWindowAttrib attrib,
52 int value));
53
54 int real_set_surface_attribute(std::shared_ptr<ms::Session> const& session,
55 std::shared_ptr<ms::Surface> const& surface,
56 MirWindowAttrib attrib,
57 int value)
58 {
59 return msh::CanonicalWindowManager::set_surface_attribute(session, surface, attrib, value);
60 }
61};
62#pragma GCC diagnostic pop
63
64void signal_state_change(MirWindow*, MirEvent const* event, void* context)
65{
66 if (mir_event_get_type(event) != mir_event_type_window)
67 return;
68
69 auto const window_event = mir_event_get_window_event(event);
70
71 if (mir_window_event_get_attribute(window_event) != mir_window_attrib_state)
72 return;
73
74 static_cast<mt::Signal*>(context)->raise();
75}
76
77struct ShellSurfaceConfiguration : mtf::ConnectedClientWithAWindow
78{
79 void SetUp() override
80 {
81 server.override_the_window_manager_builder([this]
82 (msh::FocusController* focus_controller) -> std::shared_ptr<msh::WindowManager>
83 {
84 mock_window_manager = std::make_shared<MockWindowManager>(
85 focus_controller,
86 server.the_shell_display_layout());
87
88 ON_CALL(*mock_window_manager, set_surface_attribute(_, _, _, _))
89 .WillByDefault(Invoke(
90 mock_window_manager.get(), &MockWindowManager::real_set_surface_attribute));
91
92 EXPECT_CALL(*mock_window_manager,
93 set_surface_attribute(_, _, Ne(mir_window_attrib_state), _))
94 .Times(AnyNumber());
95
96 return mock_window_manager;
97 });
98
99 mtf::ConnectedClientWithAWindow::SetUp();
100
101 auto const spec = mir_create_window_spec(connection);
102 mir_window_spec_set_event_handler(spec, &signal_state_change, &received);
103 mir_window_apply_spec(window, spec);
104 mir_window_spec_release(spec);
105 }
106
107 std::shared_ptr<MockWindowManager> mock_window_manager;
108 mt::Signal received;
109};
110}
111
112TEST_F(ShellSurfaceConfiguration, the_window_manager_is_notified_of_attribute_changes)
113{
114 EXPECT_CALL(*mock_window_manager,
115 set_surface_attribute(_, _, mir_window_attrib_state, Eq(mir_window_state_maximized)));
116
117 mir_window_set_state(window, mir_window_state_maximized);
118
119 EXPECT_TRUE(received.wait_for(400ms));
120 EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_maximized));
121}
122
123TEST_F(ShellSurfaceConfiguration, the_window_manager_may_interfere_with_attribute_changes)
124{
125 auto const set_to_vertmax = [this](
126 std::shared_ptr<ms::Session> const& session,
127 std::shared_ptr<ms::Surface> const& surface,
128 MirWindowAttrib attrib,
129 int /*value*/)
130 {
131 return mock_window_manager->real_set_surface_attribute(
132 session, surface, attrib, mir_window_state_vertmaximized);
133 };
134
135 EXPECT_CALL(*mock_window_manager,
136 set_surface_attribute(_, _, mir_window_attrib_state, Eq(mir_window_state_maximized)))
137 .WillOnce(Invoke(set_to_vertmax));
138
139 mir_window_set_state(window, mir_window_state_maximized);
140
141 EXPECT_TRUE(received.wait_for(400ms));
142 EXPECT_THAT(mir_window_get_state(window), Eq(mir_window_state_vertmaximized));
143}
1440
=== renamed directory 'include/test/mir/shell' => 'tests/include/mir/shell'
=== modified file 'tests/mir_test_framework/CMakeLists.txt'
--- tests/mir_test_framework/CMakeLists.txt 2017-09-07 05:58:13 +0000
+++ tests/mir_test_framework/CMakeLists.txt 2017-09-25 13:41:00 +0000
@@ -58,8 +58,8 @@
58 visible_surface.cpp58 visible_surface.cpp
59 stub_client_platform_options.cpp59 stub_client_platform_options.cpp
60 ${PROJECT_SOURCE_DIR}/include/test/mir_test_framework/stub_client_platform_options.h60 ${PROJECT_SOURCE_DIR}/include/test/mir_test_framework/stub_client_platform_options.h
61 basic_window_manager.cpp ${PROJECT_SOURCE_DIR}/include/test/mir/shell/basic_window_manager.h61 basic_window_manager.cpp ${PROJECT_SOURCE_DIR}/tests/include/mir/shell/basic_window_manager.h
62 canonical_window_manager.cpp ${PROJECT_SOURCE_DIR}/include/test/mir/shell/canonical_window_manager.h62 canonical_window_manager.cpp ${PROJECT_SOURCE_DIR}/tests/include/mir/shell/canonical_window_manager.h
63)63)
6464
65# Umockdev uses glib, which uses the deprecated "register" storage qualifier65# Umockdev uses glib, which uses the deprecated "register" storage qualifier
@@ -120,7 +120,7 @@
120120
121add_library(121add_library(
122 mir-test-input-framework OBJECT122 mir-test-input-framework OBJECT
123 123
124 stub_input.cpp124 stub_input.cpp
125 fake_input_device_impl.cpp125 fake_input_device_impl.cpp
126 stub_input_platform.cpp126 stub_input_platform.cpp
@@ -177,7 +177,7 @@
177)177)
178178
179target_link_libraries(179target_link_libraries(
180 mirplatformgraphicsthrow 180 mirplatformgraphicsthrow
181181
182 mirplatform182 mirplatform
183)183)
184184
=== modified file 'tests/mir_test_framework/declarative_placement_window_manage_policy.cpp'
--- tests/mir_test_framework/declarative_placement_window_manage_policy.cpp 2017-07-28 17:00:43 +0000
+++ tests/mir_test_framework/declarative_placement_window_manage_policy.cpp 2017-09-25 13:41:00 +0000
@@ -24,27 +24,27 @@
24namespace mtf = mir_test_framework;24namespace mtf = mir_test_framework;
2525
26mtf::DeclarativePlacementWindowManagerPolicy::DeclarativePlacementWindowManagerPolicy(26mtf::DeclarativePlacementWindowManagerPolicy::DeclarativePlacementWindowManagerPolicy(
27 mir::shell::WindowManagerTools* const tools,27 miral::WindowManagerTools const& tools,
28 SurfaceGeometries const& positions_by_name,28 SurfaceGeometries const& positions_by_name) :
29 std::shared_ptr<mir::shell::DisplayLayout> const& display_layout) :29 mir_test_framework::CanonicalWindowManagerPolicy{tools},
30 mir::shell::CanonicalWindowManagerPolicy{tools, display_layout},
31 surface_geometries_by_name{positions_by_name}30 surface_geometries_by_name{positions_by_name}
32{31{
33}32}
3433
35ms::SurfaceCreationParameters mtf::DeclarativePlacementWindowManagerPolicy::handle_place_new_surface(34auto mtf::DeclarativePlacementWindowManagerPolicy::place_new_window(
36 std::shared_ptr<mir::scene::Session> const& /*session*/,35 miral::ApplicationInfo const& /*app_info*/,
37 ms::SurfaceCreationParameters const& request_parameters)36 miral::WindowSpecification const& request_parameters)
37-> miral::WindowSpecification
38{38{
39 auto placed = request_parameters;39 auto placed = request_parameters;
4040
41 auto const& name = request_parameters.name;41 auto const& name = request_parameters.name().value();
42 42
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())
44 {44 {
45 auto const& geometry = surface_geometries_by_name.at(name);45 auto const& geometry = surface_geometries_by_name.at(name);
46 placed.top_left = geometry.top_left;46 placed.top_left() = geometry.top_left;
47 placed.size = geometry.size; 47 placed.size() = geometry.size;
48 }48 }
4949
50 return placed;50 return placed;
5151
=== modified file 'tests/miral/client_mediated_gestures.cpp'
--- tests/miral/client_mediated_gestures.cpp 2017-08-24 15:12:39 +0000
+++ tests/miral/client_mediated_gestures.cpp 2017-09-25 13:41:00 +0000
@@ -22,12 +22,13 @@
22#include <mir_toolkit/mir_window.h>22#include <mir_toolkit/mir_window.h>
23#include <mir_toolkit/mir_blob.h>23#include <mir_toolkit/mir_blob.h>
2424
25#include <miral/window_management_policy_addendum2.h>
26
25#include <mir/geometry/displacement.h>27#include <mir/geometry/displacement.h>
26#include <mir/input/input_device_info.h>28#include <mir/input/input_device_info.h>
27#include <mir/input/device_capability.h>29#include <mir/input/device_capability.h>
28#include <mir/shell/canonical_window_manager.h>
29#include <mir/shell/shell.h>
3030
31#include <mir_test_framework/canonical_window_manager_policy.h>
31#include <mir_test_framework/connected_client_with_a_window.h>32#include <mir_test_framework/connected_client_with_a_window.h>
32#include <mir_test_framework/fake_input_device.h>33#include <mir_test_framework/fake_input_device.h>
33#include <mir_test_framework/stub_server_platform_factory.h>34#include <mir_test_framework/stub_server_platform_factory.h>
@@ -73,19 +74,19 @@
7374
74void mir_cookie_release(Cookie const&) = delete;75void mir_cookie_release(Cookie const&) = delete;
7576
76struct MockWindowManager : mir::shell::CanonicalWindowManager77struct MockWindowManagementPolicy : mir_test_framework::CanonicalWindowManagerPolicy,
78 miral::WindowManagementPolicyAddendum2
77{79{
78#if defined(__clang__)80 MockWindowManagementPolicy(
79 #pragma GCC diagnostic push81 miral::WindowManagerTools const& tools,
80 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"82 MockWindowManagementPolicy*& self) :
81#endif83 mir_test_framework::CanonicalWindowManagerPolicy(tools)
82 using mir::shell::CanonicalWindowManager::CanonicalWindowManager;84 {
83#if defined(__clang__)85 self = this;
84 #pragma GCC diagnostic pop86 }
85#endif
8687
87 MOCK_METHOD3(handle_request_move,88 MOCK_METHOD2(handle_request_move, void(miral::WindowInfo&, MirInputEvent const*));
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&));
89};90};
9091
91struct MouseMoverAndFaker92struct MouseMoverAndFaker
@@ -124,13 +125,10 @@
124 void SetUp() override125 void SetUp() override
125 {126 {
126 initial_display_layout({screen_geometry});127 initial_display_layout({screen_geometry});
127 server.override_the_window_manager_builder([this](mir::shell::FocusController* focus_controller)128 override_window_management_policy<MockWindowManagementPolicy>(mock_wm_policy);
128 {
129 return window_manager =
130 std::make_shared<MockWindowManager>(focus_controller, server.the_shell_display_layout());
131 });
132
133 mir_test_framework::ConnectedClientWithAWindow::SetUp();129 mir_test_framework::ConnectedClientWithAWindow::SetUp();
130 ASSERT_THAT(mock_wm_policy, NotNull());
131
134 mir_window_set_event_handler(window, &window_event_handler, this);132 mir_window_set_event_handler(window, &window_event_handler, this);
135133
136 paint_window();134 paint_window();
@@ -141,14 +139,13 @@
141 void TearDown() override139 void TearDown() override
142 {140 {
143 reset_window_event_handler();141 reset_window_event_handler();
144 window_manager.reset();
145 surface.reset();142 surface.reset();
146 mir_test_framework::ConnectedClientWithAWindow::TearDown();143 mir_test_framework::ConnectedClientWithAWindow::TearDown();
147 }144 }
148145
149 auto user_initiates_gesture() -> Cookie;146 auto user_initiates_gesture() -> Cookie;
150147
151 std::shared_ptr<MockWindowManager> window_manager;148 MockWindowManagementPolicy* mock_wm_policy = 0;
152149
153private:150private:
154 void center_mouse();151 void center_mouse();
@@ -294,7 +291,7 @@
294{291{
295 auto const cookie = user_initiates_gesture();292 auto const cookie = user_initiates_gesture();
296 Signal have_request;293 Signal have_request;
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(); }));
298295
299 mir_window_request_user_move(window, cookie);296 mir_window_request_user_move(window, cookie);
300297

Subscribers

People subscribed via source and target branches