#include "flutter/shell/platform/linux/public/flutter_linux/fl_texture_registrar.h"
#include "flutter/shell/platform/linux/fl_texture_registrar_private.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_pixel_buffer_texture.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_texture_gl.h"
#include "flutter/shell/platform/linux/testing/fl_test.h"
#include "flutter/shell/platform/linux/testing/mock_texture_registrar.h"
#include "gtest/gtest.h"
#include <epoxy/gl.h>
#include <gmodule.h>
#include <pthread.h>
Go to the source code of this file.
|
| G_DECLARE_FINAL_TYPE (FlTestRegistrarTexture, fl_test_registrar_texture, FL, TEST_REGISTRAR_TEXTURE, FlTextureGL) struct _FlTestRegistrarTexture |
| A simple texture. More...
|
|
| G_DEFINE_TYPE (FlTestRegistrarTexture, fl_test_registrar_texture, fl_texture_gl_get_type()) static gboolean fl_test_registrar_texture_populate(FlTextureGL *texture |
|
static void | fl_test_registrar_texture_class_init (FlTestRegistrarTextureClass *klass) |
|
static void | fl_test_registrar_texture_init (FlTestRegistrarTexture *self) |
|
static FlTestRegistrarTexture * | fl_test_registrar_texture_new () |
|
static void * | add_mock_texture_to_registrar (void *pointer) |
|
| TEST (FlTextureRegistrarTest, MockRegistrar) |
|
| TEST (FlTextureRegistrarTest, RegisterTexture) |
|
| TEST (FlTextureRegistrarTest, MarkTextureFrameAvailable) |
|
| TEST (FlTextureRegistrarTest, DISABLED_RegistrarRegisterTextureInMultipleThreads) |
|
◆ add_mock_texture_to_registrar()
static void * add_mock_texture_to_registrar |
( |
void * |
pointer | ) |
|
|
static |
Definition at line 69 of file fl_texture_registrar_test.cc.
69 {
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)));
76 pthread_exit(id);
77}
G_MODULE_EXPORT int64_t fl_texture_get_id(FlTexture *self)
G_MODULE_EXPORT gboolean fl_texture_registrar_register_texture(FlTextureRegistrar *self, FlTexture *texture)
static FlTestRegistrarTexture * fl_test_registrar_texture_new()
void * malloc(size_t size)
◆ fl_test_registrar_texture_class_init()
static void fl_test_registrar_texture_class_init |
( |
FlTestRegistrarTextureClass * |
klass | ) |
|
|
static |
◆ fl_test_registrar_texture_init()
static void fl_test_registrar_texture_init |
( |
FlTestRegistrarTexture * |
self | ) |
|
|
static |
◆ fl_test_registrar_texture_new()
static FlTestRegistrarTexture * fl_test_registrar_texture_new |
( |
| ) |
|
|
static |
Definition at line 64 of file fl_texture_registrar_test.cc.
64 {
65 return FL_TEST_REGISTRAR_TEXTURE(
66 g_object_new(fl_test_registrar_texture_get_type(), nullptr));
67}
◆ G_DECLARE_FINAL_TYPE()
G_DECLARE_FINAL_TYPE |
( |
FlTestRegistrarTexture |
, |
|
|
fl_test_registrar_texture |
, |
|
|
FL |
, |
|
|
TEST_REGISTRAR_TEXTURE |
, |
|
|
FlTextureGL |
|
|
) |
| |
◆ G_DEFINE_TYPE()
G_DEFINE_TYPE |
( |
FlTestRegistrarTexture |
, |
|
|
fl_test_registrar_texture |
, |
|
|
fl_texture_gl_get_type() |
|
|
) |
| |
◆ TEST() [1/4]
TEST |
( |
FlTextureRegistrarTest |
, |
|
|
DISABLED_RegistrarRegisterTextureInMultipleThreads |
|
|
) |
| |
Definition at line 124 of file fl_texture_registrar_test.cc.
125 {
130
133 (void*)registrar),
134 0);
135 }
138 pthread_join(threads[t], &id);
139 ids[t] =
static_cast<int64_t*
>(
id)[0];
140 free(id);
141 };
142
145 };
146}
static FlEngine * make_mock_engine()
FlTexture * fl_texture_registrar_lookup_texture(FlTextureRegistrar *self, int64_t texture_id)
FlTextureRegistrar * fl_texture_registrar_new(FlEngine *engine)
static void * add_mock_texture_to_registrar(void *pointer)
static constexpr uint64_t kThreadCount
#define EXPECT_TRUE(handle)
◆ TEST() [2/4]
TEST |
( |
FlTextureRegistrarTest |
, |
|
|
MarkTextureFrameAvailable |
|
|
) |
| |
Definition at line 108 of file fl_texture_registrar_test.cc.
108 {
112
113 EXPECT_FALSE(
118}
G_MODULE_EXPORT gboolean fl_texture_registrar_mark_texture_frame_available(FlTextureRegistrar *self, FlTexture *texture)
◆ TEST() [3/4]
TEST |
( |
FlTextureRegistrarTest |
, |
|
|
MockRegistrar |
|
|
) |
| |
Definition at line 80 of file fl_texture_registrar_test.cc.
80 {
83 EXPECT_TRUE(FL_IS_MOCK_TEXTURE_REGISTRAR(registrar));
84
86 FL_TEXTURE_REGISTRAR(registrar),
texture));
89 FL_TEXTURE_REGISTRAR(registrar),
texture));
92 FL_TEXTURE_REGISTRAR(registrar),
texture));
94}
G_MODULE_EXPORT gboolean fl_texture_registrar_unregister_texture(FlTextureRegistrar *self, FlTexture *texture)
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)
◆ TEST() [4/4]
TEST |
( |
FlTextureRegistrarTest |
, |
|
|
RegisterTexture |
|
|
) |
| |
◆ error
uint32_t uint32_t uint32_t uint32_t GError** error |
◆ format
◆ height
◆ kBufferHeight
constexpr uint32_t kBufferHeight = 4u |
|
staticconstexpr |
◆ kBufferWidth
constexpr uint32_t kBufferWidth = 4u |
|
staticconstexpr |
◆ kRealBufferHeight
constexpr uint32_t kRealBufferHeight = 2u |
|
staticconstexpr |
◆ kRealBufferWidth
constexpr uint32_t kRealBufferWidth = 2u |
|
staticconstexpr |
◆ kThreadCount
constexpr uint64_t kThreadCount = 16u |
|
staticconstexpr |
◆ target
◆ TRUE
◆ width