Flutter Linux Embedder
fl_pixel_buffer_texture_test.cc File Reference
#include "flutter/shell/platform/linux/public/flutter_linux/fl_pixel_buffer_texture.h"
#include "flutter/shell/platform/linux/fl_pixel_buffer_texture_private.h"
#include "flutter/shell/platform/linux/fl_texture_private.h"
#include "flutter/shell/platform/linux/fl_texture_registrar_private.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_texture_registrar.h"
#include "flutter/shell/platform/linux/testing/fl_test.h"
#include "flutter/shell/platform/linux/testing/linux_test.h"
#include "gtest/gtest.h"
#include <epoxy/gl.h>

Go to the source code of this file.

Classes

class  FlPixelBufferTextureTest
 

Functions

 G_DECLARE_FINAL_TYPE (FlTestPixelBufferTexture, fl_test_pixel_buffer_texture, FL, TEST_PIXEL_BUFFER_TEXTURE, FlPixelBufferTexture) struct _FlTestPixelBufferTexture
 A simple texture with fixed contents. More...
 
 G_DEFINE_TYPE (FlTestPixelBufferTexture, fl_test_pixel_buffer_texture, fl_pixel_buffer_texture_get_type()) static gboolean fl_test_pixel_buffer_texture_copy_pixels(FlPixelBufferTexture *texture
 
static void fl_test_pixel_buffer_texture_class_init (FlTestPixelBufferTextureClass *klass)
 
static void fl_test_pixel_buffer_texture_init (FlTestPixelBufferTexture *self)
 
static FlTestPixelBufferTexture * fl_test_pixel_buffer_texture_new ()
 
 TEST_F (FlPixelBufferTextureTest, TextureID)
 
 TEST_F (FlPixelBufferTextureTest, PopulateTexture)
 

Variables

static constexpr uint32_t kBufferWidth = 4u
 
static constexpr uint32_t kBufferHeight = 4u
 
static constexpr uint32_t kRealBufferWidth = 2u
 
static constexpr uint32_t kRealBufferHeight = 2u
 
const uint8_t ** out_buffer = buffer
 
const uint8_t uint32_t * width = kRealBufferWidth
 
const uint8_t uint32_t uint32_t * height = kRealBufferHeight
 
const uint8_t uint32_t uint32_t GError ** error
 
static const uint8_t buffer []
 
return TRUE
 

Function Documentation

◆ fl_test_pixel_buffer_texture_class_init()

static void fl_test_pixel_buffer_texture_class_init ( FlTestPixelBufferTextureClass *  klass)
static

Definition at line 57 of file fl_pixel_buffer_texture_test.cc.

58  {
59  FL_PIXEL_BUFFER_TEXTURE_CLASS(klass)->copy_pixels =
60  fl_test_pixel_buffer_texture_copy_pixels;
61 }

◆ fl_test_pixel_buffer_texture_init()

static void fl_test_pixel_buffer_texture_init ( FlTestPixelBufferTexture *  self)
static

Definition at line 63 of file fl_pixel_buffer_texture_test.cc.

63 {}

◆ fl_test_pixel_buffer_texture_new()

static FlTestPixelBufferTexture* fl_test_pixel_buffer_texture_new ( )
static

Definition at line 65 of file fl_pixel_buffer_texture_test.cc.

65  {
66  return FL_TEST_PIXEL_BUFFER_TEXTURE(
67  g_object_new(fl_test_pixel_buffer_texture_get_type(), nullptr));
68 }

Referenced by FlPixelBufferTextureTest::SetUp().

◆ G_DECLARE_FINAL_TYPE()

G_DECLARE_FINAL_TYPE ( FlTestPixelBufferTexture  ,
fl_test_pixel_buffer_texture  ,
FL  ,
TEST_PIXEL_BUFFER_TEXTURE  ,
FlPixelBufferTexture   
)

A simple texture with fixed contents.

Definition at line 21 of file fl_pixel_buffer_texture_test.cc.

28  {
29  FlPixelBufferTexture parent_instance;
30 };

◆ G_DEFINE_TYPE()

G_DEFINE_TYPE ( FlTestPixelBufferTexture  ,
fl_test_pixel_buffer_texture  ,
fl_pixel_buffer_texture_get_type()   
)

◆ TEST_F() [1/2]

TEST_F ( FlPixelBufferTextureTest  ,
PopulateTexture   
)

Definition at line 88 of file fl_pixel_buffer_texture_test.cc.

88  {
89  FlutterOpenGLTexture opengl_texture = {0};
90  g_autoptr(GError) error = nullptr;
92  texture, kBufferWidth, kBufferHeight, &opengl_texture, &error));
93  EXPECT_EQ(error, nullptr);
94  EXPECT_EQ(opengl_texture.width, kRealBufferWidth);
95  EXPECT_EQ(opengl_texture.height, kRealBufferHeight);
96 }
g_autoptr(FlEngine) engine
gboolean fl_pixel_buffer_texture_populate(FlPixelBufferTexture *texture, uint32_t width, uint32_t height, FlutterOpenGLTexture *opengl_texture, GError **error)
static constexpr uint32_t kBufferWidth
static constexpr uint32_t kRealBufferHeight
const uint8_t uint32_t uint32_t GError ** error
static constexpr uint32_t kBufferHeight
static constexpr uint32_t kRealBufferWidth

References error, fl_pixel_buffer_texture_populate(), g_autoptr(), kBufferHeight, kBufferWidth, kRealBufferHeight, and kRealBufferWidth.

◆ TEST_F() [2/2]

TEST_F ( FlPixelBufferTextureTest  ,
TextureID   
)

Definition at line 82 of file fl_pixel_buffer_texture_test.cc.

82  {
83  fl_texture_set_id(FL_TEXTURE(texture), 42);
84  EXPECT_EQ(fl_texture_get_id(FL_TEXTURE(texture)), static_cast<int64_t>(42));
85 }
G_MODULE_EXPORT int64_t fl_texture_get_id(FlTexture *self)
Definition: fl_texture.cc:20
void fl_texture_set_id(FlTexture *self, int64_t id)
Definition: fl_texture.cc:15

References fl_texture_get_id(), and fl_texture_set_id().

Variable Documentation

◆ buffer

const uint8_t buffer[]
static

◆ error

const uint8_t uint32_t uint32_t GError** error
Initial value:
{
EXPECT_TRUE(FL_IS_TEST_PIXEL_BUFFER_TEXTURE(texture))

Definition at line 41 of file fl_pixel_buffer_texture_test.cc.

Referenced by add_view_cb(), add_view_engine_error_cb(), add_view_error_cb(), check_size(), flutter::AccessibilityBridge::CommitUpdates(), decode_error_message(), decode_error_method_call(), decode_error_response(), decode_message(), decode_method_call(), decode_response_with_error(), decode_response_with_success(), encode_error_envelope(), encode_error_message(), encode_message(), encode_message_error(), encode_method_call(), encode_success_envelope(), finish_method(), fl_application_local_command_line(), fl_basic_message_channel_respond(), fl_basic_message_channel_send(), fl_basic_message_channel_send_finish(), fl_binary_codec_encode_message(), fl_binary_messenger_send_on_channel_finish(), fl_binary_messenger_send_response(), fl_engine_add_view_finish(), fl_engine_gl_external_texture_frame_callback(), fl_engine_remove_view_finish(), fl_engine_send_key_event_finish(), fl_engine_send_platform_message_finish(), fl_engine_send_platform_message_response(), fl_engine_start(), fl_event_channel_send(), fl_event_channel_send_error(), fl_json_message_codec_decode(), fl_json_message_codec_decode_message(), fl_json_message_codec_encode(), fl_json_message_codec_encode_message(), fl_json_method_codec_decode_method_call(), fl_json_method_codec_decode_response(), fl_json_method_codec_encode_error_envelope(), fl_json_method_codec_encode_method_call(), fl_json_method_codec_encode_success_envelope(), fl_key_channel_responder_handle_event_finish(), fl_key_embedder_responder_handle_event_finish(), fl_key_event_channel_send_finish(), fl_keyboard_manager_handle_event_finish(), fl_message_codec_decode_message(), fl_message_codec_encode_message(), fl_method_call_respond(), fl_method_call_respond_error(), fl_method_call_respond_not_implemented(), fl_method_call_respond_success(), fl_method_channel_invoke_method(), fl_method_channel_invoke_method_finish(), fl_method_channel_respond(), fl_method_codec_decode_method_call(), fl_method_codec_decode_response(), fl_method_codec_encode_error_envelope(), fl_method_codec_encode_method_call(), fl_method_codec_encode_response(), fl_method_codec_encode_success_envelope(), fl_method_response_get_result(), fl_pixel_buffer_texture_populate(), fl_platform_channel_respond_clipboard_get_data(), fl_platform_channel_respond_clipboard_has_strings(), fl_platform_channel_respond_system_exit_application(), fl_platform_channel_system_request_app_exit_finish(), fl_settings_new(), fl_settings_portal_start(), fl_standard_message_codec_decode_message(), fl_standard_message_codec_encode_message(), fl_standard_message_codec_read_size(), fl_standard_message_codec_read_value(), fl_standard_message_codec_read_value_of_type(), fl_standard_message_codec_real_write_value(), fl_standard_message_codec_write_value(), fl_standard_method_codec_decode_method_call(), fl_standard_method_codec_decode_response(), fl_standard_method_codec_encode_error_envelope(), fl_standard_method_codec_encode_method_call(), fl_standard_method_codec_encode_success_envelope(), fl_string_codec_encode_message(), fl_test_codec_decode_message(), fl_test_codec_decode_method_call(), fl_test_codec_decode_response(), fl_test_codec_encode_error_envelope(), fl_test_codec_encode_message(), fl_test_codec_encode_method_call(), fl_test_codec_encode_success_envelope(), fl_text_input_channel_perform_action_finish(), fl_text_input_channel_update_editing_state_finish(), fl_text_input_channel_update_editing_state_with_deltas_finish(), fl_texture_gl_populate(), G_DECLARE_DERIVABLE_TYPE(), G_DEFINE_TYPE(), get_executable_dir(), get_exit_response(), handle_response(), message_cb(), method_call_cb(), flutter::StreamHandlerFunctions< T >::OnCancelInternal(), flutter::StreamHandlerFunctions< T >::OnListenInternal(), perform_action_response_cb(), read_align(), read_float32_list_value(), read_float64_list_value(), read_float64_value(), read_int32_list_value(), read_int32_value(), read_int64_list_value(), read_int64_value(), read_list_value(), read_map_value(), read_string_value(), read_uint16(), read_uint32(), read_uint8(), read_uint8_list_value(), realize_cb(), remove_view_cb(), remove_view_engine_error_cb(), remove_view_error_cb(), request_app_exit_response_cb(), resize_channel_response_cb(), responder_handle_channel_event_cb(), responder_handle_embedder_event_cb(), send_lifecycle_state(), send_on_channel_finish(), send_response(), set_warns_on_channel_overflow_response_cb(), flutter::EventChannel< T >::SetStreamHandler(), settings_portal_read(), setup_opengl(), flutter::TEST(), TEST(), TEST_F(), test_method_codec_decode_method_call(), test_method_codec_decode_response(), test_method_codec_encode_error_envelope(), test_method_codec_encode_method_call(), test_method_codec_encode_success_envelope(), update_editing_state_response_cb(), update_editing_state_with_deltas_response_cb(), and view_added_cb().

◆ height

* height = kRealBufferHeight

Definition at line 40 of file fl_pixel_buffer_texture_test.cc.

◆ kBufferHeight

constexpr uint32_t kBufferHeight = 4u
staticconstexpr

Definition at line 17 of file fl_pixel_buffer_texture_test.cc.

Referenced by TEST_F().

◆ kBufferWidth

constexpr uint32_t kBufferWidth = 4u
staticconstexpr

Definition at line 16 of file fl_pixel_buffer_texture_test.cc.

Referenced by TEST_F().

◆ kRealBufferHeight

constexpr uint32_t kRealBufferHeight = 2u
staticconstexpr

Definition at line 19 of file fl_pixel_buffer_texture_test.cc.

Referenced by TEST_F().

◆ kRealBufferWidth

constexpr uint32_t kRealBufferWidth = 2u
staticconstexpr

Definition at line 18 of file fl_pixel_buffer_texture_test.cc.

Referenced by TEST_F().

◆ out_buffer

* out_buffer = buffer

Definition at line 38 of file fl_pixel_buffer_texture_test.cc.

◆ TRUE

return TRUE

Definition at line 54 of file fl_pixel_buffer_texture_test.cc.

◆ width

* width = kRealBufferWidth

Definition at line 39 of file fl_pixel_buffer_texture_test.cc.