~lukas-kde/miral/shellchrome-windowinfo

« back to all changes in this revision

Viewing changes to miral-qt/tests/framework/fake_surface.h

  • Committer: Larry Price
  • Date: 2016-09-13 16:19:29 UTC
  • mto: (330.4.1 miral)
  • mto: This revision was merged to the branch mainline in revision 352.
  • Revision ID: larry.price@canonical.com-20160913161929-vs9ka1capmljq1es
Removing miral-qt from release branch, updating copyright file, and adding GPL3 license to root dir

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright © 2014,2016 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 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
 
 * Original file authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
17
 
 */
18
 
 
19
 
#ifndef MIR_SCENE_FAKESURFACE_H_
20
 
#define MIR_SCENE_FAKESURFACE_H_
21
 
 
22
 
#include <mir/scene/surface.h>
23
 
#include <mir/version.h>
24
 
#include "stub_input_channel.h"
25
 
 
26
 
#include <memory>
27
 
#include <gmock/gmock.h>
28
 
 
29
 
namespace mir {
30
 
namespace scene {
31
 
 
32
 
class FakeSurface : public Surface
33
 
{
34
 
public:
35
 
    std::shared_ptr<mir::test::doubles::StubInputChannel> channel;
36
 
    int fd;
37
 
    mir::input::InputReceptionMode input_mode{mir::input::InputReceptionMode::normal};
38
 
 
39
 
    FakeSurface(int fd=123)
40
 
        : channel(std::make_shared<mir::test::doubles::StubInputChannel>(fd)), fd(fd)
41
 
    {
42
 
    }
43
 
 
44
 
    std::shared_ptr<mir::input::InputChannel> input_channel() const override
45
 
    {
46
 
        return channel;
47
 
    }
48
 
 
49
 
    mir::input::InputReceptionMode reception_mode() const override
50
 
    {
51
 
        return input_mode;
52
 
    }
53
 
 
54
 
    std::string name() const override { return {}; }
55
 
    geometry::Point top_left() const override { return {}; }
56
 
    geometry::Size client_size() const override { return {};}
57
 
    geometry::Size size() const override { return {}; }
58
 
    geometry::Rectangle input_bounds() const override { return {{},{}}; }
59
 
    bool input_area_contains(mir::geometry::Point const&) const override { return false; }
60
 
 
61
 
    void set_streams(std::list<scene::StreamInfo> const&) override {}
62
 
    graphics::RenderableList generate_renderables(compositor::CompositorID) const override { return {}; }
63
 
    int buffers_ready_for_compositor(void const*) const override { return 0; }
64
 
 
65
 
    float alpha() const override { return 0.0f;}
66
 
    MirSurfaceType type() const override { return mir_surface_type_normal; }
67
 
    MirSurfaceState state() const override { return mir_surface_state_unknown; }
68
 
 
69
 
    void hide() override {}
70
 
    void show() override {}
71
 
    bool visible() const override { return true; }
72
 
    void move_to(geometry::Point const&) override {}
73
 
    void set_input_region(std::vector<geometry::Rectangle> const&) override {}
74
 
    void resize(geometry::Size const&) override {}
75
 
    void set_transformation(glm::mat4 const&) override {}
76
 
    void set_alpha(float) override {}
77
 
    void set_orientation(MirOrientation) override {}
78
 
 
79
 
    void add_observer(std::shared_ptr<scene::SurfaceObserver> const&) override {}
80
 
    void remove_observer(std::weak_ptr<scene::SurfaceObserver> const&) override {}
81
 
 
82
 
    void set_reception_mode(input::InputReceptionMode mode) override { input_mode = mode; }
83
 
    void consume(MirEvent const*) override {}
84
 
 
85
 
    void set_cursor_image(std::shared_ptr<graphics::CursorImage> const& /* image */) override {}
86
 
    std::shared_ptr<graphics::CursorImage> cursor_image() const override { return {}; }
87
 
 
88
 
    void request_client_surface_close() override {}
89
 
 
90
 
    bool supports_input() const override { return true;}
91
 
    int client_input_fd() const override { return fd;}
92
 
    int configure(MirSurfaceAttrib, int) override { return 0; }
93
 
    int query(MirSurfaceAttrib) const override { return 0; }
94
 
    void with_most_recent_buffer_do(std::function<void(graphics::Buffer&)> const&) {}
95
 
 
96
 
    std::shared_ptr<Surface> parent() const override { return nullptr; }
97
 
 
98
 
    void set_keymap(MirInputDeviceId, std::string const&, std::string const&, std::string const&, std::string const&) override
99
 
    {}
100
 
 
101
 
    void set_cursor_stream(std::shared_ptr<frontend::BufferStream> const&, geometry::Displacement const&) override {}
102
 
    void rename(std::string const&) override {}
103
 
    std::shared_ptr<frontend::BufferStream> primary_buffer_stream() const override { return nullptr; }
104
 
 
105
 
#if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 24, 0)
106
 
    void set_confine_pointer_state(MirPointerConfinementState) {}
107
 
    MirPointerConfinementState confine_pointer_state() const { return {}; }
108
 
#endif
109
 
};
110
 
 
111
 
} // namespace scene
112
 
} // namescape mir
113
 
 
114
 
#endif // MIR_SCENE_FAKESURFACE_H_