5#include "gtest/gtest.h"
9#include "flutter/fml/logging.h"
10#include "flutter/shell/platform/linux/fl_backing_store_provider.h"
11#include "flutter/shell/platform/linux/testing/fl_test_gtk_logs.h"
12#include "flutter/shell/platform/linux/testing/mock_renderer.h"
14TEST(FlRendererTest, RestoresGLState) {
15 constexpr int kWidth = 100;
22 g_autoptr(FlBackingStoreProvider) backing_store_provider =
38 std::array<const FlutterLayer*, 1> layers = {&layer};
40 constexpr GLuint kFakeTextureName = 123;
41 glBindTexture(GL_TEXTURE_2D, kFakeTextureName);
47 GLuint texture_2d_binding;
48 glGetIntegerv(GL_TEXTURE_BINDING_2D,
49 reinterpret_cast<GLint*
>(&texture_2d_binding));
50 EXPECT_EQ(texture_2d_binding, kFakeTextureName);
52 g_object_ref_sink(view);
60TEST(FlRendererTest, RefreshRate) {
66 gdouble result_refresh_rate =
@ kFlutterLayerContentTypeBackingStore
@ kFlutterBackingStoreTypeOpenGL
FlBackingStoreProvider * fl_backing_store_provider_new(int width, int height)
G_MODULE_EXPORT FlDartProject * fl_dart_project_new()
gboolean fl_renderer_present_layers(FlRenderer *self, const FlutterLayer **layers, size_t layers_count)
gboolean fl_renderer_start(FlRenderer *self, FlView *view)
void fl_renderer_render(FlRenderer *self, int width, int height)
gdouble fl_renderer_get_refresh_rate(FlRenderer *self)
void fl_renderer_wait_for_frame(FlRenderer *self, int target_width, int target_height)
TEST(FlRendererTest, RestoresGLState)
static gdouble renderer_get_refresh_rate(FlRenderer *renderer)
static constexpr double kExpectedRefreshRate
G_MODULE_EXPORT FlView * fl_view_new(FlDartProject *project)
FlMockRenderer * fl_mock_renderer_new(FlMockRendererGetRefreshRate get_refresh_rate)
void fl_ensure_gtk_init(GLogWriterFunc writer)
Ensures that GTK has been initialized and starts monitoring logs.
FlutterBackingStoreType type
Specifies the type of backing store.
FlutterOpenGLBackingStore open_gl
The description of the OpenGL backing store.
FlutterLayerContentType type
const FlutterBackingStore * backing_store
FlutterSize size
The size of the layer (in physical pixels).
FlutterOpenGLFramebuffer framebuffer
void * user_data
User data to be returned on the invocation of the destruction callback.