Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions | Variables
fl_texture_gl_test.cc File Reference
#include "flutter/shell/platform/linux/fl_texture_gl_private.h"
#include "flutter/shell/platform/linux/fl_texture_private.h"
#include "flutter/shell/platform/linux/fl_texture_registrar_private.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_texture.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_texture_registrar.h"
#include "flutter/shell/platform/linux/testing/fl_test.h"
#include "gtest/gtest.h"
#include <epoxy/gl.h>

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)

◆ 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}

◆ 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}
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
#define EXPECT_TRUE(handle)
Definition unit_test.h:685

◆ 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}
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:384

◆ 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

Variable Documentation

◆ kBufferHeight

constexpr uint32_t kBufferHeight = 4u
staticconstexpr

Definition at line 16 of file fl_texture_gl_test.cc.

◆ kBufferWidth

constexpr uint32_t kBufferWidth = 4u
staticconstexpr

Definition at line 15 of file fl_texture_gl_test.cc.

◆ kRealBufferHeight

constexpr uint32_t kRealBufferHeight = 2u
staticconstexpr

Definition at line 18 of file fl_texture_gl_test.cc.

◆ kRealBufferWidth

constexpr uint32_t kRealBufferWidth = 2u
staticconstexpr

Definition at line 17 of file fl_texture_gl_test.cc.