Mir
mock_window_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 2 or 3,
6  * as 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: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIR_TEST_DOUBLES_MOCK_WINDOW_MANAGER_H_
20 #define MIR_TEST_DOUBLES_MOCK_WINDOW_MANAGER_H_
21 
22 #include "mir/shell/window_manager.h"
23 #include "mir/shell/surface_specification.h"
24 #include "mir/scene/surface_creation_parameters.h"
25 
26 #include <gmock/gmock.h>
27 
28 namespace mir
29 {
30 namespace test
31 {
32 namespace doubles
33 {
34 struct MockWindowManager : shell::WindowManager
35 {
37  {
38  using namespace ::testing;
39  ON_CALL(*this, add_surface(_,_,_)).WillByDefault(Invoke(add_surface_default));
40  }
41 
42  MOCK_METHOD1(add_session, void (std::shared_ptr<scene::Session> const&));
43  MOCK_METHOD1(remove_session, void (std::shared_ptr<scene::Session> const&));
44 
45  MOCK_METHOD3(add_surface, frontend::SurfaceId(
46  std::shared_ptr<scene::Session> const& session,
47  scene::SurfaceCreationParameters const& params,
48  std::function<frontend::SurfaceId(std::shared_ptr<scene::Session> const& session, scene::SurfaceCreationParameters const& params)> const& build));
49 
50  MOCK_METHOD3(modify_surface, void(std::shared_ptr<scene::Session> const&, std::shared_ptr<scene::Surface> const&, shell::SurfaceSpecification const&));
51  MOCK_METHOD2(remove_surface, void(std::shared_ptr<scene::Session> const&, std::weak_ptr<scene::Surface> const&));
52 
53  MOCK_METHOD1(add_display, void(geometry::Rectangle const&));
54  MOCK_METHOD1(remove_display, void(geometry::Rectangle const&));
55 
56  MOCK_METHOD1(handle_keyboard_event, bool(MirKeyboardEvent const*));
57  MOCK_METHOD1(handle_touch_event, bool(MirTouchEvent const*));
58  MOCK_METHOD1(handle_pointer_event, bool(MirPointerEvent const*));
59 
60  MOCK_METHOD3(handle_raise_surface, void(std::shared_ptr<scene::Session> const&, std::shared_ptr<scene::Surface> const&, uint64_t));
61  MOCK_METHOD3(handle_request_drag_and_drop, void(std::shared_ptr<scene::Session> const&, std::shared_ptr<scene::Surface> const&, uint64_t));
62  MOCK_METHOD3(handle_request_move, void(std::shared_ptr<scene::Session> const&, std::shared_ptr<scene::Surface> const&, uint64_t));
63 
64  MOCK_METHOD4(set_surface_attribute,
65  int(std::shared_ptr<scene::Session> const& session,
66  std::shared_ptr<scene::Surface> const& surface,
67  MirWindowAttrib attrib,
68  int value));
69 
71  std::shared_ptr<scene::Session> const& session,
72  scene::SurfaceCreationParameters const& params,
73  std::function<frontend::SurfaceId(std::shared_ptr<scene::Session> const& session, scene::SurfaceCreationParameters const& params)> const& build)
74  { return build(session, params); }
75 };
76 
77 }
78 }
79 }
80 
81 #endif /* MIR_TEST_DOUBLES_MOCK_WINDOW_MANAGER_H_ */
AutoUnblockThread is a helper thread class that can gracefully shutdown at destruction time...
Definition: sw_splash.h:26
MirWindowAttrib
Attributes of a window that the client and server/shell may wish to get or set over the wire...
Definition: common.h:76
MOCK_METHOD1(add_session, void(std::shared_ptr< scene::Session > const &))
struct MirPointerEvent MirPointerEvent
An event type describing a change in pointer device state.
Definition: pointer_event.h:35
MOCK_METHOD4(set_surface_attribute, int(std::shared_ptr< scene::Session > const &session, std::shared_ptr< scene::Surface > const &surface, MirWindowAttrib attrib, int value))
struct MirTouchEvent MirTouchEvent
An event type describing a change in touch device state.
Definition: touch_event.h:33
Definition: mock_window_manager.h:34
MockWindowManager()
Definition: mock_window_manager.h:36
Definition: int_wrapper.h:27
MOCK_METHOD3(add_surface, frontend::SurfaceId(std::shared_ptr< scene::Session > const &session, scene::SurfaceCreationParameters const &params, std::function< frontend::SurfaceId(std::shared_ptr< scene::Session > const &session, scene::SurfaceCreationParameters const &params)> const &build))
struct MirKeyboardEvent MirKeyboardEvent
An event type describing a change in keyboard state.
Definition: keyboard_event.h:41
Definition: rectangle.h:33
static frontend::SurfaceId add_surface_default(std::shared_ptr< scene::Session > const &session, scene::SurfaceCreationParameters const &params, std::function< frontend::SurfaceId(std::shared_ptr< scene::Session > const &session, scene::SurfaceCreationParameters const &params)> const &build)
Definition: mock_window_manager.h:70
MOCK_METHOD2(remove_surface, void(std::shared_ptr< scene::Session > const &, std::weak_ptr< scene::Surface > const &))

Copyright © 2012-2018 Canonical Ltd.
Generated on Mon Feb 19 14:05:11 UTC 2018