Flutter Linux Embedder
fl_view_test.cc File Reference
#include "flutter/shell/platform/linux/public/flutter_linux/fl_view.h"
#include "flutter/shell/platform/linux/testing/fl_test_gtk_logs.h"
#include "gtest/gtest.h"

Go to the source code of this file.

Functions

 TEST (FlViewTest, GetEngine)
 
 TEST (FlViewTest, StateUpdateDoesNotHappenInInit)
 

Function Documentation

◆ TEST() [1/2]

TEST ( FlViewTest  ,
GetEngine   
)

Definition at line 10 of file fl_view_test.cc.

10  {
11  flutter::testing::fl_ensure_gtk_init();
12  g_autoptr(FlDartProject) project = fl_dart_project_new();
13  g_autoptr(FlView) view = fl_view_new(project);
14 
15  // Check the engine is immediately available (i.e. before the widget is
16  // realized).
17  FlEngine* engine = fl_view_get_engine(view);
18  EXPECT_NE(engine, nullptr);
19 
20  g_object_ref_sink(view);
21 }

References fl_dart_project_new(), fl_view_get_engine(), and fl_view_new().

◆ TEST() [2/2]

TEST ( FlViewTest  ,
StateUpdateDoesNotHappenInInit   
)

Definition at line 23 of file fl_view_test.cc.

23  {
24  flutter::testing::fl_ensure_gtk_init();
25  g_autoptr(FlDartProject) project = fl_dart_project_new();
26  g_autoptr(FlView) view = fl_view_new(project);
27  // Check that creating a view doesn't try to query the window state in
28  // initialization, causing a critical log to be issued.
29  EXPECT_EQ(
30  flutter::testing::fl_get_received_gtk_log_levels() & G_LOG_LEVEL_CRITICAL,
31  (GLogLevelFlags)0x0);
32  g_object_ref_sink(view);
33 }

References fl_dart_project_new(), and fl_view_new().

fl_dart_project_new
G_MODULE_EXPORT FlDartProject * fl_dart_project_new()
Definition: fl_dart_project.cc:50
fl_view_new
G_MODULE_EXPORT FlView * fl_view_new(FlDartProject *project)
Definition: fl_view.cc:837
fl_view_get_engine
G_MODULE_EXPORT FlEngine * fl_view_get_engine(FlView *self)
Definition: fl_view.cc:842