1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
/*
* Copyright © Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MOCK_INPUT_METHOD_V1_H
#define MOCK_INPUT_METHOD_V1_H
#include "generated/wayland-client.h"
#include "generated/input-method-unstable-v1-client.h"
#include "in_process_server.h"
#include "wl_interface_descriptor.h"
#include "wl_handle.h"
#include "method_event_impl.h"
#include <gmock/gmock.h>
#include <memory>
namespace wlcs
{
WLCS_CREATE_INTERFACE_DESCRIPTOR(zwp_input_method_v1)
WLCS_CREATE_INTERFACE_DESCRIPTOR(zwp_input_method_context_v1)
WLCS_CREATE_INTERFACE_DESCRIPTOR(zwp_input_panel_v1)
WLCS_CREATE_INTERFACE_DESCRIPTOR(zwp_input_panel_surface_v1)
class MockInputMethodContextV1 : public WlHandle<zwp_input_method_context_v1>
{
public:
MockInputMethodContextV1(zwp_input_method_context_v1* proxy)
: WlHandle{proxy}
{
zwp_input_method_context_v1_add_listener(proxy, &listener, this);
}
MOCK_METHOD(void, surrounding_text, (std::string const&, uint32_t, uint32_t));
MOCK_METHOD(void, reset, ());
MOCK_METHOD(void, content_type, (uint32_t, uint32_t));
MOCK_METHOD(void, invoke_action, (uint32_t, uint32_t));
MOCK_METHOD(void, preferred_language, (std::string const&));
void commit_state(uint32_t in_serial)
{
serial = in_serial;
}
static zwp_input_method_context_v1_listener constexpr listener {
method_event_impl<&MockInputMethodContextV1::surrounding_text>,
method_event_impl<&MockInputMethodContextV1::reset>,
method_event_impl<&MockInputMethodContextV1::content_type>,
method_event_impl<&MockInputMethodContextV1::invoke_action>,
method_event_impl<&MockInputMethodContextV1::commit_state>,
method_event_impl<&MockInputMethodContextV1::preferred_language>
};
uint32_t serial = 0;
};
}
#endif
|