5#include "flutter/shell/platform/linux/public/flutter_linux/fl_texture_registrar.h"
6#include "flutter/shell/platform/linux/fl_texture_registrar_private.h"
7#include "flutter/shell/platform/linux/public/flutter_linux/fl_pixel_buffer_texture.h"
8#include "flutter/shell/platform/linux/public/flutter_linux/fl_texture_gl.h"
9#include "flutter/shell/platform/linux/testing/fl_test.h"
10#include "flutter/shell/platform/linux/testing/mock_texture_registrar.h"
11#include "gtest/gtest.h"
25 fl_test_registrar_texture,
27 TEST_REGISTRAR_TEXTURE,
31struct _FlTestRegistrarTexture {
32 FlTextureGL parent_instance;
36 fl_test_registrar_texture,
37 fl_texture_gl_get_type())
39static gboolean fl_test_registrar_texture_populate(FlTextureGL*
texture,
58 FlTestRegistrarTextureClass* klass) {
59 FL_TEXTURE_GL_CLASS(klass)->populate = fl_test_registrar_texture_populate;
65 return FL_TEST_REGISTRAR_TEXTURE(
66 g_object_new(fl_test_registrar_texture_get_type(),
nullptr));
70 g_return_val_if_fail(FL_TEXTURE_REGISTRAR(pointer), ((
void*)NULL));
71 FlTextureRegistrar* registrar = FL_TEXTURE_REGISTRAR(pointer);
74 int64_t*
id =
static_cast<int64_t*
>(
malloc(
sizeof(int64_t)));
80TEST(FlTextureRegistrarTest, MockRegistrar) {
83 EXPECT_TRUE(FL_IS_MOCK_TEXTURE_REGISTRAR(registrar));
86 FL_TEXTURE_REGISTRAR(registrar),
texture));
89 FL_TEXTURE_REGISTRAR(registrar),
texture));
92 FL_TEXTURE_REGISTRAR(registrar),
texture));
125 DISABLED_RegistrarRegisterTextureInMultipleThreads) {
138 pthread_join(threads[t], &
id);
139 ids[t] =
static_cast<int64_t*
>(
id)[0];
static FlEngine * make_mock_engine()
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
static void fl_test_registrar_texture_init(FlTestRegistrarTexture *self)
static constexpr uint32_t kBufferWidth
static void * add_mock_texture_to_registrar(void *pointer)
uint32_t uint32_t uint32_t uint32_t * height
uint32_t uint32_t * format
TEST(FlTextureRegistrarTest, MockRegistrar)
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)
void * malloc(size_t size)
static void MarkTextureFrameAvailable(JNIEnv *env, jobject jcaller, jlong shell_holder, jlong texture_id)
static void RegisterTexture(JNIEnv *env, jobject jcaller, jlong shell_holder, jlong texture_id, jobject surface_texture)
#define EXPECT_TRUE(handle)