Flutter Engine
 
Loading...
Searching...
No Matches
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.
 
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}
static gboolean fl_test_texture_populate(FlTextureGL *texture, uint32_t *target, uint32_t *name, uint32_t *width, uint32_t *height, GError **error)

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(), and 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}
return TRUE
static constexpr uint32_t kBufferWidth
static constexpr uint32_t kRealBufferHeight
static constexpr uint32_t kBufferHeight
static constexpr uint32_t kRealBufferWidth
uint32_t * target
const char * name
Definition fuchsia.cc:49
FlTexture * texture
int32_t height
int32_t width

References height, kBufferHeight, kBufferWidth, kRealBufferHeight, kRealBufferWidth, name, target, texture, 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}
g_autoptr(GMutexLocker) locker
const uint8_t uint32_t uint32_t GError ** error
gboolean fl_texture_gl_populate(FlTextureGL *self, uint32_t width, uint32_t height, FlutterOpenGLTexture *opengl_texture, GError **error)
static FlTestTexture * fl_test_texture_new()
size_t height
Height of the texture.
Definition embedder.h:529

References error, fl_test_texture_new(), fl_texture_gl_populate(), g_autoptr(), FlutterOpenGLTexture::height, kBufferHeight, kBufferWidth, kRealBufferHeight, kRealBufferWidth, texture, and FlutterOpenGLTexture::width.

◆ 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());
65 EXPECT_EQ(fl_texture_get_id(texture), static_cast<int64_t>(42));
66}
G_MODULE_EXPORT int64_t fl_texture_get_id(FlTexture *self)
Definition fl_texture.cc:20
void fl_texture_set_id(FlTexture *self, int64_t id)
Definition fl_texture.cc:15

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

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().