Flutter Linux Embedder
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 }
G_MODULE_EXPORT FlDartProject * fl_dart_project_new()
void fl_display_monitor_start(FlDisplayMonitor *self)
FlDisplayMonitor * fl_display_monitor_new(FlEngine *engine, GdkDisplay *display)
TEST(FlDisplayMonitorTest, Test)
FlutterEngineProcTable * fl_engine_get_embedder_api(FlEngine *self)
Definition: fl_engine.cc:661
gboolean fl_engine_start(FlEngine *self, GError **error)
Definition: fl_engine.cc:544
G_MODULE_EXPORT FlEngine * fl_engine_new(FlDartProject *project)
Definition: fl_engine.cc:524
const uint8_t uint32_t uint32_t GError ** error