Flutter Engine
The Flutter Engine
stub_flutter_glfw_api.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
5#include "flutter/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.h"
6
8
9namespace flutter {
10namespace testing {
11
12// static
15}
16
17// static
20}
21
23 std::unique_ptr<StubFlutterGlfwApi> stub)
24 : stub_(std::move(stub)) {
25 previous_stub_ = StubFlutterGlfwApi::GetTestStub();
27}
28
30 StubFlutterGlfwApi::SetTestStub(previous_stub_);
31}
32
33} // namespace testing
34} // namespace flutter
35
36// Forwarding dummy implementations of the C API.
37
41 }
42 return true;
43}
44
48 }
49}
50
52 const FlutterDesktopWindowProperties& window_properties,
53 const FlutterDesktopEngineProperties& engine_properties) {
55 return s_stub_implementation->CreateWindow(window_properties,
56 engine_properties);
57 }
58 return nullptr;
59}
60
64 }
65}
66
68 bool enabled) {
71 }
72}
73
75 const char* title) {
78 }
79}
80
82 uint8_t* pixel_data,
83 int width,
84 int height) {
87 }
88}
89
91 int* x,
92 int* y,
93 int* width,
94 int* height) {
97 }
98}
99
101 int x,
102 int y,
103 int width,
104 int height) {
107 }
108}
109
111 FlutterDesktopSize minimum_size,
112 FlutterDesktopSize maximum_size) {
114 s_stub_implementation->SetSizeLimits(minimum_size, maximum_size);
115 }
116}
117
119 FlutterDesktopWindowRef flutter_window) {
122 }
123 return 1.0;
124}
125
127 FlutterDesktopWindowRef flutter_window,
128 double pixel_ratio) {
130 return s_stub_implementation->SetPixelRatioOverride(pixel_ratio);
131 }
132}
133
136 uint32_t millisecond_timeout) {
139 millisecond_timeout);
140 }
141 return true;
142}
143
145 const FlutterDesktopEngineProperties& properties) {
147 return s_stub_implementation->RunEngine(properties);
148 }
149 return nullptr;
150}
151
154 uint32_t timeout_milliseconds) {
157 }
158}
159
163 }
164 return true;
165}
166
169 // The stub ignores this, so just return an arbitrary non-zero value.
170 return reinterpret_cast<FlutterDesktopWindowRef>(1);
171}
172
175 // The stub ignores this, so just return an arbitrary non-zero value.
176 return reinterpret_cast<FlutterDesktopEngineRef>(3);
177}
178
181 const char* plugin_name) {
182 // The stub ignores this, so just return an arbitrary non-zero value.
183 return reinterpret_cast<FlutterDesktopPluginRegistrarRef>(2);
184}
185
188 // The stub ignores this, so just return an arbitrary non-zero value.
189 return reinterpret_cast<FlutterDesktopWindowRef>(3);
190}
191
194 const char* channel) {
197 }
198}
ScopedStubFlutterGlfwApi(std::unique_ptr< StubFlutterGlfwApi > stub)
virtual void RunEngineEventLoopWithTimeout(uint32_t millisecond_timeout)
virtual void GetWindowFrame(int *x, int *y, int *width, int *height)
virtual FlutterDesktopWindowControllerRef CreateWindow(const FlutterDesktopWindowProperties &window_properties, const FlutterDesktopEngineProperties &engine_properties)
virtual void SetHoverEnabled(bool enabled)
virtual FlutterDesktopEngineRef RunEngine(const FlutterDesktopEngineProperties &properties)
static void SetTestStub(StubFlutterGlfwApi *stub)
virtual void SetWindowFrame(int x, int y, int width, int height)
virtual void SetWindowIcon(uint8_t *pixel_data, int width, int height)
virtual void SetWindowTitle(const char *title)
virtual void SetSizeLimits(FlutterDesktopSize minimum_size, FlutterDesktopSize maximum_size)
virtual void SetPixelRatioOverride(double pixel_ratio)
virtual void PluginRegistrarEnableInputBlocking(const char *channel)
virtual bool RunWindowEventLoopWithTimeout(uint32_t millisecond_timeout)
static StubFlutterGlfwApi * GetTestStub()
FlutterEngine engine
Definition: main.cc:68
double y
double x
Definition: ref_ptr.h:256
int32_t height
int32_t width
FlutterDesktopWindowControllerRef FlutterDesktopCreateWindow(const FlutterDesktopWindowProperties &window_properties, const FlutterDesktopEngineProperties &engine_properties)
static flutter::testing::StubFlutterGlfwApi * s_stub_implementation
void FlutterDesktopDestroyWindow(FlutterDesktopWindowControllerRef controller)
FlutterDesktopWindowRef FlutterDesktopPluginRegistrarGetWindow(FlutterDesktopPluginRegistrarRef registrar)
bool FlutterDesktopInit()
double FlutterDesktopWindowGetScaleFactor(FlutterDesktopWindowRef flutter_window)
void FlutterDesktopWindowSetPixelRatioOverride(FlutterDesktopWindowRef flutter_window, double pixel_ratio)
void FlutterDesktopWindowSetSizeLimits(FlutterDesktopWindowRef flutter_window, FlutterDesktopSize minimum_size, FlutterDesktopSize maximum_size)
FlutterDesktopWindowRef FlutterDesktopGetWindow(FlutterDesktopWindowControllerRef controller)
void FlutterDesktopWindowGetFrame(FlutterDesktopWindowRef flutter_window, int *x, int *y, int *width, int *height)
void FlutterDesktopPluginRegistrarEnableInputBlocking(FlutterDesktopPluginRegistrarRef registrar, const char *channel)
void FlutterDesktopRunEngineEventLoopWithTimeout(FlutterDesktopEngineRef engine, uint32_t timeout_milliseconds)
bool FlutterDesktopShutDownEngine(FlutterDesktopEngineRef engine_ref)
void FlutterDesktopWindowSetHoverEnabled(FlutterDesktopWindowRef flutter_window, bool enabled)
void FlutterDesktopWindowSetFrame(FlutterDesktopWindowRef flutter_window, int x, int y, int width, int height)
FlutterDesktopEngineRef FlutterDesktopRunEngine(const FlutterDesktopEngineProperties &properties)
FlutterDesktopEngineRef FlutterDesktopGetEngine(FlutterDesktopWindowControllerRef controller)
bool FlutterDesktopRunWindowEventLoopWithTimeout(FlutterDesktopWindowControllerRef controller, uint32_t millisecond_timeout)
void FlutterDesktopWindowSetTitle(FlutterDesktopWindowRef flutter_window, const char *title)
void FlutterDesktopTerminate()
void FlutterDesktopWindowSetIcon(FlutterDesktopWindowRef flutter_window, uint8_t *pixel_data, int width, int height)
FlutterDesktopPluginRegistrarRef FlutterDesktopGetPluginRegistrar(FlutterDesktopEngineRef engine, const char *plugin_name)