Flutter Engine
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 "gtest/gtest.h"
#include <epoxy/gl.h>

Go to the source code of this file.

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 (FlPixelBufferTextureTest, TextureID)
 
 TEST (FlPixelBufferTextureTest, PopulateTexture)
 

Variables

static constexpr uint32_t BUFFER_WIDTH = 4u
 
static constexpr uint32_t BUFFER_HEIGHT = 4u
 
static constexpr uint32_t REAL_BUFFER_WIDTH = 2u
 
static constexpr uint32_t REAL_BUFFER_HEIGHT = 2u
 
const uint8_t ** out_buffer = buffer
 
const uint8_t uint32_t * width = REAL_BUFFER_WIDTH
 
const uint8_t uint32_t uint32_t * height = REAL_BUFFER_HEIGHT
 
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 56 of file fl_pixel_buffer_texture_test.cc.

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

◆ fl_test_pixel_buffer_texture_init()

static void fl_test_pixel_buffer_texture_init ( FlTestPixelBufferTexture *  self)
static

Definition at line 62 of file fl_pixel_buffer_texture_test.cc.

62 {}

◆ fl_test_pixel_buffer_texture_new()

static FlTestPixelBufferTexture* fl_test_pixel_buffer_texture_new ( )
static

Definition at line 64 of file fl_pixel_buffer_texture_test.cc.

Referenced by TEST().

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

◆ 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 20 of file fl_pixel_buffer_texture_test.cc.

References fl_pixel_buffer_texture_get_type(), G_DEFINE_TYPE(), and texture.

27  {
28  FlPixelBufferTexture parent_instance;
29 };

◆ G_DEFINE_TYPE()

G_DEFINE_TYPE ( FlTestPixelBufferTexture  ,
fl_test_pixel_buffer_texture  ,
fl_pixel_buffer_texture_get_type()   
)

Referenced by G_DECLARE_FINAL_TYPE().

◆ TEST() [1/2]

TEST ( FlPixelBufferTextureTest  ,
TextureID   
)

Definition at line 70 of file fl_pixel_buffer_texture_test.cc.

References fl_test_pixel_buffer_texture_new(), fl_texture_get_texture_id(), and texture.

70  {
71  // Texture ID is not assigned until the pixel buffer is copied once.
72  g_autoptr(FlTexture) texture = FL_TEXTURE(fl_test_pixel_buffer_texture_new());
74  reinterpret_cast<int64_t>(texture));
75 }
int64_t fl_texture_get_texture_id(FlTexture *self)
Definition: fl_texture.cc:18
static FlTestPixelBufferTexture * fl_test_pixel_buffer_texture_new()
FlTexture * texture

◆ TEST() [2/2]

TEST ( FlPixelBufferTextureTest  ,
PopulateTexture   
)

Definition at line 78 of file fl_pixel_buffer_texture_test.cc.

References BUFFER_HEIGHT, BUFFER_WIDTH, error, fl_pixel_buffer_texture_populate(), fl_test_pixel_buffer_texture_new(), FlutterOpenGLTexture::height, REAL_BUFFER_HEIGHT, REAL_BUFFER_WIDTH, texture, and FlutterOpenGLTexture::width.

78  {
79  g_autoptr(FlPixelBufferTexture) texture =
80  FL_PIXEL_BUFFER_TEXTURE(fl_test_pixel_buffer_texture_new());
81  FlutterOpenGLTexture opengl_texture = {0};
82  g_autoptr(GError) error = nullptr;
84  texture, BUFFER_WIDTH, BUFFER_HEIGHT, &opengl_texture, &error));
85  EXPECT_EQ(error, nullptr);
86  EXPECT_EQ(opengl_texture.width, REAL_BUFFER_WIDTH);
87  EXPECT_EQ(opengl_texture.height, REAL_BUFFER_HEIGHT);
88 }
static constexpr uint32_t BUFFER_HEIGHT
const uint8_t uint32_t uint32_t GError ** error
static constexpr uint32_t BUFFER_WIDTH
gboolean fl_pixel_buffer_texture_populate(FlPixelBufferTexture *texture, uint32_t width, uint32_t height, FlutterOpenGLTexture *opengl_texture, GError **error)
static constexpr uint32_t REAL_BUFFER_HEIGHT
static FlTestPixelBufferTexture * fl_test_pixel_buffer_texture_new()
size_t height
Height of the texture.
Definition: embedder.h:282
FlTexture * texture
static constexpr uint32_t REAL_BUFFER_WIDTH

Variable Documentation

◆ buffer

◆ BUFFER_HEIGHT

constexpr uint32_t BUFFER_HEIGHT = 4u
static

Definition at line 16 of file fl_pixel_buffer_texture_test.cc.

Referenced by TEST().

◆ BUFFER_WIDTH

constexpr uint32_t BUFFER_WIDTH = 4u
static

Definition at line 15 of file fl_pixel_buffer_texture_test.cc.

Referenced by TEST().

◆ error

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

Definition at line 40 of file fl_pixel_buffer_texture_test.cc.

Referenced by _eglGetError(), vulkan::VulkanSwapchain::AcquireSurface(), flutter_runner::FlatlandConnection::AwaitVsyncForSecondaryCallback(), ui::AXTree::AXTree(), bool_failure(), cancel_exception_response_cb(), DartVMInitializer::Cleanup(), FlutterStandardMethodCodec::codecWithReaderWriter:, flutter::AccessibilityBridge::CommitUpdates(), flutter_runner::ComponentV1::Create(), flutter_runner::ComponentV2::Create(), flutter::DartIsolate::CreateRunningRootIsolate(), flutter_runner::testing::FakeSessionTest::CreateSession(), decode_error_message(), decode_error_method_call(), decode_error_response(), decode_error_value(), decode_message(), decode_method_call(), decode_response_with_error(), decode_response_with_success(), echo_response_cb(), scenic::EmbedderView::EmbedView(), encode_error_envelope(), encode_error_message(), encode_message(), encode_message_error(), encode_method_call(), encode_success_envelope(), error_response_cb(), failure_response_cb(), fl_basic_message_channel_send(), fl_engine_gl_clear_current(), fl_engine_gl_external_texture_frame_callback(), fl_engine_gl_make_current(), fl_engine_gl_make_resource_current(), fl_method_channel_invoke_method(), fl_renderer_gl_collect_backing_store(), fl_renderer_gl_create_backing_store(), fl_view_realize(), FlutterEngineCreateAOTData(), G_DECLARE_DERIVABLE_TYPE(), get_executable_dir(), flutter::ApplicationStore::GetApps(), flutter::testing::GetEGLError(), flutter::UIDartState::GetLastError(), flutter_runner::testing::FakeFlatland::graph(), handle_response(), DartVMInitializer::Initialize(), flutter::WindowWin32::InitializeChild(), FlutterEventChannel::initWithName:binaryMessenger:codec:taskQueue:, listen_exception_response_cb(), dart_utils::ElfSnapshot::Load(), flutter::testing::LoadELFSplitSymbolFromFixturesIfNeccessary(), flutter::testing::LoadELFSymbolFromFixturesIfNeccessary(), tonic::FileLoader::LoadPackagesMap(), LogEglError(), LogEmbedderError(), FlutterCallbackCache::lookupCallbackInformation:, dart_runner::DartComponentController::Main(), main(), message_cb(), method_call_cb(), method_call_error_cb(), method_call_error_response_cb(), method_call_not_implemented_cb(), method_call_not_implemented_response_cb(), method_call_success_cb(), method_call_success_response_cb(), method_response_cb(), mock_message_cb(), mock_response_cb(), flutter_runner::FlatlandConnection::NextContentId(), not_implemented_response_cb(), nullptr_args_response_cb(), nullptr_response_cb(), flutter::StreamHandlerFunctions< T >::OnCancelInternal(), tonic::DartMessageHandler::OnHandleMessage(), flutter::StreamHandlerFunctions< T >::OnListenInternal(), flutter::ParseBase64(), flutter::UIDartState::platform_configuration(), flutter::DartIsolate::PrepareForRunningFromKernels(), reassign_method_cb(), dart_runner::DartComponentControllerV2::Run(), tonic::DartMicrotaskQueue::RunMicrotasks(), send_events_events_cb(), send_events_listen_cb(), send_response(), flutter_runner::testing::GfxExternalViewEmbedderTest::session_connection(), flutter::EventChannel< T >::SetStreamHandler(), dart_runner::DartComponentControllerV2::SetUp(), flutter::DartIsolate::Shutdown(), txt::RenderTest::Snapshot(), flutter_runner::testing::GfxSessionConnectionTest::TakeSessionHandle(), TEST(), gfx::TEST(), flutter::testing::TEST_F(), gfx::ToEnclosedRectIgnoringError(), gfx::ToEnclosingRectIgnoringError(), flutter_runner::Engine::WriteProfileToTrace(), and _FlutterTaskRunner::~_FlutterTaskRunner().

◆ height

* height = REAL_BUFFER_HEIGHT

Definition at line 37 of file fl_pixel_buffer_texture_test.cc.

◆ out_buffer

* out_buffer = buffer

Definition at line 37 of file fl_pixel_buffer_texture_test.cc.

◆ REAL_BUFFER_HEIGHT

constexpr uint32_t REAL_BUFFER_HEIGHT = 2u
static

Definition at line 18 of file fl_pixel_buffer_texture_test.cc.

Referenced by TEST().

◆ REAL_BUFFER_WIDTH

constexpr uint32_t REAL_BUFFER_WIDTH = 2u
static

Definition at line 17 of file fl_pixel_buffer_texture_test.cc.

Referenced by TEST().

◆ TRUE

return TRUE

Definition at line 53 of file fl_pixel_buffer_texture_test.cc.

Referenced by channel_closed_cb(), check_pointer_inside(), check_size(), clear_g_call_records(), FlutterKeyboardManagerUnittestsObjC::doublePrimaryResponder, event_box_enter_notify_event(), event_box_leave_notify_event(), event_box_motion_notify_event(), event_box_scroll_event(), fl_accessible_node_do_action(), fl_binary_messenger_platform_message_cb(), fl_engine_send_platform_message_response(), fl_engine_start(), fl_event_channel_send(), fl_event_channel_send_end_of_stream(), fl_event_channel_send_error(), fl_gl_area_draw(), fl_gl_area_init(), fl_gl_area_realize(), fl_json_method_codec_decode_method_call(), fl_keyboard_manager_dispose(), fl_keyboard_manager_handle_event(), fl_keyboard_manager_remove_redispatched(), fl_method_call_respond(), fl_mock_renderer_collect_backing_store(), fl_mock_renderer_create_backing_store(), fl_mock_renderer_create_contexts(), fl_mock_renderer_present_layers(), fl_pixel_buffer_texture_populate(), fl_renderer_clear_current(), fl_renderer_gl_collect_backing_store(), fl_renderer_gl_create_backing_store(), fl_renderer_gl_create_contexts(), fl_renderer_gl_present_layers(), fl_renderer_make_current(), fl_renderer_make_resource_current(), fl_renderer_start(), fl_standard_message_codec_read_size(), fl_standard_message_codec_read_value(), fl_standard_message_codec_write_value(), fl_standard_method_codec_decode_method_call(), fl_task_runner_release_main_thread(), fl_test_codec_decode_method_call(), fl_test_texture_populate(), fl_text_input_plugin_filter_keypress_default(), fl_texture_gl_populate(), fl_view_init(), fl_view_realize(), fl_view_reorder_forall(), fl_view_send_pointer_button_event(), G_DEFINE_TYPE(), g_ptr_array_find_with_equal_func1(), flutter::WindowWin32::HandleMessage(), im_delete_surrounding_cb(), im_retrieve_surrounding_cb(), FlutterEngine::initWithName:, FlutterTextInputPlugin::isFirstResponder, FlutterKeyCallbackGuard::pendTo:withId:, read_align(), read_uint16(), read_uint32(), read_uint8(), FlutterKeyCallbackGuard::resolveTo:, send_response(), FlutterKeyboardManagerUnittestsObjC::singlePrimaryResponder, FlutterKeyboardManagerUnittestsObjC::singleSecondaryResponder, TEST(), flutter::testing::TEST(), ui::TEST_F(), FlutterViewControllerTestObjC::testFlagsChangedEventsArePropagatedIfNotHandled, FlutterViewControllerTestObjC::testKeyEventsAreNotPropagatedIfHandled, FlutterViewControllerTestObjC::testKeyEventsArePropagatedIfNotHandled, FlutterViewControllerTestObjC::testKeyEventsAreSentToFramework, FlutterViewControllerTestObjC::testPerformKeyEquivalentSynthesizesKeyUp, and flutter::testing::MockMessageQueue::Win32PeekMessage().

◆ width

* width = REAL_BUFFER_WIDTH

Definition at line 37 of file fl_pixel_buffer_texture_test.cc.