Flutter Engine
 
Loading...
Searching...
No Matches
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
8
9#include "gtest/gtest.h"
10
11TEST(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;
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 =
33 EXPECT_FALSE(called);
35 EXPECT_TRUE(called);
36}
@ kSuccess
Definition embedder.h:73
FlutterEngineDisplaysUpdateType
Definition embedder.h:2318
FlutterEngine engine
Definition main.cc:84
g_autoptr(GMutexLocker) locker
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)
G_MODULE_EXPORT FlEngine * fl_engine_new(FlDartProject *project)
Definition fl_engine.cc:697
FlutterEngineProcTable * fl_engine_get_embedder_api(FlEngine *self)
Definition fl_engine.cc:868
gboolean fl_engine_start(FlEngine *self, GError **error)
Definition fl_engine.cc:726
const uint8_t uint32_t uint32_t GError ** error
GdkDisplay * gdk_display_get_default()
Definition mock_gtk.cc:65
std::vector< FlutterEngineDisplay > * displays
#define MOCK_ENGINE_PROC(proc, mock_impl)
FlutterEngineNotifyDisplayUpdateFnPtr NotifyDisplayUpdate
Definition embedder.h:3745