Flutter Linux Embedder
fl_display_monitor_test.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
6 #include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h"
8 
9 #include "gtest/gtest.h"
10 
11 TEST(FlDisplayMonitorTest, Test) {
12  g_autoptr(FlDartProject) project = fl_dart_project_new();
13  g_autoptr(FlEngine) engine = fl_engine_new(project);
14 
15  g_autoptr(GError) error = nullptr;
16  EXPECT_TRUE(fl_engine_start(engine, &error));
17  EXPECT_EQ(error, nullptr);
18 
19  bool called = false;
20  fl_engine_get_embedder_api(engine)->NotifyDisplayUpdate = MOCK_ENGINE_PROC(
21  NotifyDisplayUpdate,
22  ([&called](auto engine, FlutterEngineDisplaysUpdateType update_type,
23  const FlutterEngineDisplay* displays, size_t displays_length) {
24  called = true;
25 
26  EXPECT_EQ(displays_length, 1u);
27 
28  return kSuccess;
29  }));
30 
31  g_autoptr(FlDisplayMonitor) monitor =
32  fl_display_monitor_new(engine, gdk_display_get_default());
33  EXPECT_FALSE(called);
34  fl_display_monitor_start(monitor);
35  EXPECT_TRUE(called);
36 }
fl_engine_get_embedder_api
FlutterEngineProcTable * fl_engine_get_embedder_api(FlEngine *self)
Definition: fl_engine.cc:661
TEST
TEST(FlDisplayMonitorTest, Test)
Definition: fl_display_monitor_test.cc:11
fl_dart_project_new
G_MODULE_EXPORT FlDartProject * fl_dart_project_new()
Definition: fl_dart_project.cc:50
fl_display_monitor_new
FlDisplayMonitor * fl_display_monitor_new(FlEngine *engine, GdkDisplay *display)
Definition: fl_display_monitor.cc:94
fl_engine_private.h
fl_engine_new
G_MODULE_EXPORT FlEngine * fl_engine_new(FlDartProject *project)
Definition: fl_engine.cc:524
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
fl_engine_start
gboolean fl_engine_start(FlEngine *self, GError **error)
Definition: fl_engine.cc:544
fl_display_monitor_start
void fl_display_monitor_start(FlDisplayMonitor *self)
Definition: fl_display_monitor.cc:103
fl_display_monitor.h