Flutter Engine
The Flutter Engine
mock_settings.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/linux/testing/mock_settings.h"
6
7using namespace flutter::testing;
8
9G_DECLARE_FINAL_TYPE(FlMockSettings,
10 fl_mock_settings,
11 FL,
12 MOCK_SETTINGS,
13 GObject)
14
15struct _FlMockSettings {
16 GObject parent_instance;
17 MockSettings* mock;
18};
19
20static void fl_mock_settings_iface_init(FlSettingsInterface* iface);
21
22#define FL_UNUSED(x) (void)x;
23
25 fl_mock_settings,
26 G_TYPE_OBJECT,
27 G_IMPLEMENT_INTERFACE(fl_settings_get_type(),
29 FL_UNUSED(FL_IS_MOCK_SETTINGS))
30
31static void fl_mock_settings_class_init(FlMockSettingsClass* klass) {}
32
34 FlMockSettings* self = FL_MOCK_SETTINGS(settings);
35 return self->mock->fl_settings_get_clock_format(settings);
36}
37
39 FlMockSettings* self = FL_MOCK_SETTINGS(settings);
40 return self->mock->fl_settings_get_color_scheme(settings);
41}
42
44 FlMockSettings* self = FL_MOCK_SETTINGS(settings);
45 return self->mock->fl_settings_get_enable_animations(settings);
46}
47
48static gboolean fl_mock_settings_get_high_contrast(FlSettings* settings) {
49 FlMockSettings* self = FL_MOCK_SETTINGS(settings);
50 return self->mock->fl_settings_get_high_contrast(settings);
51}
52
54 FlMockSettings* self = FL_MOCK_SETTINGS(settings);
55 return self->mock->fl_settings_get_text_scaling_factor(settings);
56}
57
58static void fl_mock_settings_iface_init(FlSettingsInterface* iface) {
59 iface->get_clock_format = fl_mock_settings_get_clock_format;
60 iface->get_color_scheme = fl_mock_settings_get_color_scheme;
61 iface->get_enable_animations = fl_mock_settings_get_enable_animations;
62 iface->get_high_contrast = fl_mock_settings_get_high_contrast;
63 iface->get_text_scaling_factor = fl_mock_settings_get_text_scaling_factor;
64}
65
66static void fl_mock_settings_init(FlMockSettings* self) {}
67
68MockSettings::MockSettings()
69 : instance_(
70 FL_SETTINGS(g_object_new(fl_mock_settings_get_type(), nullptr))) {
71 FL_MOCK_SETTINGS(instance_)->mock = this;
72}
73
75 if (instance_ != nullptr) {
76 g_clear_object(&instance_);
77 }
78}
79
80MockSettings::operator FlSettings*() {
81 return instance_;
82}
FlColorScheme
Definition: fl_settings.h:35
FlClockFormat
Definition: fl_settings.h:21
static FlColorScheme fl_mock_settings_get_color_scheme(FlSettings *settings)
static FlClockFormat fl_mock_settings_get_clock_format(FlSettings *settings)
#define FL_UNUSED(x)
static void fl_mock_settings_iface_init(FlSettingsInterface *iface)
static gdouble fl_mock_settings_get_text_scaling_factor(FlSettings *settings)
static gboolean fl_mock_settings_get_high_contrast(FlSettings *settings)
G_DEFINE_TYPE_WITH_CODE(FlMockSettings, fl_mock_settings, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(fl_settings_get_type(), fl_mock_settings_iface_init) FL_UNUSED(FL_IS_MOCK_SETTINGS)) static void fl_mock_settings_class_init(FlMockSettingsClass *klass)
G_DECLARE_FINAL_TYPE(FlMockSettings, fl_mock_settings, FL, MOCK_SETTINGS, GObject) struct _FlMockSettings
Definition: mock_settings.cc:9
static gboolean fl_mock_settings_get_enable_animations(FlSettings *settings)
static void fl_mock_settings_init(FlMockSettings *self)