Mir
fake_input_device.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: Andreas Pokorny <andreas.pokorny@canonical.com>
17  */
18 
19 #ifndef MIR_TEST_FRAMEWORK_FAKE_INPUT_DEVICE_H_
20 #define MIR_TEST_FRAMEWORK_FAKE_INPUT_DEVICE_H_
21 
23 #include "mir/test/event_factory.h"
24 #include <chrono>
25 #include <functional>
26 #include <vector>
27 
28 namespace mir
29 {
30 namespace input
31 {
32 class InputDevice;
33 }
34 }
35 
36 namespace mir_test_framework
37 {
38 
40 {
41 public:
47  static const int maximum_touch_axis_value = 0xFFFF;
48  static const int minimum_touch_axis_value = 0;
50 
51  FakeInputDevice() = default;
52  virtual ~FakeInputDevice() = default;
53 
54 
55  virtual void emit_device_removal() = 0;
56  virtual void emit_runtime_error() = 0;
57  virtual void emit_event(mir::input::synthesis::KeyParameters const& key) = 0;
58  virtual void emit_event(mir::input::synthesis::ButtonParameters const& button) = 0;
59  virtual void emit_event(mir::input::synthesis::MotionParameters const& motion) = 0;
60  virtual void emit_event(mir::input::synthesis::TouchParameters const& touch) = 0;
61  virtual void emit_touch_sequence(std::function<mir::input::synthesis::TouchParameters(int)> const& generate_parameters,
62  int count,
63  std::chrono::duration<double> delay) = 0;
64  virtual void emit_key_state(std::vector<uint32_t> const& scan_codes) = 0;
65  virtual void on_new_configuration_do(std::function<void(mir::input::InputDevice const& device)> callback) = 0;
66 
67  FakeInputDevice(FakeInputDevice const&) = delete;
68  FakeInputDevice& operator=(FakeInputDevice const&) = delete;
69 };
70 
71 }
72 
73 #endif
AutoUnblockThread is a helper thread class that can gracefully shutdown at destruction time...
Definition: blob.h:26
Definition: event_factory.h:39
virtual void emit_event(mir::input::synthesis::KeyParameters const &key)=0
virtual void emit_key_state(std::vector< uint32_t > const &scan_codes)=0
FakeInputDevice & operator=(FakeInputDevice const &)=delete
virtual void on_new_configuration_do(std::function< void(mir::input::InputDevice const &device)> callback)=0
virtual void emit_touch_sequence(std::function< mir::input::synthesis::TouchParameters(int)> const &generate_parameters, int count, std::chrono::duration< double > delay)=0
Definition: event_factory.h:55
static const int maximum_touch_axis_value
Valid value range of simulated touch coordinates.
Definition: fake_input_device.h:47
Definition: event_factory.h:70
Definition: fake_input_device.h:39
Definition: event_factory.h:85
Definition: any_surface.h:25
static const int minimum_touch_axis_value
Definition: fake_input_device.h:48

Copyright © 2012-2018 Canonical Ltd.
Generated on Sun Jun 17 06:26:29 UTC 2018