5#include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_codec.h"
6#include "flutter/shell/platform/linux/testing/fl_test.h"
7#include "gtest/gtest.h"
13 g_autoptr(GError)
error =
nullptr;
17 EXPECT_EQ(
error,
nullptr);
25 g_autoptr(GError)
error =
nullptr;
37 g_autoptr(GError)
error =
nullptr;
40 EXPECT_EQ(
error,
nullptr);
41 EXPECT_NE(
value,
nullptr);
45TEST(FlBinaryCodecTest, EncodeData) {
46 uint8_t
data[] = {0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF};
49 EXPECT_STREQ(hex_string,
"000102fdfeff");
52TEST(FlBinaryCodecTest, EncodeEmpty) {
55 EXPECT_STREQ(hex_string,
"");
58TEST(FlBinaryCodecTest, EncodeNullptr) {
63TEST(FlBinaryCodecTest, EncodeUnknownType) {
69TEST(FlBinaryCodecTest, DecodeData) {
81TEST(FlBinaryCodecTest, DecodeEmpty) {
87TEST(FlBinaryCodecTest, EncodeDecode) {
90 uint8_t
data[] = {0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF};
93 g_autoptr(GError)
error =
nullptr;
97 EXPECT_EQ(
error,
nullptr);
101 EXPECT_EQ(
error,
nullptr);
102 EXPECT_NE(
output,
nullptr);
G_MODULE_EXPORT FlBinaryCodec * fl_binary_codec_new()
static FlValue * decode_message(const char *hex_string)
TEST(FlBinaryCodecTest, EncodeData)
static void encode_message_error(FlValue *value, GQuark domain, int code)
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_message_codec_decode_message(FlMessageCodec *self, GBytes *message, GError **error)
G_MODULE_EXPORT GBytes * fl_message_codec_encode_message(FlMessageCodec *self, FlValue *message, GError **error)
@ FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE
#define FL_MESSAGE_CODEC_ERROR
const uint8_t uint32_t uint32_t GError ** error
GBytes * hex_string_to_bytes(const gchar *hex_string)
gchar * bytes_to_hex_string(GBytes *bytes)
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_new_null()
G_MODULE_EXPORT const uint8_t * fl_value_get_uint8_list(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_new_uint8_list(const uint8_t *data, size_t data_length)
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
typedefG_BEGIN_DECLS struct _FlValue FlValue
@ FL_VALUE_TYPE_UINT8_LIST
std::shared_ptr< const fml::Mapping > data
#define EXPECT_TRUE(handle)