feat(port): add ColorSchemeResolver interfaces for unified dark mode detection
- commit
- ed7e2078299d373ab182f0cc261445ed08c48925
- author
- bnema · · 2025-12-29 20:50 UTC
- parent
- e9a1267
- signature
- GPG Unverified
2B82207D370127A0The key is unknown
3 files · +479 -0
M .mockery.yaml +2 -0
| @@ -21,6 +21,8 @@ packages: | |||
| 21 | 21 | MemoryPressureApplier: {} | |
| 22 | 22 | WebKitContextProvider: {} | |
| 23 | 23 | HardwareSurveyor: {} | |
| 24 | + | ColorSchemeDetector: {} | |
| 25 | + | ColorSchemeResolver: {} | |
| 24 | 26 | github.com/bnema/dumber/internal/domain/repository: | |
| 25 | 27 | config: | |
| 26 | 28 | dir: '{{.InterfaceDir}}/mocks' | |
| @@ -21,6 +21,8 @@ packages: | |||||
| 21 | MemoryPressureApplier: {} | 21 | MemoryPressureApplier: {} | ||
| 22 | WebKitContextProvider: {} | 22 | WebKitContextProvider: {} | ||
| 23 | HardwareSurveyor: {} | 23 | HardwareSurveyor: {} | ||
| 24 | + | ColorSchemeDetector: {} | |||
| 25 | + | ColorSchemeResolver: {} | |||
| 24 | github.com/bnema/dumber/internal/domain/repository: | 26 | github.com/bnema/dumber/internal/domain/repository: | ||
| 25 | config: | 27 | config: | ||
| 26 | dir: '{{.InterfaceDir}}/mocks' | 28 | dir: '{{.InterfaceDir}}/mocks' | ||
A internal/application/port/color_scheme.go +57 -0
| @@ -0,0 +1,57 @@ | |||
| 1 | + | package port | |
| 2 | + | ||
| 3 | + | // ColorSchemePreference represents the resolved color scheme preference. | |
| 4 | + | type ColorSchemePreference struct { | |
| 5 | + | // PrefersDark indicates whether dark mode is preferred. | |
| 6 | + | PrefersDark bool | |
| 7 | + | ||
| 8 | + | // Source identifies which detector provided this preference. | |
| 9 | + | // Empty string means fallback was used. | |
| 10 | + | Source string | |
| 11 | + | } | |
| 12 | + | ||
| 13 | + | // ColorSchemeDetector detects the system's color scheme preference. | |
| 14 | + | // Multiple detectors can be registered with different priorities. | |
| 15 | + | type ColorSchemeDetector interface { | |
| 16 | + | // Name returns a human-readable name for this detector. | |
| 17 | + | Name() string | |
| 18 | + | ||
| 19 | + | // Priority returns the detector's priority. | |
| 20 | + | // Higher values = higher priority (checked first). | |
| 21 | + | // Recommended ranges: | |
| 22 | + | // - 100+: Runtime detectors (libadwaita, GTK Settings) | |
| 23 | + | // - 50+: Config file detectors | |
| 24 | + | // - 10+: Fallback detectors (gsettings, env vars) | |
| 25 | + | Priority() int | |
| 26 | + | ||
| 27 | + | // Available returns true if this detector can be used. | |
| 28 | + | // For example, libadwaita detector returns false before adw.Init(). | |
| 29 | + | Available() bool | |
| 30 | + | ||
| 31 | + | // Detect returns the detected preference and whether detection succeeded. | |
| 32 | + | // Returns (preference, true) on success, (_, false) if unavailable or detection failed. | |
| 33 | + | Detect() (prefersDark bool, ok bool) | |
| 34 | + | } | |
| 35 | + | ||
| 36 | + | // ColorSchemeResolver resolves the effective color scheme preference. | |
| 37 | + | // It manages multiple detectors and respects config overrides. | |
| 38 | + | type ColorSchemeResolver interface { | |
| 39 | + | // Resolve returns the current color scheme preference. | |
| 40 | + | // It checks config for explicit overrides, then queries detectors by priority. | |
| 41 | + | // If all detectors fail, defaults to dark mode. | |
| 42 | + | Resolve() ColorSchemePreference | |
| 43 | + | ||
| 44 | + | // RegisterDetector adds a detector to the resolver. | |
| 45 | + | // Safe to call at any time; the resolver re-evaluates on next Resolve(). | |
| 46 | + | RegisterDetector(detector ColorSchemeDetector) | |
| 47 | + | ||
| 48 | + | // Refresh forces re-evaluation of the color scheme. | |
| 49 | + | // Call this after registering new detectors or when system preferences change. | |
| 50 | + | // Returns the new preference. | |
| 51 | + | Refresh() ColorSchemePreference | |
| 52 | + | ||
| 53 | + | // OnChange registers a callback for color scheme changes. | |
| 54 | + | // The callback is invoked when Refresh() results in a different preference. | |
| 55 | + | // Returns a function to unregister the callback. | |
| 56 | + | OnChange(callback func(ColorSchemePreference)) func() | |
| 57 | + | } | |
| @@ -0,0 +1,57 @@ | |||||
| 1 | + | package port | |||
| 2 | + | ||||
| 3 | + | // ColorSchemePreference represents the resolved color scheme preference. | |||
| 4 | + | type ColorSchemePreference struct { | |||
| 5 | + | // PrefersDark indicates whether dark mode is preferred. | |||
| 6 | + | PrefersDark bool | |||
| 7 | + | ||||
| 8 | + | // Source identifies which detector provided this preference. | |||
| 9 | + | // Empty string means fallback was used. | |||
| 10 | + | Source string | |||
| 11 | + | } | |||
| 12 | + | ||||
| 13 | + | // ColorSchemeDetector detects the system's color scheme preference. | |||
| 14 | + | // Multiple detectors can be registered with different priorities. | |||
| 15 | + | type ColorSchemeDetector interface { | |||
| 16 | + | // Name returns a human-readable name for this detector. | |||
| 17 | + | Name() string | |||
| 18 | + | ||||
| 19 | + | // Priority returns the detector's priority. | |||
| 20 | + | // Higher values = higher priority (checked first). | |||
| 21 | + | // Recommended ranges: | |||
| 22 | + | // - 100+: Runtime detectors (libadwaita, GTK Settings) | |||
| 23 | + | // - 50+: Config file detectors | |||
| 24 | + | // - 10+: Fallback detectors (gsettings, env vars) | |||
| 25 | + | Priority() int | |||
| 26 | + | ||||
| 27 | + | // Available returns true if this detector can be used. | |||
| 28 | + | // For example, libadwaita detector returns false before adw.Init(). | |||
| 29 | + | Available() bool | |||
| 30 | + | ||||
| 31 | + | // Detect returns the detected preference and whether detection succeeded. | |||
| 32 | + | // Returns (preference, true) on success, (_, false) if unavailable or detection failed. | |||
| 33 | + | Detect() (prefersDark bool, ok bool) | |||
| 34 | + | } | |||
| 35 | + | ||||
| 36 | + | // ColorSchemeResolver resolves the effective color scheme preference. | |||
| 37 | + | // It manages multiple detectors and respects config overrides. | |||
| 38 | + | type ColorSchemeResolver interface { | |||
| 39 | + | // Resolve returns the current color scheme preference. | |||
| 40 | + | // It checks config for explicit overrides, then queries detectors by priority. | |||
| 41 | + | // If all detectors fail, defaults to dark mode. | |||
| 42 | + | Resolve() ColorSchemePreference | |||
| 43 | + | ||||
| 44 | + | // RegisterDetector adds a detector to the resolver. | |||
| 45 | + | // Safe to call at any time; the resolver re-evaluates on next Resolve(). | |||
| 46 | + | RegisterDetector(detector ColorSchemeDetector) | |||
| 47 | + | ||||
| 48 | + | // Refresh forces re-evaluation of the color scheme. | |||
| 49 | + | // Call this after registering new detectors or when system preferences change. | |||
| 50 | + | // Returns the new preference. | |||
| 51 | + | Refresh() ColorSchemePreference | |||
| 52 | + | ||||
| 53 | + | // OnChange registers a callback for color scheme changes. | |||
| 54 | + | // The callback is invoked when Refresh() results in a different preference. | |||
| 55 | + | // Returns a function to unregister the callback. | |||
| 56 | + | OnChange(callback func(ColorSchemePreference)) func() | |||
| 57 | + | } | |||
M internal/application/port/mocks/mocks.go +420 -0
| @@ -14,6 +14,426 @@ import ( | |||
| 14 | 14 | mock "github.com/stretchr/testify/mock" | |
| 15 | 15 | ) | |
| 16 | 16 | ||
| 17 | + | // NewMockColorSchemeDetector creates a new instance of MockColorSchemeDetector. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |
| 18 | + | // The first argument is typically a *testing.T value. | |
| 19 | + | func NewMockColorSchemeDetector(t interface { | |
| 20 | + | mock.TestingT | |
| 21 | + | Cleanup(func()) | |
| 22 | + | }) *MockColorSchemeDetector { | |
| 23 | + | mock := &MockColorSchemeDetector{} | |
| 24 | + | mock.Mock.Test(t) | |
| 25 | + | ||
| 26 | + | t.Cleanup(func() { mock.AssertExpectations(t) }) | |
| 27 | + | ||
| 28 | + | return mock | |
| 29 | + | } | |
| 30 | + | ||
| 31 | + | // MockColorSchemeDetector is an autogenerated mock type for the ColorSchemeDetector type | |
| 32 | + | type MockColorSchemeDetector struct { | |
| 33 | + | mock.Mock | |
| 34 | + | } | |
| 35 | + | ||
| 36 | + | type MockColorSchemeDetector_Expecter struct { | |
| 37 | + | mock *mock.Mock | |
| 38 | + | } | |
| 39 | + | ||
| 40 | + | func (_m *MockColorSchemeDetector) EXPECT() *MockColorSchemeDetector_Expecter { | |
| 41 | + | return &MockColorSchemeDetector_Expecter{mock: &_m.Mock} | |
| 42 | + | } | |
| 43 | + | ||
| 44 | + | // Available provides a mock function for the type MockColorSchemeDetector | |
| 45 | + | func (_mock *MockColorSchemeDetector) Available() bool { | |
| 46 | + | ret := _mock.Called() | |
| 47 | + | ||
| 48 | + | if len(ret) == 0 { | |
| 49 | + | panic("no return value specified for Available") | |
| 50 | + | } | |
| 51 | + | ||
| 52 | + | var r0 bool | |
| 53 | + | if returnFunc, ok := ret.Get(0).(func() bool); ok { | |
| 54 | + | r0 = returnFunc() | |
| 55 | + | } else { | |
| 56 | + | r0 = ret.Get(0).(bool) | |
| 57 | + | } | |
| 58 | + | return r0 | |
| 59 | + | } | |
| 60 | + | ||
| 61 | + | // MockColorSchemeDetector_Available_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Available' | |
| 62 | + | type MockColorSchemeDetector_Available_Call struct { | |
| 63 | + | *mock.Call | |
| 64 | + | } | |
| 65 | + | ||
| 66 | + | // Available is a helper method to define mock.On call | |
| 67 | + | func (_e *MockColorSchemeDetector_Expecter) Available() *MockColorSchemeDetector_Available_Call { | |
| 68 | + | return &MockColorSchemeDetector_Available_Call{Call: _e.mock.On("Available")} | |
| 69 | + | } | |
| 70 | + | ||
| 71 | + | func (_c *MockColorSchemeDetector_Available_Call) Run(run func()) *MockColorSchemeDetector_Available_Call { | |
| 72 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 73 | + | run() | |
| 74 | + | }) | |
| 75 | + | return _c | |
| 76 | + | } | |
| 77 | + | ||
| 78 | + | func (_c *MockColorSchemeDetector_Available_Call) Return(b bool) *MockColorSchemeDetector_Available_Call { | |
| 79 | + | _c.Call.Return(b) | |
| 80 | + | return _c | |
| 81 | + | } | |
| 82 | + | ||
| 83 | + | func (_c *MockColorSchemeDetector_Available_Call) RunAndReturn(run func() bool) *MockColorSchemeDetector_Available_Call { | |
| 84 | + | _c.Call.Return(run) | |
| 85 | + | return _c | |
| 86 | + | } | |
| 87 | + | ||
| 88 | + | // Detect provides a mock function for the type MockColorSchemeDetector | |
| 89 | + | func (_mock *MockColorSchemeDetector) Detect() (bool, bool) { | |
| 90 | + | ret := _mock.Called() | |
| 91 | + | ||
| 92 | + | if len(ret) == 0 { | |
| 93 | + | panic("no return value specified for Detect") | |
| 94 | + | } | |
| 95 | + | ||
| 96 | + | var r0 bool | |
| 97 | + | var r1 bool | |
| 98 | + | if returnFunc, ok := ret.Get(0).(func() (bool, bool)); ok { | |
| 99 | + | return returnFunc() | |
| 100 | + | } | |
| 101 | + | if returnFunc, ok := ret.Get(0).(func() bool); ok { | |
| 102 | + | r0 = returnFunc() | |
| 103 | + | } else { | |
| 104 | + | r0 = ret.Get(0).(bool) | |
| 105 | + | } | |
| 106 | + | if returnFunc, ok := ret.Get(1).(func() bool); ok { | |
| 107 | + | r1 = returnFunc() | |
| 108 | + | } else { | |
| 109 | + | r1 = ret.Get(1).(bool) | |
| 110 | + | } | |
| 111 | + | return r0, r1 | |
| 112 | + | } | |
| 113 | + | ||
| 114 | + | // MockColorSchemeDetector_Detect_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Detect' | |
| 115 | + | type MockColorSchemeDetector_Detect_Call struct { | |
| 116 | + | *mock.Call | |
| 117 | + | } | |
| 118 | + | ||
| 119 | + | // Detect is a helper method to define mock.On call | |
| 120 | + | func (_e *MockColorSchemeDetector_Expecter) Detect() *MockColorSchemeDetector_Detect_Call { | |
| 121 | + | return &MockColorSchemeDetector_Detect_Call{Call: _e.mock.On("Detect")} | |
| 122 | + | } | |
| 123 | + | ||
| 124 | + | func (_c *MockColorSchemeDetector_Detect_Call) Run(run func()) *MockColorSchemeDetector_Detect_Call { | |
| 125 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 126 | + | run() | |
| 127 | + | }) | |
| 128 | + | return _c | |
| 129 | + | } | |
| 130 | + | ||
| 131 | + | func (_c *MockColorSchemeDetector_Detect_Call) Return(prefersDark bool, ok bool) *MockColorSchemeDetector_Detect_Call { | |
| 132 | + | _c.Call.Return(prefersDark, ok) | |
| 133 | + | return _c | |
| 134 | + | } | |
| 135 | + | ||
| 136 | + | func (_c *MockColorSchemeDetector_Detect_Call) RunAndReturn(run func() (bool, bool)) *MockColorSchemeDetector_Detect_Call { | |
| 137 | + | _c.Call.Return(run) | |
| 138 | + | return _c | |
| 139 | + | } | |
| 140 | + | ||
| 141 | + | // Name provides a mock function for the type MockColorSchemeDetector | |
| 142 | + | func (_mock *MockColorSchemeDetector) Name() string { | |
| 143 | + | ret := _mock.Called() | |
| 144 | + | ||
| 145 | + | if len(ret) == 0 { | |
| 146 | + | panic("no return value specified for Name") | |
| 147 | + | } | |
| 148 | + | ||
| 149 | + | var r0 string | |
| 150 | + | if returnFunc, ok := ret.Get(0).(func() string); ok { | |
| 151 | + | r0 = returnFunc() | |
| 152 | + | } else { | |
| 153 | + | r0 = ret.Get(0).(string) | |
| 154 | + | } | |
| 155 | + | return r0 | |
| 156 | + | } | |
| 157 | + | ||
| 158 | + | // MockColorSchemeDetector_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' | |
| 159 | + | type MockColorSchemeDetector_Name_Call struct { | |
| 160 | + | *mock.Call | |
| 161 | + | } | |
| 162 | + | ||
| 163 | + | // Name is a helper method to define mock.On call | |
| 164 | + | func (_e *MockColorSchemeDetector_Expecter) Name() *MockColorSchemeDetector_Name_Call { | |
| 165 | + | return &MockColorSchemeDetector_Name_Call{Call: _e.mock.On("Name")} | |
| 166 | + | } | |
| 167 | + | ||
| 168 | + | func (_c *MockColorSchemeDetector_Name_Call) Run(run func()) *MockColorSchemeDetector_Name_Call { | |
| 169 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 170 | + | run() | |
| 171 | + | }) | |
| 172 | + | return _c | |
| 173 | + | } | |
| 174 | + | ||
| 175 | + | func (_c *MockColorSchemeDetector_Name_Call) Return(s string) *MockColorSchemeDetector_Name_Call { | |
| 176 | + | _c.Call.Return(s) | |
| 177 | + | return _c | |
| 178 | + | } | |
| 179 | + | ||
| 180 | + | func (_c *MockColorSchemeDetector_Name_Call) RunAndReturn(run func() string) *MockColorSchemeDetector_Name_Call { | |
| 181 | + | _c.Call.Return(run) | |
| 182 | + | return _c | |
| 183 | + | } | |
| 184 | + | ||
| 185 | + | // Priority provides a mock function for the type MockColorSchemeDetector | |
| 186 | + | func (_mock *MockColorSchemeDetector) Priority() int { | |
| 187 | + | ret := _mock.Called() | |
| 188 | + | ||
| 189 | + | if len(ret) == 0 { | |
| 190 | + | panic("no return value specified for Priority") | |
| 191 | + | } | |
| 192 | + | ||
| 193 | + | var r0 int | |
| 194 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |
| 195 | + | r0 = returnFunc() | |
| 196 | + | } else { | |
| 197 | + | r0 = ret.Get(0).(int) | |
| 198 | + | } | |
| 199 | + | return r0 | |
| 200 | + | } | |
| 201 | + | ||
| 202 | + | // MockColorSchemeDetector_Priority_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Priority' | |
| 203 | + | type MockColorSchemeDetector_Priority_Call struct { | |
| 204 | + | *mock.Call | |
| 205 | + | } | |
| 206 | + | ||
| 207 | + | // Priority is a helper method to define mock.On call | |
| 208 | + | func (_e *MockColorSchemeDetector_Expecter) Priority() *MockColorSchemeDetector_Priority_Call { | |
| 209 | + | return &MockColorSchemeDetector_Priority_Call{Call: _e.mock.On("Priority")} | |
| 210 | + | } | |
| 211 | + | ||
| 212 | + | func (_c *MockColorSchemeDetector_Priority_Call) Run(run func()) *MockColorSchemeDetector_Priority_Call { | |
| 213 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 214 | + | run() | |
| 215 | + | }) | |
| 216 | + | return _c | |
| 217 | + | } | |
| 218 | + | ||
| 219 | + | func (_c *MockColorSchemeDetector_Priority_Call) Return(n int) *MockColorSchemeDetector_Priority_Call { | |
| 220 | + | _c.Call.Return(n) | |
| 221 | + | return _c | |
| 222 | + | } | |
| 223 | + | ||
| 224 | + | func (_c *MockColorSchemeDetector_Priority_Call) RunAndReturn(run func() int) *MockColorSchemeDetector_Priority_Call { | |
| 225 | + | _c.Call.Return(run) | |
| 226 | + | return _c | |
| 227 | + | } | |
| 228 | + | ||
| 229 | + | // NewMockColorSchemeResolver creates a new instance of MockColorSchemeResolver. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |
| 230 | + | // The first argument is typically a *testing.T value. | |
| 231 | + | func NewMockColorSchemeResolver(t interface { | |
| 232 | + | mock.TestingT | |
| 233 | + | Cleanup(func()) | |
| 234 | + | }) *MockColorSchemeResolver { | |
| 235 | + | mock := &MockColorSchemeResolver{} | |
| 236 | + | mock.Mock.Test(t) | |
| 237 | + | ||
| 238 | + | t.Cleanup(func() { mock.AssertExpectations(t) }) | |
| 239 | + | ||
| 240 | + | return mock | |
| 241 | + | } | |
| 242 | + | ||
| 243 | + | // MockColorSchemeResolver is an autogenerated mock type for the ColorSchemeResolver type | |
| 244 | + | type MockColorSchemeResolver struct { | |
| 245 | + | mock.Mock | |
| 246 | + | } | |
| 247 | + | ||
| 248 | + | type MockColorSchemeResolver_Expecter struct { | |
| 249 | + | mock *mock.Mock | |
| 250 | + | } | |
| 251 | + | ||
| 252 | + | func (_m *MockColorSchemeResolver) EXPECT() *MockColorSchemeResolver_Expecter { | |
| 253 | + | return &MockColorSchemeResolver_Expecter{mock: &_m.Mock} | |
| 254 | + | } | |
| 255 | + | ||
| 256 | + | // OnChange provides a mock function for the type MockColorSchemeResolver | |
| 257 | + | func (_mock *MockColorSchemeResolver) OnChange(callback func(port.ColorSchemePreference)) func() { | |
| 258 | + | ret := _mock.Called(callback) | |
| 259 | + | ||
| 260 | + | if len(ret) == 0 { | |
| 261 | + | panic("no return value specified for OnChange") | |
| 262 | + | } | |
| 263 | + | ||
| 264 | + | var r0 func() | |
| 265 | + | if returnFunc, ok := ret.Get(0).(func(func(port.ColorSchemePreference)) func()); ok { | |
| 266 | + | r0 = returnFunc(callback) | |
| 267 | + | } else { | |
| 268 | + | if ret.Get(0) != nil { | |
| 269 | + | r0 = ret.Get(0).(func()) | |
| 270 | + | } | |
| 271 | + | } | |
| 272 | + | return r0 | |
| 273 | + | } | |
| 274 | + | ||
| 275 | + | // MockColorSchemeResolver_OnChange_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnChange' | |
| 276 | + | type MockColorSchemeResolver_OnChange_Call struct { | |
| 277 | + | *mock.Call | |
| 278 | + | } | |
| 279 | + | ||
| 280 | + | // OnChange is a helper method to define mock.On call | |
| 281 | + | // - callback func(port.ColorSchemePreference) | |
| 282 | + | func (_e *MockColorSchemeResolver_Expecter) OnChange(callback interface{}) *MockColorSchemeResolver_OnChange_Call { | |
| 283 | + | return &MockColorSchemeResolver_OnChange_Call{Call: _e.mock.On("OnChange", callback)} | |
| 284 | + | } | |
| 285 | + | ||
| 286 | + | func (_c *MockColorSchemeResolver_OnChange_Call) Run(run func(callback func(port.ColorSchemePreference))) *MockColorSchemeResolver_OnChange_Call { | |
| 287 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 288 | + | var arg0 func(port.ColorSchemePreference) | |
| 289 | + | if args[0] != nil { | |
| 290 | + | arg0 = args[0].(func(port.ColorSchemePreference)) | |
| 291 | + | } | |
| 292 | + | run( | |
| 293 | + | arg0, | |
| 294 | + | ) | |
| 295 | + | }) | |
| 296 | + | return _c | |
| 297 | + | } | |
| 298 | + | ||
| 299 | + | func (_c *MockColorSchemeResolver_OnChange_Call) Return(fn func()) *MockColorSchemeResolver_OnChange_Call { | |
| 300 | + | _c.Call.Return(fn) | |
| 301 | + | return _c | |
| 302 | + | } | |
| 303 | + | ||
| 304 | + | func (_c *MockColorSchemeResolver_OnChange_Call) RunAndReturn(run func(callback func(port.ColorSchemePreference)) func()) *MockColorSchemeResolver_OnChange_Call { | |
| 305 | + | _c.Call.Return(run) | |
| 306 | + | return _c | |
| 307 | + | } | |
| 308 | + | ||
| 309 | + | // Refresh provides a mock function for the type MockColorSchemeResolver | |
| 310 | + | func (_mock *MockColorSchemeResolver) Refresh() port.ColorSchemePreference { | |
| 311 | + | ret := _mock.Called() | |
| 312 | + | ||
| 313 | + | if len(ret) == 0 { | |
| 314 | + | panic("no return value specified for Refresh") | |
| 315 | + | } | |
| 316 | + | ||
| 317 | + | var r0 port.ColorSchemePreference | |
| 318 | + | if returnFunc, ok := ret.Get(0).(func() port.ColorSchemePreference); ok { | |
| 319 | + | r0 = returnFunc() | |
| 320 | + | } else { | |
| 321 | + | r0 = ret.Get(0).(port.ColorSchemePreference) | |
| 322 | + | } | |
| 323 | + | return r0 | |
| 324 | + | } | |
| 325 | + | ||
| 326 | + | // MockColorSchemeResolver_Refresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Refresh' | |
| 327 | + | type MockColorSchemeResolver_Refresh_Call struct { | |
| 328 | + | *mock.Call | |
| 329 | + | } | |
| 330 | + | ||
| 331 | + | // Refresh is a helper method to define mock.On call | |
| 332 | + | func (_e *MockColorSchemeResolver_Expecter) Refresh() *MockColorSchemeResolver_Refresh_Call { | |
| 333 | + | return &MockColorSchemeResolver_Refresh_Call{Call: _e.mock.On("Refresh")} | |
| 334 | + | } | |
| 335 | + | ||
| 336 | + | func (_c *MockColorSchemeResolver_Refresh_Call) Run(run func()) *MockColorSchemeResolver_Refresh_Call { | |
| 337 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 338 | + | run() | |
| 339 | + | }) | |
| 340 | + | return _c | |
| 341 | + | } | |
| 342 | + | ||
| 343 | + | func (_c *MockColorSchemeResolver_Refresh_Call) Return(colorSchemePreference port.ColorSchemePreference) *MockColorSchemeResolver_Refresh_Call { | |
| 344 | + | _c.Call.Return(colorSchemePreference) | |
| 345 | + | return _c | |
| 346 | + | } | |
| 347 | + | ||
| 348 | + | func (_c *MockColorSchemeResolver_Refresh_Call) RunAndReturn(run func() port.ColorSchemePreference) *MockColorSchemeResolver_Refresh_Call { | |
| 349 | + | _c.Call.Return(run) | |
| 350 | + | return _c | |
| 351 | + | } | |
| 352 | + | ||
| 353 | + | // RegisterDetector provides a mock function for the type MockColorSchemeResolver | |
| 354 | + | func (_mock *MockColorSchemeResolver) RegisterDetector(detector port.ColorSchemeDetector) { | |
| 355 | + | _mock.Called(detector) | |
| 356 | + | return | |
| 357 | + | } | |
| 358 | + | ||
| 359 | + | // MockColorSchemeResolver_RegisterDetector_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterDetector' | |
| 360 | + | type MockColorSchemeResolver_RegisterDetector_Call struct { | |
| 361 | + | *mock.Call | |
| 362 | + | } | |
| 363 | + | ||
| 364 | + | // RegisterDetector is a helper method to define mock.On call | |
| 365 | + | // - detector port.ColorSchemeDetector | |
| 366 | + | func (_e *MockColorSchemeResolver_Expecter) RegisterDetector(detector interface{}) *MockColorSchemeResolver_RegisterDetector_Call { | |
| 367 | + | return &MockColorSchemeResolver_RegisterDetector_Call{Call: _e.mock.On("RegisterDetector", detector)} | |
| 368 | + | } | |
| 369 | + | ||
| 370 | + | func (_c *MockColorSchemeResolver_RegisterDetector_Call) Run(run func(detector port.ColorSchemeDetector)) *MockColorSchemeResolver_RegisterDetector_Call { | |
| 371 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 372 | + | var arg0 port.ColorSchemeDetector | |
| 373 | + | if args[0] != nil { | |
| 374 | + | arg0 = args[0].(port.ColorSchemeDetector) | |
| 375 | + | } | |
| 376 | + | run( | |
| 377 | + | arg0, | |
| 378 | + | ) | |
| 379 | + | }) | |
| 380 | + | return _c | |
| 381 | + | } | |
| 382 | + | ||
| 383 | + | func (_c *MockColorSchemeResolver_RegisterDetector_Call) Return() *MockColorSchemeResolver_RegisterDetector_Call { | |
| 384 | + | _c.Call.Return() | |
| 385 | + | return _c | |
| 386 | + | } | |
| 387 | + | ||
| 388 | + | func (_c *MockColorSchemeResolver_RegisterDetector_Call) RunAndReturn(run func(detector port.ColorSchemeDetector)) *MockColorSchemeResolver_RegisterDetector_Call { | |
| 389 | + | _c.Run(run) | |
| 390 | + | return _c | |
| 391 | + | } | |
| 392 | + | ||
| 393 | + | // Resolve provides a mock function for the type MockColorSchemeResolver | |
| 394 | + | func (_mock *MockColorSchemeResolver) Resolve() port.ColorSchemePreference { | |
| 395 | + | ret := _mock.Called() | |
| 396 | + | ||
| 397 | + | if len(ret) == 0 { | |
| 398 | + | panic("no return value specified for Resolve") | |
| 399 | + | } | |
| 400 | + | ||
| 401 | + | var r0 port.ColorSchemePreference | |
| 402 | + | if returnFunc, ok := ret.Get(0).(func() port.ColorSchemePreference); ok { | |
| 403 | + | r0 = returnFunc() | |
| 404 | + | } else { | |
| 405 | + | r0 = ret.Get(0).(port.ColorSchemePreference) | |
| 406 | + | } | |
| 407 | + | return r0 | |
| 408 | + | } | |
| 409 | + | ||
| 410 | + | // MockColorSchemeResolver_Resolve_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Resolve' | |
| 411 | + | type MockColorSchemeResolver_Resolve_Call struct { | |
| 412 | + | *mock.Call | |
| 413 | + | } | |
| 414 | + | ||
| 415 | + | // Resolve is a helper method to define mock.On call | |
| 416 | + | func (_e *MockColorSchemeResolver_Expecter) Resolve() *MockColorSchemeResolver_Resolve_Call { | |
| 417 | + | return &MockColorSchemeResolver_Resolve_Call{Call: _e.mock.On("Resolve")} | |
| 418 | + | } | |
| 419 | + | ||
| 420 | + | func (_c *MockColorSchemeResolver_Resolve_Call) Run(run func()) *MockColorSchemeResolver_Resolve_Call { | |
| 421 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 422 | + | run() | |
| 423 | + | }) | |
| 424 | + | return _c | |
| 425 | + | } | |
| 426 | + | ||
| 427 | + | func (_c *MockColorSchemeResolver_Resolve_Call) Return(colorSchemePreference port.ColorSchemePreference) *MockColorSchemeResolver_Resolve_Call { | |
| 428 | + | _c.Call.Return(colorSchemePreference) | |
| 429 | + | return _c | |
| 430 | + | } | |
| 431 | + | ||
| 432 | + | func (_c *MockColorSchemeResolver_Resolve_Call) RunAndReturn(run func() port.ColorSchemePreference) *MockColorSchemeResolver_Resolve_Call { | |
| 433 | + | _c.Call.Return(run) | |
| 434 | + | return _c | |
| 435 | + | } | |
| 436 | + | ||
| 17 | 437 | // NewMockConfigMigrator creates a new instance of MockConfigMigrator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |
| 18 | 438 | // The first argument is typically a *testing.T value. | |
| 19 | 439 | func NewMockConfigMigrator(t interface { | |
| @@ -14,6 +14,426 @@ import ( | |||||
| 14 | mock "github.com/stretchr/testify/mock" | 14 | mock "github.com/stretchr/testify/mock" | ||
| 15 | ) | 15 | ) | ||
| 16 | 16 | ||||
| 17 | + | // NewMockColorSchemeDetector creates a new instance of MockColorSchemeDetector. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |||
| 18 | + | // The first argument is typically a *testing.T value. | |||
| 19 | + | func NewMockColorSchemeDetector(t interface { | |||
| 20 | + | mock.TestingT | |||
| 21 | + | Cleanup(func()) | |||
| 22 | + | }) *MockColorSchemeDetector { | |||
| 23 | + | mock := &MockColorSchemeDetector{} | |||
| 24 | + | mock.Mock.Test(t) | |||
| 25 | + | ||||
| 26 | + | t.Cleanup(func() { mock.AssertExpectations(t) }) | |||
| 27 | + | ||||
| 28 | + | return mock | |||
| 29 | + | } | |||
| 30 | + | ||||
| 31 | + | // MockColorSchemeDetector is an autogenerated mock type for the ColorSchemeDetector type | |||
| 32 | + | type MockColorSchemeDetector struct { | |||
| 33 | + | mock.Mock | |||
| 34 | + | } | |||
| 35 | + | ||||
| 36 | + | type MockColorSchemeDetector_Expecter struct { | |||
| 37 | + | mock *mock.Mock | |||
| 38 | + | } | |||
| 39 | + | ||||
| 40 | + | func (_m *MockColorSchemeDetector) EXPECT() *MockColorSchemeDetector_Expecter { | |||
| 41 | + | return &MockColorSchemeDetector_Expecter{mock: &_m.Mock} | |||
| 42 | + | } | |||
| 43 | + | ||||
| 44 | + | // Available provides a mock function for the type MockColorSchemeDetector | |||
| 45 | + | func (_mock *MockColorSchemeDetector) Available() bool { | |||
| 46 | + | ret := _mock.Called() | |||
| 47 | + | ||||
| 48 | + | if len(ret) == 0 { | |||
| 49 | + | panic("no return value specified for Available") | |||
| 50 | + | } | |||
| 51 | + | ||||
| 52 | + | var r0 bool | |||
| 53 | + | if returnFunc, ok := ret.Get(0).(func() bool); ok { | |||
| 54 | + | r0 = returnFunc() | |||
| 55 | + | } else { | |||
| 56 | + | r0 = ret.Get(0).(bool) | |||
| 57 | + | } | |||
| 58 | + | return r0 | |||
| 59 | + | } | |||
| 60 | + | ||||
| 61 | + | // MockColorSchemeDetector_Available_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Available' | |||
| 62 | + | type MockColorSchemeDetector_Available_Call struct { | |||
| 63 | + | *mock.Call | |||
| 64 | + | } | |||
| 65 | + | ||||
| 66 | + | // Available is a helper method to define mock.On call | |||
| 67 | + | func (_e *MockColorSchemeDetector_Expecter) Available() *MockColorSchemeDetector_Available_Call { | |||
| 68 | + | return &MockColorSchemeDetector_Available_Call{Call: _e.mock.On("Available")} | |||
| 69 | + | } | |||
| 70 | + | ||||
| 71 | + | func (_c *MockColorSchemeDetector_Available_Call) Run(run func()) *MockColorSchemeDetector_Available_Call { | |||
| 72 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 73 | + | run() | |||
| 74 | + | }) | |||
| 75 | + | return _c | |||
| 76 | + | } | |||
| 77 | + | ||||
| 78 | + | func (_c *MockColorSchemeDetector_Available_Call) Return(b bool) *MockColorSchemeDetector_Available_Call { | |||
| 79 | + | _c.Call.Return(b) | |||
| 80 | + | return _c | |||
| 81 | + | } | |||
| 82 | + | ||||
| 83 | + | func (_c *MockColorSchemeDetector_Available_Call) RunAndReturn(run func() bool) *MockColorSchemeDetector_Available_Call { | |||
| 84 | + | _c.Call.Return(run) | |||
| 85 | + | return _c | |||
| 86 | + | } | |||
| 87 | + | ||||
| 88 | + | // Detect provides a mock function for the type MockColorSchemeDetector | |||
| 89 | + | func (_mock *MockColorSchemeDetector) Detect() (bool, bool) { | |||
| 90 | + | ret := _mock.Called() | |||
| 91 | + | ||||
| 92 | + | if len(ret) == 0 { | |||
| 93 | + | panic("no return value specified for Detect") | |||
| 94 | + | } | |||
| 95 | + | ||||
| 96 | + | var r0 bool | |||
| 97 | + | var r1 bool | |||
| 98 | + | if returnFunc, ok := ret.Get(0).(func() (bool, bool)); ok { | |||
| 99 | + | return returnFunc() | |||
| 100 | + | } | |||
| 101 | + | if returnFunc, ok := ret.Get(0).(func() bool); ok { | |||
| 102 | + | r0 = returnFunc() | |||
| 103 | + | } else { | |||
| 104 | + | r0 = ret.Get(0).(bool) | |||
| 105 | + | } | |||
| 106 | + | if returnFunc, ok := ret.Get(1).(func() bool); ok { | |||
| 107 | + | r1 = returnFunc() | |||
| 108 | + | } else { | |||
| 109 | + | r1 = ret.Get(1).(bool) | |||
| 110 | + | } | |||
| 111 | + | return r0, r1 | |||
| 112 | + | } | |||
| 113 | + | ||||
| 114 | + | // MockColorSchemeDetector_Detect_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Detect' | |||
| 115 | + | type MockColorSchemeDetector_Detect_Call struct { | |||
| 116 | + | *mock.Call | |||
| 117 | + | } | |||
| 118 | + | ||||
| 119 | + | // Detect is a helper method to define mock.On call | |||
| 120 | + | func (_e *MockColorSchemeDetector_Expecter) Detect() *MockColorSchemeDetector_Detect_Call { | |||
| 121 | + | return &MockColorSchemeDetector_Detect_Call{Call: _e.mock.On("Detect")} | |||
| 122 | + | } | |||
| 123 | + | ||||
| 124 | + | func (_c *MockColorSchemeDetector_Detect_Call) Run(run func()) *MockColorSchemeDetector_Detect_Call { | |||
| 125 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 126 | + | run() | |||
| 127 | + | }) | |||
| 128 | + | return _c | |||
| 129 | + | } | |||
| 130 | + | ||||
| 131 | + | func (_c *MockColorSchemeDetector_Detect_Call) Return(prefersDark bool, ok bool) *MockColorSchemeDetector_Detect_Call { | |||
| 132 | + | _c.Call.Return(prefersDark, ok) | |||
| 133 | + | return _c | |||
| 134 | + | } | |||
| 135 | + | ||||
| 136 | + | func (_c *MockColorSchemeDetector_Detect_Call) RunAndReturn(run func() (bool, bool)) *MockColorSchemeDetector_Detect_Call { | |||
| 137 | + | _c.Call.Return(run) | |||
| 138 | + | return _c | |||
| 139 | + | } | |||
| 140 | + | ||||
| 141 | + | // Name provides a mock function for the type MockColorSchemeDetector | |||
| 142 | + | func (_mock *MockColorSchemeDetector) Name() string { | |||
| 143 | + | ret := _mock.Called() | |||
| 144 | + | ||||
| 145 | + | if len(ret) == 0 { | |||
| 146 | + | panic("no return value specified for Name") | |||
| 147 | + | } | |||
| 148 | + | ||||
| 149 | + | var r0 string | |||
| 150 | + | if returnFunc, ok := ret.Get(0).(func() string); ok { | |||
| 151 | + | r0 = returnFunc() | |||
| 152 | + | } else { | |||
| 153 | + | r0 = ret.Get(0).(string) | |||
| 154 | + | } | |||
| 155 | + | return r0 | |||
| 156 | + | } | |||
| 157 | + | ||||
| 158 | + | // MockColorSchemeDetector_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' | |||
| 159 | + | type MockColorSchemeDetector_Name_Call struct { | |||
| 160 | + | *mock.Call | |||
| 161 | + | } | |||
| 162 | + | ||||
| 163 | + | // Name is a helper method to define mock.On call | |||
| 164 | + | func (_e *MockColorSchemeDetector_Expecter) Name() *MockColorSchemeDetector_Name_Call { | |||
| 165 | + | return &MockColorSchemeDetector_Name_Call{Call: _e.mock.On("Name")} | |||
| 166 | + | } | |||
| 167 | + | ||||
| 168 | + | func (_c *MockColorSchemeDetector_Name_Call) Run(run func()) *MockColorSchemeDetector_Name_Call { | |||
| 169 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 170 | + | run() | |||
| 171 | + | }) | |||
| 172 | + | return _c | |||
| 173 | + | } | |||
| 174 | + | ||||
| 175 | + | func (_c *MockColorSchemeDetector_Name_Call) Return(s string) *MockColorSchemeDetector_Name_Call { | |||
| 176 | + | _c.Call.Return(s) | |||
| 177 | + | return _c | |||
| 178 | + | } | |||
| 179 | + | ||||
| 180 | + | func (_c *MockColorSchemeDetector_Name_Call) RunAndReturn(run func() string) *MockColorSchemeDetector_Name_Call { | |||
| 181 | + | _c.Call.Return(run) | |||
| 182 | + | return _c | |||
| 183 | + | } | |||
| 184 | + | ||||
| 185 | + | // Priority provides a mock function for the type MockColorSchemeDetector | |||
| 186 | + | func (_mock *MockColorSchemeDetector) Priority() int { | |||
| 187 | + | ret := _mock.Called() | |||
| 188 | + | ||||
| 189 | + | if len(ret) == 0 { | |||
| 190 | + | panic("no return value specified for Priority") | |||
| 191 | + | } | |||
| 192 | + | ||||
| 193 | + | var r0 int | |||
| 194 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |||
| 195 | + | r0 = returnFunc() | |||
| 196 | + | } else { | |||
| 197 | + | r0 = ret.Get(0).(int) | |||
| 198 | + | } | |||
| 199 | + | return r0 | |||
| 200 | + | } | |||
| 201 | + | ||||
| 202 | + | // MockColorSchemeDetector_Priority_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Priority' | |||
| 203 | + | type MockColorSchemeDetector_Priority_Call struct { | |||
| 204 | + | *mock.Call | |||
| 205 | + | } | |||
| 206 | + | ||||
| 207 | + | // Priority is a helper method to define mock.On call | |||
| 208 | + | func (_e *MockColorSchemeDetector_Expecter) Priority() *MockColorSchemeDetector_Priority_Call { | |||
| 209 | + | return &MockColorSchemeDetector_Priority_Call{Call: _e.mock.On("Priority")} | |||
| 210 | + | } | |||
| 211 | + | ||||
| 212 | + | func (_c *MockColorSchemeDetector_Priority_Call) Run(run func()) *MockColorSchemeDetector_Priority_Call { | |||
| 213 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 214 | + | run() | |||
| 215 | + | }) | |||
| 216 | + | return _c | |||
| 217 | + | } | |||
| 218 | + | ||||
| 219 | + | func (_c *MockColorSchemeDetector_Priority_Call) Return(n int) *MockColorSchemeDetector_Priority_Call { | |||
| 220 | + | _c.Call.Return(n) | |||
| 221 | + | return _c | |||
| 222 | + | } | |||
| 223 | + | ||||
| 224 | + | func (_c *MockColorSchemeDetector_Priority_Call) RunAndReturn(run func() int) *MockColorSchemeDetector_Priority_Call { | |||
| 225 | + | _c.Call.Return(run) | |||
| 226 | + | return _c | |||
| 227 | + | } | |||
| 228 | + | ||||
| 229 | + | // NewMockColorSchemeResolver creates a new instance of MockColorSchemeResolver. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |||
| 230 | + | // The first argument is typically a *testing.T value. | |||
| 231 | + | func NewMockColorSchemeResolver(t interface { | |||
| 232 | + | mock.TestingT | |||
| 233 | + | Cleanup(func()) | |||
| 234 | + | }) *MockColorSchemeResolver { | |||
| 235 | + | mock := &MockColorSchemeResolver{} | |||
| 236 | + | mock.Mock.Test(t) | |||
| 237 | + | ||||
| 238 | + | t.Cleanup(func() { mock.AssertExpectations(t) }) | |||
| 239 | + | ||||
| 240 | + | return mock | |||
| 241 | + | } | |||
| 242 | + | ||||
| 243 | + | // MockColorSchemeResolver is an autogenerated mock type for the ColorSchemeResolver type | |||
| 244 | + | type MockColorSchemeResolver struct { | |||
| 245 | + | mock.Mock | |||
| 246 | + | } | |||
| 247 | + | ||||
| 248 | + | type MockColorSchemeResolver_Expecter struct { | |||
| 249 | + | mock *mock.Mock | |||
| 250 | + | } | |||
| 251 | + | ||||
| 252 | + | func (_m *MockColorSchemeResolver) EXPECT() *MockColorSchemeResolver_Expecter { | |||
| 253 | + | return &MockColorSchemeResolver_Expecter{mock: &_m.Mock} | |||
| 254 | + | } | |||
| 255 | + | ||||
| 256 | + | // OnChange provides a mock function for the type MockColorSchemeResolver | |||
| 257 | + | func (_mock *MockColorSchemeResolver) OnChange(callback func(port.ColorSchemePreference)) func() { | |||
| 258 | + | ret := _mock.Called(callback) | |||
| 259 | + | ||||
| 260 | + | if len(ret) == 0 { | |||
| 261 | + | panic("no return value specified for OnChange") | |||
| 262 | + | } | |||
| 263 | + | ||||
| 264 | + | var r0 func() | |||
| 265 | + | if returnFunc, ok := ret.Get(0).(func(func(port.ColorSchemePreference)) func()); ok { | |||
| 266 | + | r0 = returnFunc(callback) | |||
| 267 | + | } else { | |||
| 268 | + | if ret.Get(0) != nil { | |||
| 269 | + | r0 = ret.Get(0).(func()) | |||
| 270 | + | } | |||
| 271 | + | } | |||
| 272 | + | return r0 | |||
| 273 | + | } | |||
| 274 | + | ||||
| 275 | + | // MockColorSchemeResolver_OnChange_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnChange' | |||
| 276 | + | type MockColorSchemeResolver_OnChange_Call struct { | |||
| 277 | + | *mock.Call | |||
| 278 | + | } | |||
| 279 | + | ||||
| 280 | + | // OnChange is a helper method to define mock.On call | |||
| 281 | + | // - callback func(port.ColorSchemePreference) | |||
| 282 | + | func (_e *MockColorSchemeResolver_Expecter) OnChange(callback interface{}) *MockColorSchemeResolver_OnChange_Call { | |||
| 283 | + | return &MockColorSchemeResolver_OnChange_Call{Call: _e.mock.On("OnChange", callback)} | |||
| 284 | + | } | |||
| 285 | + | ||||
| 286 | + | func (_c *MockColorSchemeResolver_OnChange_Call) Run(run func(callback func(port.ColorSchemePreference))) *MockColorSchemeResolver_OnChange_Call { | |||
| 287 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 288 | + | var arg0 func(port.ColorSchemePreference) | |||
| 289 | + | if args[0] != nil { | |||
| 290 | + | arg0 = args[0].(func(port.ColorSchemePreference)) | |||
| 291 | + | } | |||
| 292 | + | run( | |||
| 293 | + | arg0, | |||
| 294 | + | ) | |||
| 295 | + | }) | |||
| 296 | + | return _c | |||
| 297 | + | } | |||
| 298 | + | ||||
| 299 | + | func (_c *MockColorSchemeResolver_OnChange_Call) Return(fn func()) *MockColorSchemeResolver_OnChange_Call { | |||
| 300 | + | _c.Call.Return(fn) | |||
| 301 | + | return _c | |||
| 302 | + | } | |||
| 303 | + | ||||
| 304 | + | func (_c *MockColorSchemeResolver_OnChange_Call) RunAndReturn(run func(callback func(port.ColorSchemePreference)) func()) *MockColorSchemeResolver_OnChange_Call { | |||
| 305 | + | _c.Call.Return(run) | |||
| 306 | + | return _c | |||
| 307 | + | } | |||
| 308 | + | ||||
| 309 | + | // Refresh provides a mock function for the type MockColorSchemeResolver | |||
| 310 | + | func (_mock *MockColorSchemeResolver) Refresh() port.ColorSchemePreference { | |||
| 311 | + | ret := _mock.Called() | |||
| 312 | + | ||||
| 313 | + | if len(ret) == 0 { | |||
| 314 | + | panic("no return value specified for Refresh") | |||
| 315 | + | } | |||
| 316 | + | ||||
| 317 | + | var r0 port.ColorSchemePreference | |||
| 318 | + | if returnFunc, ok := ret.Get(0).(func() port.ColorSchemePreference); ok { | |||
| 319 | + | r0 = returnFunc() | |||
| 320 | + | } else { | |||
| 321 | + | r0 = ret.Get(0).(port.ColorSchemePreference) | |||
| 322 | + | } | |||
| 323 | + | return r0 | |||
| 324 | + | } | |||
| 325 | + | ||||
| 326 | + | // MockColorSchemeResolver_Refresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Refresh' | |||
| 327 | + | type MockColorSchemeResolver_Refresh_Call struct { | |||
| 328 | + | *mock.Call | |||
| 329 | + | } | |||
| 330 | + | ||||
| 331 | + | // Refresh is a helper method to define mock.On call | |||
| 332 | + | func (_e *MockColorSchemeResolver_Expecter) Refresh() *MockColorSchemeResolver_Refresh_Call { | |||
| 333 | + | return &MockColorSchemeResolver_Refresh_Call{Call: _e.mock.On("Refresh")} | |||
| 334 | + | } | |||
| 335 | + | ||||
| 336 | + | func (_c *MockColorSchemeResolver_Refresh_Call) Run(run func()) *MockColorSchemeResolver_Refresh_Call { | |||
| 337 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 338 | + | run() | |||
| 339 | + | }) | |||
| 340 | + | return _c | |||
| 341 | + | } | |||
| 342 | + | ||||
| 343 | + | func (_c *MockColorSchemeResolver_Refresh_Call) Return(colorSchemePreference port.ColorSchemePreference) *MockColorSchemeResolver_Refresh_Call { | |||
| 344 | + | _c.Call.Return(colorSchemePreference) | |||
| 345 | + | return _c | |||
| 346 | + | } | |||
| 347 | + | ||||
| 348 | + | func (_c *MockColorSchemeResolver_Refresh_Call) RunAndReturn(run func() port.ColorSchemePreference) *MockColorSchemeResolver_Refresh_Call { | |||
| 349 | + | _c.Call.Return(run) | |||
| 350 | + | return _c | |||
| 351 | + | } | |||
| 352 | + | ||||
| 353 | + | // RegisterDetector provides a mock function for the type MockColorSchemeResolver | |||
| 354 | + | func (_mock *MockColorSchemeResolver) RegisterDetector(detector port.ColorSchemeDetector) { | |||
| 355 | + | _mock.Called(detector) | |||
| 356 | + | return | |||
| 357 | + | } | |||
| 358 | + | ||||
| 359 | + | // MockColorSchemeResolver_RegisterDetector_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterDetector' | |||
| 360 | + | type MockColorSchemeResolver_RegisterDetector_Call struct { | |||
| 361 | + | *mock.Call | |||
| 362 | + | } | |||
| 363 | + | ||||
| 364 | + | // RegisterDetector is a helper method to define mock.On call | |||
| 365 | + | // - detector port.ColorSchemeDetector | |||
| 366 | + | func (_e *MockColorSchemeResolver_Expecter) RegisterDetector(detector interface{}) *MockColorSchemeResolver_RegisterDetector_Call { | |||
| 367 | + | return &MockColorSchemeResolver_RegisterDetector_Call{Call: _e.mock.On("RegisterDetector", detector)} | |||
| 368 | + | } | |||
| 369 | + | ||||
| 370 | + | func (_c *MockColorSchemeResolver_RegisterDetector_Call) Run(run func(detector port.ColorSchemeDetector)) *MockColorSchemeResolver_RegisterDetector_Call { | |||
| 371 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 372 | + | var arg0 port.ColorSchemeDetector | |||
| 373 | + | if args[0] != nil { | |||
| 374 | + | arg0 = args[0].(port.ColorSchemeDetector) | |||
| 375 | + | } | |||
| 376 | + | run( | |||
| 377 | + | arg0, | |||
| 378 | + | ) | |||
| 379 | + | }) | |||
| 380 | + | return _c | |||
| 381 | + | } | |||
| 382 | + | ||||
| 383 | + | func (_c *MockColorSchemeResolver_RegisterDetector_Call) Return() *MockColorSchemeResolver_RegisterDetector_Call { | |||
| 384 | + | _c.Call.Return() | |||
| 385 | + | return _c | |||
| 386 | + | } | |||
| 387 | + | ||||
| 388 | + | func (_c *MockColorSchemeResolver_RegisterDetector_Call) RunAndReturn(run func(detector port.ColorSchemeDetector)) *MockColorSchemeResolver_RegisterDetector_Call { | |||
| 389 | + | _c.Run(run) | |||
| 390 | + | return _c | |||
| 391 | + | } | |||
| 392 | + | ||||
| 393 | + | // Resolve provides a mock function for the type MockColorSchemeResolver | |||
| 394 | + | func (_mock *MockColorSchemeResolver) Resolve() port.ColorSchemePreference { | |||
| 395 | + | ret := _mock.Called() | |||
| 396 | + | ||||
| 397 | + | if len(ret) == 0 { | |||
| 398 | + | panic("no return value specified for Resolve") | |||
| 399 | + | } | |||
| 400 | + | ||||
| 401 | + | var r0 port.ColorSchemePreference | |||
| 402 | + | if returnFunc, ok := ret.Get(0).(func() port.ColorSchemePreference); ok { | |||
| 403 | + | r0 = returnFunc() | |||
| 404 | + | } else { | |||
| 405 | + | r0 = ret.Get(0).(port.ColorSchemePreference) | |||
| 406 | + | } | |||
| 407 | + | return r0 | |||
| 408 | + | } | |||
| 409 | + | ||||
| 410 | + | // MockColorSchemeResolver_Resolve_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Resolve' | |||
| 411 | + | type MockColorSchemeResolver_Resolve_Call struct { | |||
| 412 | + | *mock.Call | |||
| 413 | + | } | |||
| 414 | + | ||||
| 415 | + | // Resolve is a helper method to define mock.On call | |||
| 416 | + | func (_e *MockColorSchemeResolver_Expecter) Resolve() *MockColorSchemeResolver_Resolve_Call { | |||
| 417 | + | return &MockColorSchemeResolver_Resolve_Call{Call: _e.mock.On("Resolve")} | |||
| 418 | + | } | |||
| 419 | + | ||||
| 420 | + | func (_c *MockColorSchemeResolver_Resolve_Call) Run(run func()) *MockColorSchemeResolver_Resolve_Call { | |||
| 421 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 422 | + | run() | |||
| 423 | + | }) | |||
| 424 | + | return _c | |||
| 425 | + | } | |||
| 426 | + | ||||
| 427 | + | func (_c *MockColorSchemeResolver_Resolve_Call) Return(colorSchemePreference port.ColorSchemePreference) *MockColorSchemeResolver_Resolve_Call { | |||
| 428 | + | _c.Call.Return(colorSchemePreference) | |||
| 429 | + | return _c | |||
| 430 | + | } | |||
| 431 | + | ||||
| 432 | + | func (_c *MockColorSchemeResolver_Resolve_Call) RunAndReturn(run func() port.ColorSchemePreference) *MockColorSchemeResolver_Resolve_Call { | |||
| 433 | + | _c.Call.Return(run) | |||
| 434 | + | return _c | |||
| 435 | + | } | |||
| 436 | + | ||||
| 17 | // NewMockConfigMigrator creates a new instance of MockConfigMigrator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | 437 | // NewMockConfigMigrator creates a new instance of MockConfigMigrator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | ||
| 18 | // The first argument is typically a *testing.T value. | 438 | // The first argument is typically a *testing.T value. | ||
| 19 | func NewMockConfigMigrator(t interface { | 439 | func NewMockConfigMigrator(t interface { | ||