5#include "gtest/gtest.h"
13class ImModuleEnv :
public ::testing::Environment {
15 void SetUp()
override {
16 setenv(
"GTK_IM_MODULE",
"gtk-im-context-simple",
true);
20testing::Environment*
const kEnv =
21 testing::AddGlobalTestEnvironment(
new ImModuleEnv);
28 return value -
'a' + 10;
30 return value -
'A' + 10;
37 if (hex_string[0] ==
'\0') {
44 GByteArray* buffer = g_byte_array_new();
45 for (
int i = 0; hex_string[
i] !=
'\0' && hex_string[
i + 1] !=
'\0';
i += 2) {
49 return g_byte_array_free_to_bytes(buffer);
53 GString* hex_string = g_string_new(
"");
56 static_cast<const uint8_t*
>(g_bytes_get_data(bytes, &data_length));
57 for (
size_t i = 0;
i < data_length;
i++) {
58 g_string_append_printf(hex_string,
"%02x", data[
i]);
60 return g_string_free(hex_string, FALSE);
g_byte_array_append(buffer, &type, sizeof(uint8_t))
static uint8_t hex_digit_to_int(char value)
void PrintTo(FlValue *v, std::ostream *os)
static uint8_t parse_hex8(const gchar *hex_string)
GBytes * hex_string_to_bytes(const gchar *hex_string)
gchar * bytes_to_hex_string(GBytes *bytes)
G_MODULE_EXPORT gchar * fl_value_to_string(FlValue *value)
typedefG_BEGIN_DECLS struct _FlValue FlValue