Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
fl_texture_gl_test.cc File Reference

Go to the source code of this file.

Classes

class  FlTextureGLTest
 

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_F (FlTextureGLTest, TextureID)
 
 TEST_F (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 52 of file fl_texture_gl_test.cc.

52 {
53 FL_TEXTURE_GL_CLASS(klass)->populate = fl_test_texture_populate;
54}
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 56 of file fl_texture_gl_test.cc.

56{}

◆ fl_test_texture_new()

static FlTestTexture * fl_test_texture_new ( )
static

Definition at line 58 of file fl_texture_gl_test.cc.

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

Referenced by FlTextureGLTest::SetUp().

◆ 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 34 of file fl_texture_gl_test.cc.

39 {
40 EXPECT_TRUE(FL_IS_TEST_TEXTURE(texture));
41
42 EXPECT_EQ(*width, kBufferWidth);
43 EXPECT_EQ(*height, kBufferHeight);
44 *target = GL_TEXTURE_2D;
45 *name = 1;
48
49 return TRUE;
50}
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:50
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 21 of file fl_texture_gl_test.cc.

28 {
29 FlTextureGL parent_instance;
30};

◆ TEST_F() [1/2]

TEST_F ( FlTextureGLTest  ,
PopulateTexture   
)

Definition at line 78 of file fl_texture_gl_test.cc.

78 {
79 FlutterOpenGLTexture opengl_texture = {0};
80 g_autoptr(GError) error = nullptr;
82 &opengl_texture, &error));
83 EXPECT_EQ(error, nullptr);
84 EXPECT_EQ(opengl_texture.width, kRealBufferWidth);
85 EXPECT_EQ(opengl_texture.height, kRealBufferHeight);
86}
g_autoptr(FlEngine) engine
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)
size_t height
Height of the texture.
Definition embedder.h:536

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

◆ TEST_F() [2/2]

TEST_F ( FlTextureGLTest  ,
TextureID   
)

Definition at line 72 of file fl_texture_gl_test.cc.

72 {
73 fl_texture_set_id(FL_TEXTURE(texture), 42);
74 EXPECT_EQ(fl_texture_get_id(FL_TEXTURE(texture)), static_cast<int64_t>(42));
75}
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_texture_get_id(), fl_texture_set_id(), and texture.

Variable Documentation

◆ kBufferHeight

constexpr uint32_t kBufferHeight = 4u
staticconstexpr

Definition at line 17 of file fl_texture_gl_test.cc.

Referenced by fl_test_texture_populate(), and TEST_F().

◆ kBufferWidth

constexpr uint32_t kBufferWidth = 4u
staticconstexpr

Definition at line 16 of file fl_texture_gl_test.cc.

Referenced by fl_test_texture_populate(), and TEST_F().

◆ kRealBufferHeight

constexpr uint32_t kRealBufferHeight = 2u
staticconstexpr

Definition at line 19 of file fl_texture_gl_test.cc.

Referenced by fl_test_texture_populate(), and TEST_F().

◆ kRealBufferWidth

constexpr uint32_t kRealBufferWidth = 2u
staticconstexpr

Definition at line 18 of file fl_texture_gl_test.cc.

Referenced by fl_test_texture_populate(), and TEST_F().