Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions | Variables
fl_pixel_buffer_texture_test.cc File Reference
#include "flutter/shell/platform/linux/public/flutter_linux/fl_pixel_buffer_texture.h"
#include "flutter/shell/platform/linux/fl_pixel_buffer_texture_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_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 (FlTestPixelBufferTexture, fl_test_pixel_buffer_texture, FL, TEST_PIXEL_BUFFER_TEXTURE, FlPixelBufferTexture) struct _FlTestPixelBufferTexture
 A simple texture with fixed contents.
 
 G_DEFINE_TYPE (FlTestPixelBufferTexture, fl_test_pixel_buffer_texture, fl_pixel_buffer_texture_get_type()) static gboolean fl_test_pixel_buffer_texture_copy_pixels(FlPixelBufferTexture *texture
 
static void fl_test_pixel_buffer_texture_class_init (FlTestPixelBufferTextureClass *klass)
 
static void fl_test_pixel_buffer_texture_init (FlTestPixelBufferTexture *self)
 
static FlTestPixelBufferTexture * fl_test_pixel_buffer_texture_new ()
 
 TEST (FlPixelBufferTextureTest, TextureID)
 
 TEST (FlPixelBufferTextureTest, 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
 
const uint8_t ** out_buffer = buffer
 
const uint8_t uint32_t * width = kRealBufferWidth
 
const uint8_t uint32_t uint32_t * height = kRealBufferHeight
 
const uint8_t uint32_t uint32_t GError ** error
 
static const uint8_t buffer []
 
return TRUE
 

Function Documentation

◆ fl_test_pixel_buffer_texture_class_init()

static void fl_test_pixel_buffer_texture_class_init ( FlTestPixelBufferTextureClass *  klass)
static

Definition at line 56 of file fl_pixel_buffer_texture_test.cc.

57 {
58 FL_PIXEL_BUFFER_TEXTURE_CLASS(klass)->copy_pixels =
59 fl_test_pixel_buffer_texture_copy_pixels;
60}

◆ fl_test_pixel_buffer_texture_init()

static void fl_test_pixel_buffer_texture_init ( FlTestPixelBufferTexture *  self)
static

Definition at line 62 of file fl_pixel_buffer_texture_test.cc.

62{}

◆ fl_test_pixel_buffer_texture_new()

static FlTestPixelBufferTexture * fl_test_pixel_buffer_texture_new ( )
static

Definition at line 64 of file fl_pixel_buffer_texture_test.cc.

64 {
65 return FL_TEST_PIXEL_BUFFER_TEXTURE(
66 g_object_new(fl_test_pixel_buffer_texture_get_type(), nullptr));
67}

◆ G_DECLARE_FINAL_TYPE()

G_DECLARE_FINAL_TYPE ( FlTestPixelBufferTexture  ,
fl_test_pixel_buffer_texture  ,
FL  ,
TEST_PIXEL_BUFFER_TEXTURE  ,
FlPixelBufferTexture   
)

A simple texture with fixed contents.

Definition at line 20 of file fl_pixel_buffer_texture_test.cc.

27 {
28 FlPixelBufferTexture parent_instance;
29};

◆ G_DEFINE_TYPE()

G_DEFINE_TYPE ( FlTestPixelBufferTexture  ,
fl_test_pixel_buffer_texture  ,
fl_pixel_buffer_texture_get_type()   
)

◆ TEST() [1/2]

TEST ( FlPixelBufferTextureTest  ,
PopulateTexture   
)

Definition at line 77 of file fl_pixel_buffer_texture_test.cc.

77 {
78 g_autoptr(FlPixelBufferTexture) texture =
79 FL_PIXEL_BUFFER_TEXTURE(fl_test_pixel_buffer_texture_new());
80 FlutterOpenGLTexture opengl_texture = {0};
81 g_autoptr(GError) error = nullptr;
83 texture, kBufferWidth, kBufferHeight, &opengl_texture, &error));
84 EXPECT_EQ(error, nullptr);
85 EXPECT_EQ(opengl_texture.width, kRealBufferWidth);
86 EXPECT_EQ(opengl_texture.height, kRealBufferHeight);
87}
gboolean fl_pixel_buffer_texture_populate(FlPixelBufferTexture *texture, uint32_t width, uint32_t height, FlutterOpenGLTexture *opengl_texture, GError **error)
static constexpr uint32_t kBufferWidth
static FlTestPixelBufferTexture * fl_test_pixel_buffer_texture_new()
static constexpr uint32_t kRealBufferHeight
const uint8_t uint32_t uint32_t GError ** error
static constexpr uint32_t kBufferHeight
static constexpr uint32_t kRealBufferWidth
FlTexture * texture
size_t height
Height of the texture.
Definition: embedder.h:378
#define EXPECT_TRUE(handle)
Definition: unit_test.h:686

◆ TEST() [2/2]

TEST ( FlPixelBufferTextureTest  ,
TextureID   
)

Definition at line 70 of file fl_pixel_buffer_texture_test.cc.

70 {
71 g_autoptr(FlTexture) texture = FL_TEXTURE(fl_test_pixel_buffer_texture_new());
73 EXPECT_EQ(fl_texture_get_id(texture), static_cast<int64_t>(42));
74}
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

◆ buffer

const uint8_t buffer[]
static
Initial value:
= {0x0a, 0x1a, 0x2a, 0x3a, 0x4a, 0x5a,
0x6a, 0x7a, 0x8a, 0x9a, 0xaa, 0xba,
0xca, 0xda, 0xea, 0xfa}

Definition at line 44 of file fl_pixel_buffer_texture_test.cc.

◆ error

const uint8_t uint32_t uint32_t GError** error
Initial value:
{
EXPECT_TRUE(FL_IS_TEST_PIXEL_BUFFER_TEXTURE(texture))

Definition at line 40 of file fl_pixel_buffer_texture_test.cc.

◆ height

* height = kRealBufferHeight

Definition at line 39 of file fl_pixel_buffer_texture_test.cc.

◆ kBufferHeight

constexpr uint32_t kBufferHeight = 4u
staticconstexpr

Definition at line 16 of file fl_pixel_buffer_texture_test.cc.

◆ kBufferWidth

constexpr uint32_t kBufferWidth = 4u
staticconstexpr

Definition at line 15 of file fl_pixel_buffer_texture_test.cc.

◆ kRealBufferHeight

constexpr uint32_t kRealBufferHeight = 2u
staticconstexpr

Definition at line 18 of file fl_pixel_buffer_texture_test.cc.

◆ kRealBufferWidth

constexpr uint32_t kRealBufferWidth = 2u
staticconstexpr

Definition at line 17 of file fl_pixel_buffer_texture_test.cc.

◆ out_buffer

* out_buffer = buffer

Definition at line 37 of file fl_pixel_buffer_texture_test.cc.

◆ TRUE

return TRUE

Definition at line 53 of file fl_pixel_buffer_texture_test.cc.

◆ width

* width = kRealBufferWidth

Definition at line 38 of file fl_pixel_buffer_texture_test.cc.