Flutter Linux Embedder
fl_keyboard_manager_test.cc File Reference
#include "flutter/shell/platform/linux/fl_keyboard_manager.h"
#include <cstring>
#include <vector>
#include "flutter/shell/platform/embedder/test_utils/key_codes.g.h"
#include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h"
#include "flutter/shell/platform/linux/fl_engine_private.h"
#include "flutter/shell/platform/linux/key_mapping.h"
#include "flutter/shell/platform/linux/testing/fl_mock_binary_messenger.h"
#include "flutter/shell/platform/linux/testing/mock_keymap.h"
#include "gtest/gtest.h"

Go to the source code of this file.

Classes

struct  CallRecord
 

Macros

#define VERIFY_DOWN(OUT_LOGICAL, OUT_CHAR)
 

Functions

static CallRecordcall_record_new (const FlutterKeyEvent *event, FlutterKeyEventCallback callback, void *callback_user_data)
 
static void call_record_free (CallRecord *record)
 
static void call_record_respond (CallRecord *record, bool handled)
 

Macro Definition Documentation

◆ VERIFY_DOWN

#define VERIFY_DOWN (   OUT_LOGICAL,
  OUT_CHAR 
)
Value:
EXPECT_EQ(static_cast<CallRecord*>(g_ptr_array_index(call_records, 0)) \
->event_type, \
kFlutterKeyEventTypeDown); \
EXPECT_EQ(static_cast<CallRecord*>(g_ptr_array_index(call_records, 0)) \
->event_logical, \
(OUT_LOGICAL)); \
EXPECT_STREQ(static_cast<CallRecord*>(g_ptr_array_index(call_records, 0)) \
->event_character, \
(OUT_CHAR)); \
EXPECT_EQ(static_cast<CallRecord*>(g_ptr_array_index(call_records, 0)) \
->event_synthesized, \
false); \
g_ptr_array_set_size(call_records, 0)

Definition at line 19 of file fl_keyboard_manager_test.cc.

Function Documentation

◆ call_record_free()

static void call_record_free ( CallRecord record)
static

Definition at line 58 of file fl_keyboard_manager_test.cc.

58  {
59  g_free(record->event_character);
60  g_free(record);
61 }

References CallRecord::event_character.

◆ call_record_new()

static CallRecord* call_record_new ( const FlutterKeyEvent *  event,
FlutterKeyEventCallback  callback,
void *  callback_user_data 
)
static

Definition at line 44 of file fl_keyboard_manager_test.cc.

46  {
47  CallRecord* record = g_new0(CallRecord, 1);
48  record->event_type = event->type;
49  record->event_physical = event->physical;
50  record->event_logical = event->logical;
51  record->event_character = g_strdup(event->character);
52  record->event_synthesized = event->synthesized;
53  record->callback = callback;
54  record->callback_user_data = callback_user_data;
55  return record;
56 }

References CallRecord::callback, CallRecord::callback_user_data, CallRecord::event_character, CallRecord::event_logical, CallRecord::event_physical, CallRecord::event_synthesized, and CallRecord::event_type.

◆ call_record_respond()

static void call_record_respond ( CallRecord record,
bool  handled 
)
static

Definition at line 63 of file fl_keyboard_manager_test.cc.

63  {
64  if (record->callback != nullptr) {
65  record->callback(handled, record->callback_user_data);
66  }
67 }

References CallRecord::callback, and CallRecord::callback_user_data.

CallRecord::event_synthesized
bool event_synthesized
Definition: fl_keyboard_manager_test.cc:39
CallRecord::event_logical
uint64_t event_logical
Definition: fl_keyboard_manager_test.cc:37
CallRecord::event_physical
uint64_t event_physical
Definition: fl_keyboard_manager_test.cc:36
CallRecord
Definition: fl_keyboard_manager_test.cc:34
CallRecord::event_type
FlutterKeyEventType event_type
Definition: fl_keyboard_manager_test.cc:35
CallRecord::callback
FlutterKeyEventCallback callback
Definition: fl_keyboard_manager_test.cc:40
CallRecord::callback_user_data
void * callback_user_data
Definition: fl_keyboard_manager_test.cc:41
CallRecord::event_character
gchar * event_character
Definition: fl_keyboard_manager_test.cc:38