Flutter Linux Embedder
fl_texture_gl_test.cc File Reference

Go to the source code of this file.

Functions

 G_DECLARE_FINAL_TYPE (FlTestTexture, fl_test_texture, FL, TEST_TEXTURE, FlTextureGL) struct _FlTestTexture
 A simple texture. More...
 
static gboolean fl_test_texture_populate (FlTextureGL *texture, uint32_t *target, uint32_t *name, uint32_t *width, uint32_t *height, GError **error)
 
static void fl_test_texture_class_init (FlTestTextureClass *klass)
 
static void fl_test_texture_init (FlTestTexture *self)
 
static FlTestTexture * fl_test_texture_new ()
 
 TEST (FlTextureGLTest, TextureID)
 
 TEST (FlTextureGLTest, PopulateTexture)
 

Variables

static constexpr uint32_t kBufferWidth = 4u
 
static constexpr uint32_t kBufferHeight = 4u
 
static constexpr uint32_t kRealBufferWidth = 2u
 
static constexpr uint32_t kRealBufferHeight = 2u
 

Function Documentation

◆ fl_test_texture_class_init()

static void fl_test_texture_class_init ( FlTestTextureClass *  klass)
static

Definition at line 51 of file fl_texture_gl_test.cc.

51  {
52  FL_TEXTURE_GL_CLASS(klass)->populate = fl_test_texture_populate;
53 }

References fl_test_texture_populate().

◆ fl_test_texture_init()

static void fl_test_texture_init ( FlTestTexture *  self)
static

Definition at line 55 of file fl_texture_gl_test.cc.

55 {}

◆ fl_test_texture_new()

static FlTestTexture* fl_test_texture_new ( )
static

Definition at line 57 of file fl_texture_gl_test.cc.

57  {
58  return FL_TEST_TEXTURE(g_object_new(fl_test_texture_get_type(), nullptr));
59 }

Referenced by TEST().

◆ fl_test_texture_populate()

static gboolean fl_test_texture_populate ( FlTextureGL *  texture,
uint32_t *  target,
uint32_t *  name,
uint32_t *  width,
uint32_t *  height,
GError **  error 
)
static

Definition at line 33 of file fl_texture_gl_test.cc.

38  {
39  EXPECT_TRUE(FL_IS_TEST_TEXTURE(texture));
40 
41  EXPECT_EQ(*width, kBufferWidth);
42  EXPECT_EQ(*height, kBufferHeight);
43  *target = GL_TEXTURE_2D;
44  *name = 1;
47 
48  return TRUE;
49 }

References height, kBufferHeight, kBufferWidth, kRealBufferHeight, kRealBufferWidth, target, TRUE, and width.

Referenced by fl_test_texture_class_init().

◆ G_DECLARE_FINAL_TYPE()

G_DECLARE_FINAL_TYPE ( FlTestTexture  ,
fl_test_texture  ,
FL  ,
TEST_TEXTURE  ,
FlTextureGL   
)

A simple texture.

Definition at line 20 of file fl_texture_gl_test.cc.

27  {
28  FlTextureGL parent_instance;
29 };

◆ TEST() [1/2]

TEST ( FlTextureGLTest  ,
PopulateTexture   
)

Definition at line 69 of file fl_texture_gl_test.cc.

69  {
70  g_autoptr(FlTextureGL) texture = FL_TEXTURE_GL(fl_test_texture_new());
71  FlutterOpenGLTexture opengl_texture = {0};
72  g_autoptr(GError) error = nullptr;
74  &opengl_texture, &error));
75  EXPECT_EQ(error, nullptr);
76  EXPECT_EQ(opengl_texture.width, kRealBufferWidth);
77  EXPECT_EQ(opengl_texture.height, kRealBufferHeight);
78 }

References error, fl_test_texture_new(), fl_texture_gl_populate(), kBufferHeight, kBufferWidth, kRealBufferHeight, and kRealBufferWidth.

◆ TEST() [2/2]

TEST ( FlTextureGLTest  ,
TextureID   
)

Definition at line 62 of file fl_texture_gl_test.cc.

62  {
63  g_autoptr(FlTexture) texture = FL_TEXTURE(fl_test_texture_new());
64  fl_texture_set_id(texture, 42);
65  EXPECT_EQ(fl_texture_get_id(texture), static_cast<int64_t>(42));
66 }

References fl_test_texture_new(), fl_texture_get_id(), and fl_texture_set_id().

Variable Documentation

◆ kBufferHeight

constexpr uint32_t kBufferHeight = 4u
staticconstexpr

Definition at line 16 of file fl_texture_gl_test.cc.

Referenced by fl_test_texture_populate(), and TEST().

◆ kBufferWidth

constexpr uint32_t kBufferWidth = 4u
staticconstexpr

Definition at line 15 of file fl_texture_gl_test.cc.

Referenced by fl_test_texture_populate(), and TEST().

◆ kRealBufferHeight

constexpr uint32_t kRealBufferHeight = 2u
staticconstexpr

Definition at line 18 of file fl_texture_gl_test.cc.

Referenced by fl_test_texture_populate(), and TEST().

◆ kRealBufferWidth

constexpr uint32_t kRealBufferWidth = 2u
staticconstexpr

Definition at line 17 of file fl_texture_gl_test.cc.

Referenced by fl_test_texture_populate(), and TEST().

kBufferHeight
static constexpr uint32_t kBufferHeight
Definition: fl_texture_gl_test.cc:16
fl_test_texture_populate
static gboolean fl_test_texture_populate(FlTextureGL *texture, uint32_t *target, uint32_t *name, uint32_t *width, uint32_t *height, GError **error)
Definition: fl_texture_gl_test.cc:33
fl_texture_set_id
void fl_texture_set_id(FlTexture *self, int64_t id)
Definition: fl_texture.cc:15
height
G_BEGIN_DECLS int height
Definition: fl_backing_store_provider.h:37
TRUE
return TRUE
Definition: fl_pixel_buffer_texture_test.cc:53
fl_texture_get_id
G_MODULE_EXPORT int64_t fl_texture_get_id(FlTexture *self)
Definition: fl_texture.cc:20
kBufferWidth
static constexpr uint32_t kBufferWidth
Definition: fl_texture_gl_test.cc:15
fl_texture_gl_populate
gboolean fl_texture_gl_populate(FlTextureGL *self, uint32_t width, uint32_t height, FlutterOpenGLTexture *opengl_texture, GError **error)
Definition: fl_texture_gl.cc:50
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
target
uint32_t * target
Definition: fl_texture_registrar_test.cc:40
kRealBufferHeight
static constexpr uint32_t kRealBufferHeight
Definition: fl_texture_gl_test.cc:18
width
const uint8_t uint32_t * width
Definition: fl_pixel_buffer_texture_test.cc:38
fl_test_texture_new
static FlTestTexture * fl_test_texture_new()
Definition: fl_texture_gl_test.cc:57
kRealBufferWidth
static constexpr uint32_t kRealBufferWidth
Definition: fl_texture_gl_test.cc:17