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,
31 struct _FlTestRegistrarTexture {
32 FlTextureGL parent_instance;
36 fl_test_registrar_texture,
37 fl_texture_gl_get_type())
39 static gboolean fl_test_registrar_texture_populate(FlTextureGL* texture,
45 EXPECT_TRUE(FL_IS_TEST_REGISTRAR_TEXTURE(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)));
80 TEST(FlTextureRegistrarTest, MockRegistrar) {
82 g_autoptr(FlMockTextureRegistrar) registrar = fl_mock_texture_registrar_new();
83 EXPECT_TRUE(FL_IS_MOCK_TEXTURE_REGISTRAR(registrar));
86 FL_TEXTURE_REGISTRAR(registrar), texture));
87 EXPECT_EQ(fl_mock_texture_registrar_get_texture(registrar), texture);
89 FL_TEXTURE_REGISTRAR(registrar), texture));
90 EXPECT_TRUE(fl_mock_texture_registrar_get_frame_available(registrar));
92 FL_TEXTURE_REGISTRAR(registrar), texture));
93 EXPECT_EQ(fl_mock_texture_registrar_get_texture(registrar),
nullptr);
97 TEST(FlTextureRegistrarTest, RegisterTexture) {
108 TEST(FlTextureRegistrarTest, MarkTextureFrameAvailable) {
125 DISABLED_RegistrarRegisterTextureInMultipleThreads) {
138 pthread_join(threads[t], &
id);
139 ids[t] =
static_cast<int64_t*
>(
id)[0];