13#include "gtest/gtest.h"
26 fl_test_registrar_texture,
28 TEST_REGISTRAR_TEXTURE,
32struct _FlTestRegistrarTexture {
33 FlTextureGL parent_instance;
37 fl_test_registrar_texture,
38 fl_texture_gl_get_type())
40static gboolean fl_test_registrar_texture_populate(FlTextureGL*
texture,
46 EXPECT_TRUE(FL_IS_TEST_REGISTRAR_TEXTURE(
texture));
59 FlTestRegistrarTextureClass* klass) {
60 FL_TEXTURE_GL_CLASS(klass)->populate = fl_test_registrar_texture_populate;
66 return FL_TEST_REGISTRAR_TEXTURE(
67 g_object_new(fl_test_registrar_texture_get_type(),
nullptr));
71 g_return_val_if_fail(FL_IS_TEXTURE_REGISTRAR(pointer),
nullptr);
72 FlTextureRegistrar* registrar = FL_TEXTURE_REGISTRAR(pointer);
75 int64_t*
id = g_new0(int64_t, 1);
86 EXPECT_TRUE(FL_IS_MOCK_TEXTURE_REGISTRAR(registrar));
89 FL_TEXTURE_REGISTRAR(registrar),
texture));
92 FL_TEXTURE_REGISTRAR(registrar),
texture));
95 FL_TEXTURE_REGISTRAR(registrar),
texture));
101 bool register_called =
false;
105 register_called =
true;
108 bool unregister_called =
false;
112 unregister_called =
true;
120 EXPECT_FALSE(register_called);
122 EXPECT_TRUE(register_called);
123 EXPECT_FALSE(unregister_called);
125 EXPECT_TRUE(unregister_called);
130 bool register_called =
false;
134 register_called =
true;
139 UnregisterExternalTexture,
143 MarkExternalTextureFrameAvailable,
150 EXPECT_TRUE(register_called);
159 RegisterExternalTexture,
163 UnregisterExternalTexture,
184 RegisterExternalTexture,
188 UnregisterExternalTexture,
198 ASSERT_NE(threads[t],
nullptr);
201 g_autofree int64_t*
id =
static_cast<int64_t*
>(g_thread_join(threads[t]));
202 ASSERT_NE(
id,
nullptr);
g_autoptr(FlEngine) engine
FlutterEngineProcTable * fl_engine_get_embedder_api(FlEngine *self)
G_MODULE_EXPORT int64_t fl_texture_get_id(FlTexture *self)
G_MODULE_EXPORT gboolean fl_texture_registrar_register_texture(FlTextureRegistrar *self, FlTexture *texture)
G_MODULE_EXPORT gboolean fl_texture_registrar_unregister_texture(FlTextureRegistrar *self, FlTexture *texture)
G_MODULE_EXPORT gboolean fl_texture_registrar_mark_texture_frame_available(FlTextureRegistrar *self, FlTexture *texture)
FlTexture * fl_texture_registrar_lookup_texture(FlTextureRegistrar *self, int64_t texture_id)
FlTextureRegistrar * fl_texture_registrar_new(FlEngine *engine)
uint32_t uint32_t uint32_t uint32_t GError ** error
TEST_F(FlTextureRegistrarTest, MockRegistrar)
static void fl_test_registrar_texture_init(FlTestRegistrarTexture *self)
static gpointer add_mock_texture_to_registrar(gpointer pointer)
static constexpr uint32_t kBufferWidth
uint32_t uint32_t uint32_t uint32_t * height
uint32_t uint32_t * format
uint32_t uint32_t uint32_t * width
G_DEFINE_TYPE(FlTestRegistrarTexture, fl_test_registrar_texture, fl_texture_gl_get_type()) static gboolean fl_test_registrar_texture_populate(FlTextureGL *texture
static constexpr uint32_t kRealBufferHeight
G_DECLARE_FINAL_TYPE(FlTestRegistrarTexture, fl_test_registrar_texture, FL, TEST_REGISTRAR_TEXTURE, FlTextureGL) struct _FlTestRegistrarTexture
A simple texture.
static void fl_test_registrar_texture_class_init(FlTestRegistrarTextureClass *klass)
static constexpr uint32_t kBufferHeight
static constexpr uint64_t kThreadCount
static FlTestRegistrarTexture * fl_test_registrar_texture_new()
static constexpr uint32_t kRealBufferWidth
FlTexture * fl_mock_texture_registrar_get_texture(FlMockTextureRegistrar *self)
FlMockTextureRegistrar * fl_mock_texture_registrar_new()
gboolean fl_mock_texture_registrar_get_frame_available(FlMockTextureRegistrar *self)
#define MOCK_ENGINE_PROC(proc, mock_impl)
FlutterEngineRegisterExternalTextureFnPtr RegisterExternalTexture
FlutterEngineUnregisterExternalTextureFnPtr UnregisterExternalTexture
FlutterEngineMarkExternalTextureFrameAvailableFnPtr MarkExternalTextureFrameAvailable