Flutter Engine
The Flutter Engine
mock_text_input_plugin.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/shell/platform/linux/testing/mock_text_input_plugin.h"
6
8 FlTextInputPlugin parent_instance;
9
10 gboolean (*filter_keypress)(FlTextInputPlugin* self, FlKeyEvent* event);
11};
12
13G_DEFINE_TYPE(FlMockTextInputPlugin,
14 fl_mock_text_input_plugin,
15 fl_text_input_plugin_get_type())
16
17static gboolean mock_text_input_plugin_filter_keypress(FlTextInputPlugin* self,
19 FlMockTextInputPlugin* mock_self = FL_MOCK_TEXT_INPUT_PLUGIN(self);
20 if (mock_self->filter_keypress) {
21 return mock_self->filter_keypress(self, event);
22 }
23 return FALSE;
24}
25
27 FlMockTextInputPluginClass* klass) {
28 FL_TEXT_INPUT_PLUGIN_CLASS(klass)->filter_keypress =
29 mock_text_input_plugin_filter_keypress;
30}
31
32static void fl_mock_text_input_plugin_init(FlMockTextInputPlugin* self) {}
33
34// Creates a mock text_input_plugin
35FlMockTextInputPlugin* fl_mock_text_input_plugin_new(
36 gboolean (*filter_keypress)(FlTextInputPlugin* self, FlKeyEvent* event)) {
37 FlMockTextInputPlugin* self = FL_MOCK_TEXT_INPUT_PLUGIN(
38 g_object_new(fl_mock_text_input_plugin_get_type(), nullptr));
39 self->filter_keypress = filter_keypress;
40 return self;
41}
static void fl_mock_text_input_plugin_init(FlMockTextInputPlugin *self)
G_DEFINE_TYPE(FlMockTextInputPlugin, fl_mock_text_input_plugin, fl_text_input_plugin_get_type()) static gboolean mock_text_input_plugin_filter_keypress(FlTextInputPlugin *self
return FALSE
FlKeyEvent * event
static void fl_mock_text_input_plugin_class_init(FlMockTextInputPluginClass *klass)
FlMockTextInputPlugin * fl_mock_text_input_plugin_new(gboolean(*filter_keypress)(FlTextInputPlugin *self, FlKeyEvent *event))
gboolean(* filter_keypress)(FlTextInputPlugin *self, FlKeyEvent *event)
FlTextInputPlugin parent_instance