refactor(tests): update test cases and regenerate mocks for context parameter changes
Update test files to call refactored methods with context parameter: - internal/ui/layout/tree_test.go - internal/ui/layout/split_test.go - internal/ui/layout/stacked_test.go Regenerate mock files to reflect interface changes in refactored components: - internal/ui/layout/mocks/mock_box_widget.go - internal/ui/layout/mocks/mock_button_widget.go - internal/ui/layout/mocks/mock_image_widget.go - internal/ui/layout/mocks/mock_label_widget.go - internal/ui/layout/mocks/mock_overlay_widget.go - internal/ui/layout/mocks/mock_paned_widget.go - internal/ui/layout/mocks/mock_widget.go
- commit
- 79f836210d498a54fc65861132cbd489ad69e8dc
- author
- brice · · 2025-12-17 06:45 UTC
- parent
- 5a4101a
- signature
- unsigned
10 files · +1156 -78
M internal/ui/layout/mocks/mock_box_widget.go +154 -0
| @@ -117,6 +117,160 @@ func (_c *MockBoxWidget_Append_Call) RunAndReturn(run func(child layout.Widget)) | |||
| 117 | 117 | return _c | |
| 118 | 118 | } | |
| 119 | 119 | ||
| 120 | + | // ComputePoint provides a mock function for the type MockBoxWidget | |
| 121 | + | func (_mock *MockBoxWidget) ComputePoint(target layout.Widget) (float64, float64, bool) { | |
| 122 | + | ret := _mock.Called(target) | |
| 123 | + | ||
| 124 | + | if len(ret) == 0 { | |
| 125 | + | panic("no return value specified for ComputePoint") | |
| 126 | + | } | |
| 127 | + | ||
| 128 | + | var r0 float64 | |
| 129 | + | var r1 float64 | |
| 130 | + | var r2 bool | |
| 131 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) (float64, float64, bool)); ok { | |
| 132 | + | return returnFunc(target) | |
| 133 | + | } | |
| 134 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) float64); ok { | |
| 135 | + | r0 = returnFunc(target) | |
| 136 | + | } else { | |
| 137 | + | r0 = ret.Get(0).(float64) | |
| 138 | + | } | |
| 139 | + | if returnFunc, ok := ret.Get(1).(func(layout.Widget) float64); ok { | |
| 140 | + | r1 = returnFunc(target) | |
| 141 | + | } else { | |
| 142 | + | r1 = ret.Get(1).(float64) | |
| 143 | + | } | |
| 144 | + | if returnFunc, ok := ret.Get(2).(func(layout.Widget) bool); ok { | |
| 145 | + | r2 = returnFunc(target) | |
| 146 | + | } else { | |
| 147 | + | r2 = ret.Get(2).(bool) | |
| 148 | + | } | |
| 149 | + | return r0, r1, r2 | |
| 150 | + | } | |
| 151 | + | ||
| 152 | + | // MockBoxWidget_ComputePoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputePoint' | |
| 153 | + | type MockBoxWidget_ComputePoint_Call struct { | |
| 154 | + | *mock.Call | |
| 155 | + | } | |
| 156 | + | ||
| 157 | + | // ComputePoint is a helper method to define mock.On call | |
| 158 | + | // - target layout.Widget | |
| 159 | + | func (_e *MockBoxWidget_Expecter) ComputePoint(target interface{}) *MockBoxWidget_ComputePoint_Call { | |
| 160 | + | return &MockBoxWidget_ComputePoint_Call{Call: _e.mock.On("ComputePoint", target)} | |
| 161 | + | } | |
| 162 | + | ||
| 163 | + | func (_c *MockBoxWidget_ComputePoint_Call) Run(run func(target layout.Widget)) *MockBoxWidget_ComputePoint_Call { | |
| 164 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 165 | + | var arg0 layout.Widget | |
| 166 | + | if args[0] != nil { | |
| 167 | + | arg0 = args[0].(layout.Widget) | |
| 168 | + | } | |
| 169 | + | run( | |
| 170 | + | arg0, | |
| 171 | + | ) | |
| 172 | + | }) | |
| 173 | + | return _c | |
| 174 | + | } | |
| 175 | + | ||
| 176 | + | func (_c *MockBoxWidget_ComputePoint_Call) Return(x float64, y float64, ok bool) *MockBoxWidget_ComputePoint_Call { | |
| 177 | + | _c.Call.Return(x, y, ok) | |
| 178 | + | return _c | |
| 179 | + | } | |
| 180 | + | ||
| 181 | + | func (_c *MockBoxWidget_ComputePoint_Call) RunAndReturn(run func(target layout.Widget) (float64, float64, bool)) *MockBoxWidget_ComputePoint_Call { | |
| 182 | + | _c.Call.Return(run) | |
| 183 | + | return _c | |
| 184 | + | } | |
| 185 | + | ||
| 186 | + | // GetAllocatedHeight provides a mock function for the type MockBoxWidget | |
| 187 | + | func (_mock *MockBoxWidget) GetAllocatedHeight() int { | |
| 188 | + | ret := _mock.Called() | |
| 189 | + | ||
| 190 | + | if len(ret) == 0 { | |
| 191 | + | panic("no return value specified for GetAllocatedHeight") | |
| 192 | + | } | |
| 193 | + | ||
| 194 | + | var r0 int | |
| 195 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |
| 196 | + | r0 = returnFunc() | |
| 197 | + | } else { | |
| 198 | + | r0 = ret.Get(0).(int) | |
| 199 | + | } | |
| 200 | + | return r0 | |
| 201 | + | } | |
| 202 | + | ||
| 203 | + | // MockBoxWidget_GetAllocatedHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedHeight' | |
| 204 | + | type MockBoxWidget_GetAllocatedHeight_Call struct { | |
| 205 | + | *mock.Call | |
| 206 | + | } | |
| 207 | + | ||
| 208 | + | // GetAllocatedHeight is a helper method to define mock.On call | |
| 209 | + | func (_e *MockBoxWidget_Expecter) GetAllocatedHeight() *MockBoxWidget_GetAllocatedHeight_Call { | |
| 210 | + | return &MockBoxWidget_GetAllocatedHeight_Call{Call: _e.mock.On("GetAllocatedHeight")} | |
| 211 | + | } | |
| 212 | + | ||
| 213 | + | func (_c *MockBoxWidget_GetAllocatedHeight_Call) Run(run func()) *MockBoxWidget_GetAllocatedHeight_Call { | |
| 214 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 215 | + | run() | |
| 216 | + | }) | |
| 217 | + | return _c | |
| 218 | + | } | |
| 219 | + | ||
| 220 | + | func (_c *MockBoxWidget_GetAllocatedHeight_Call) Return(n int) *MockBoxWidget_GetAllocatedHeight_Call { | |
| 221 | + | _c.Call.Return(n) | |
| 222 | + | return _c | |
| 223 | + | } | |
| 224 | + | ||
| 225 | + | func (_c *MockBoxWidget_GetAllocatedHeight_Call) RunAndReturn(run func() int) *MockBoxWidget_GetAllocatedHeight_Call { | |
| 226 | + | _c.Call.Return(run) | |
| 227 | + | return _c | |
| 228 | + | } | |
| 229 | + | ||
| 230 | + | // GetAllocatedWidth provides a mock function for the type MockBoxWidget | |
| 231 | + | func (_mock *MockBoxWidget) GetAllocatedWidth() int { | |
| 232 | + | ret := _mock.Called() | |
| 233 | + | ||
| 234 | + | if len(ret) == 0 { | |
| 235 | + | panic("no return value specified for GetAllocatedWidth") | |
| 236 | + | } | |
| 237 | + | ||
| 238 | + | var r0 int | |
| 239 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |
| 240 | + | r0 = returnFunc() | |
| 241 | + | } else { | |
| 242 | + | r0 = ret.Get(0).(int) | |
| 243 | + | } | |
| 244 | + | return r0 | |
| 245 | + | } | |
| 246 | + | ||
| 247 | + | // MockBoxWidget_GetAllocatedWidth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedWidth' | |
| 248 | + | type MockBoxWidget_GetAllocatedWidth_Call struct { | |
| 249 | + | *mock.Call | |
| 250 | + | } | |
| 251 | + | ||
| 252 | + | // GetAllocatedWidth is a helper method to define mock.On call | |
| 253 | + | func (_e *MockBoxWidget_Expecter) GetAllocatedWidth() *MockBoxWidget_GetAllocatedWidth_Call { | |
| 254 | + | return &MockBoxWidget_GetAllocatedWidth_Call{Call: _e.mock.On("GetAllocatedWidth")} | |
| 255 | + | } | |
| 256 | + | ||
| 257 | + | func (_c *MockBoxWidget_GetAllocatedWidth_Call) Run(run func()) *MockBoxWidget_GetAllocatedWidth_Call { | |
| 258 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 259 | + | run() | |
| 260 | + | }) | |
| 261 | + | return _c | |
| 262 | + | } | |
| 263 | + | ||
| 264 | + | func (_c *MockBoxWidget_GetAllocatedWidth_Call) Return(n int) *MockBoxWidget_GetAllocatedWidth_Call { | |
| 265 | + | _c.Call.Return(n) | |
| 266 | + | return _c | |
| 267 | + | } | |
| 268 | + | ||
| 269 | + | func (_c *MockBoxWidget_GetAllocatedWidth_Call) RunAndReturn(run func() int) *MockBoxWidget_GetAllocatedWidth_Call { | |
| 270 | + | _c.Call.Return(run) | |
| 271 | + | return _c | |
| 272 | + | } | |
| 273 | + | ||
| 120 | 274 | // GetHexpand provides a mock function for the type MockBoxWidget | |
| 121 | 275 | func (_mock *MockBoxWidget) GetHexpand() bool { | |
| 122 | 276 | ret := _mock.Called() | |
| @@ -117,6 +117,160 @@ func (_c *MockBoxWidget_Append_Call) RunAndReturn(run func(child layout.Widget)) | |||||
| 117 | return _c | 117 | return _c | ||
| 118 | } | 118 | } | ||
| 119 | 119 | ||||
| 120 | + | // ComputePoint provides a mock function for the type MockBoxWidget | |||
| 121 | + | func (_mock *MockBoxWidget) ComputePoint(target layout.Widget) (float64, float64, bool) { | |||
| 122 | + | ret := _mock.Called(target) | |||
| 123 | + | ||||
| 124 | + | if len(ret) == 0 { | |||
| 125 | + | panic("no return value specified for ComputePoint") | |||
| 126 | + | } | |||
| 127 | + | ||||
| 128 | + | var r0 float64 | |||
| 129 | + | var r1 float64 | |||
| 130 | + | var r2 bool | |||
| 131 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) (float64, float64, bool)); ok { | |||
| 132 | + | return returnFunc(target) | |||
| 133 | + | } | |||
| 134 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) float64); ok { | |||
| 135 | + | r0 = returnFunc(target) | |||
| 136 | + | } else { | |||
| 137 | + | r0 = ret.Get(0).(float64) | |||
| 138 | + | } | |||
| 139 | + | if returnFunc, ok := ret.Get(1).(func(layout.Widget) float64); ok { | |||
| 140 | + | r1 = returnFunc(target) | |||
| 141 | + | } else { | |||
| 142 | + | r1 = ret.Get(1).(float64) | |||
| 143 | + | } | |||
| 144 | + | if returnFunc, ok := ret.Get(2).(func(layout.Widget) bool); ok { | |||
| 145 | + | r2 = returnFunc(target) | |||
| 146 | + | } else { | |||
| 147 | + | r2 = ret.Get(2).(bool) | |||
| 148 | + | } | |||
| 149 | + | return r0, r1, r2 | |||
| 150 | + | } | |||
| 151 | + | ||||
| 152 | + | // MockBoxWidget_ComputePoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputePoint' | |||
| 153 | + | type MockBoxWidget_ComputePoint_Call struct { | |||
| 154 | + | *mock.Call | |||
| 155 | + | } | |||
| 156 | + | ||||
| 157 | + | // ComputePoint is a helper method to define mock.On call | |||
| 158 | + | // - target layout.Widget | |||
| 159 | + | func (_e *MockBoxWidget_Expecter) ComputePoint(target interface{}) *MockBoxWidget_ComputePoint_Call { | |||
| 160 | + | return &MockBoxWidget_ComputePoint_Call{Call: _e.mock.On("ComputePoint", target)} | |||
| 161 | + | } | |||
| 162 | + | ||||
| 163 | + | func (_c *MockBoxWidget_ComputePoint_Call) Run(run func(target layout.Widget)) *MockBoxWidget_ComputePoint_Call { | |||
| 164 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 165 | + | var arg0 layout.Widget | |||
| 166 | + | if args[0] != nil { | |||
| 167 | + | arg0 = args[0].(layout.Widget) | |||
| 168 | + | } | |||
| 169 | + | run( | |||
| 170 | + | arg0, | |||
| 171 | + | ) | |||
| 172 | + | }) | |||
| 173 | + | return _c | |||
| 174 | + | } | |||
| 175 | + | ||||
| 176 | + | func (_c *MockBoxWidget_ComputePoint_Call) Return(x float64, y float64, ok bool) *MockBoxWidget_ComputePoint_Call { | |||
| 177 | + | _c.Call.Return(x, y, ok) | |||
| 178 | + | return _c | |||
| 179 | + | } | |||
| 180 | + | ||||
| 181 | + | func (_c *MockBoxWidget_ComputePoint_Call) RunAndReturn(run func(target layout.Widget) (float64, float64, bool)) *MockBoxWidget_ComputePoint_Call { | |||
| 182 | + | _c.Call.Return(run) | |||
| 183 | + | return _c | |||
| 184 | + | } | |||
| 185 | + | ||||
| 186 | + | // GetAllocatedHeight provides a mock function for the type MockBoxWidget | |||
| 187 | + | func (_mock *MockBoxWidget) GetAllocatedHeight() int { | |||
| 188 | + | ret := _mock.Called() | |||
| 189 | + | ||||
| 190 | + | if len(ret) == 0 { | |||
| 191 | + | panic("no return value specified for GetAllocatedHeight") | |||
| 192 | + | } | |||
| 193 | + | ||||
| 194 | + | var r0 int | |||
| 195 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |||
| 196 | + | r0 = returnFunc() | |||
| 197 | + | } else { | |||
| 198 | + | r0 = ret.Get(0).(int) | |||
| 199 | + | } | |||
| 200 | + | return r0 | |||
| 201 | + | } | |||
| 202 | + | ||||
| 203 | + | // MockBoxWidget_GetAllocatedHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedHeight' | |||
| 204 | + | type MockBoxWidget_GetAllocatedHeight_Call struct { | |||
| 205 | + | *mock.Call | |||
| 206 | + | } | |||
| 207 | + | ||||
| 208 | + | // GetAllocatedHeight is a helper method to define mock.On call | |||
| 209 | + | func (_e *MockBoxWidget_Expecter) GetAllocatedHeight() *MockBoxWidget_GetAllocatedHeight_Call { | |||
| 210 | + | return &MockBoxWidget_GetAllocatedHeight_Call{Call: _e.mock.On("GetAllocatedHeight")} | |||
| 211 | + | } | |||
| 212 | + | ||||
| 213 | + | func (_c *MockBoxWidget_GetAllocatedHeight_Call) Run(run func()) *MockBoxWidget_GetAllocatedHeight_Call { | |||
| 214 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 215 | + | run() | |||
| 216 | + | }) | |||
| 217 | + | return _c | |||
| 218 | + | } | |||
| 219 | + | ||||
| 220 | + | func (_c *MockBoxWidget_GetAllocatedHeight_Call) Return(n int) *MockBoxWidget_GetAllocatedHeight_Call { | |||
| 221 | + | _c.Call.Return(n) | |||
| 222 | + | return _c | |||
| 223 | + | } | |||
| 224 | + | ||||
| 225 | + | func (_c *MockBoxWidget_GetAllocatedHeight_Call) RunAndReturn(run func() int) *MockBoxWidget_GetAllocatedHeight_Call { | |||
| 226 | + | _c.Call.Return(run) | |||
| 227 | + | return _c | |||
| 228 | + | } | |||
| 229 | + | ||||
| 230 | + | // GetAllocatedWidth provides a mock function for the type MockBoxWidget | |||
| 231 | + | func (_mock *MockBoxWidget) GetAllocatedWidth() int { | |||
| 232 | + | ret := _mock.Called() | |||
| 233 | + | ||||
| 234 | + | if len(ret) == 0 { | |||
| 235 | + | panic("no return value specified for GetAllocatedWidth") | |||
| 236 | + | } | |||
| 237 | + | ||||
| 238 | + | var r0 int | |||
| 239 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |||
| 240 | + | r0 = returnFunc() | |||
| 241 | + | } else { | |||
| 242 | + | r0 = ret.Get(0).(int) | |||
| 243 | + | } | |||
| 244 | + | return r0 | |||
| 245 | + | } | |||
| 246 | + | ||||
| 247 | + | // MockBoxWidget_GetAllocatedWidth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedWidth' | |||
| 248 | + | type MockBoxWidget_GetAllocatedWidth_Call struct { | |||
| 249 | + | *mock.Call | |||
| 250 | + | } | |||
| 251 | + | ||||
| 252 | + | // GetAllocatedWidth is a helper method to define mock.On call | |||
| 253 | + | func (_e *MockBoxWidget_Expecter) GetAllocatedWidth() *MockBoxWidget_GetAllocatedWidth_Call { | |||
| 254 | + | return &MockBoxWidget_GetAllocatedWidth_Call{Call: _e.mock.On("GetAllocatedWidth")} | |||
| 255 | + | } | |||
| 256 | + | ||||
| 257 | + | func (_c *MockBoxWidget_GetAllocatedWidth_Call) Run(run func()) *MockBoxWidget_GetAllocatedWidth_Call { | |||
| 258 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 259 | + | run() | |||
| 260 | + | }) | |||
| 261 | + | return _c | |||
| 262 | + | } | |||
| 263 | + | ||||
| 264 | + | func (_c *MockBoxWidget_GetAllocatedWidth_Call) Return(n int) *MockBoxWidget_GetAllocatedWidth_Call { | |||
| 265 | + | _c.Call.Return(n) | |||
| 266 | + | return _c | |||
| 267 | + | } | |||
| 268 | + | ||||
| 269 | + | func (_c *MockBoxWidget_GetAllocatedWidth_Call) RunAndReturn(run func() int) *MockBoxWidget_GetAllocatedWidth_Call { | |||
| 270 | + | _c.Call.Return(run) | |||
| 271 | + | return _c | |||
| 272 | + | } | |||
| 273 | + | ||||
| 120 | // GetHexpand provides a mock function for the type MockBoxWidget | 274 | // GetHexpand provides a mock function for the type MockBoxWidget | ||
| 121 | func (_mock *MockBoxWidget) GetHexpand() bool { | 275 | func (_mock *MockBoxWidget) GetHexpand() bool { | ||
| 122 | ret := _mock.Called() | 276 | ret := _mock.Called() | ||
M internal/ui/layout/mocks/mock_button_widget.go +154 -0
| @@ -77,6 +77,72 @@ func (_c *MockButtonWidget_AddCssClass_Call) RunAndReturn(run func(cssClass stri | |||
| 77 | 77 | return _c | |
| 78 | 78 | } | |
| 79 | 79 | ||
| 80 | + | // ComputePoint provides a mock function for the type MockButtonWidget | |
| 81 | + | func (_mock *MockButtonWidget) ComputePoint(target layout.Widget) (float64, float64, bool) { | |
| 82 | + | ret := _mock.Called(target) | |
| 83 | + | ||
| 84 | + | if len(ret) == 0 { | |
| 85 | + | panic("no return value specified for ComputePoint") | |
| 86 | + | } | |
| 87 | + | ||
| 88 | + | var r0 float64 | |
| 89 | + | var r1 float64 | |
| 90 | + | var r2 bool | |
| 91 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) (float64, float64, bool)); ok { | |
| 92 | + | return returnFunc(target) | |
| 93 | + | } | |
| 94 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) float64); ok { | |
| 95 | + | r0 = returnFunc(target) | |
| 96 | + | } else { | |
| 97 | + | r0 = ret.Get(0).(float64) | |
| 98 | + | } | |
| 99 | + | if returnFunc, ok := ret.Get(1).(func(layout.Widget) float64); ok { | |
| 100 | + | r1 = returnFunc(target) | |
| 101 | + | } else { | |
| 102 | + | r1 = ret.Get(1).(float64) | |
| 103 | + | } | |
| 104 | + | if returnFunc, ok := ret.Get(2).(func(layout.Widget) bool); ok { | |
| 105 | + | r2 = returnFunc(target) | |
| 106 | + | } else { | |
| 107 | + | r2 = ret.Get(2).(bool) | |
| 108 | + | } | |
| 109 | + | return r0, r1, r2 | |
| 110 | + | } | |
| 111 | + | ||
| 112 | + | // MockButtonWidget_ComputePoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputePoint' | |
| 113 | + | type MockButtonWidget_ComputePoint_Call struct { | |
| 114 | + | *mock.Call | |
| 115 | + | } | |
| 116 | + | ||
| 117 | + | // ComputePoint is a helper method to define mock.On call | |
| 118 | + | // - target layout.Widget | |
| 119 | + | func (_e *MockButtonWidget_Expecter) ComputePoint(target interface{}) *MockButtonWidget_ComputePoint_Call { | |
| 120 | + | return &MockButtonWidget_ComputePoint_Call{Call: _e.mock.On("ComputePoint", target)} | |
| 121 | + | } | |
| 122 | + | ||
| 123 | + | func (_c *MockButtonWidget_ComputePoint_Call) Run(run func(target layout.Widget)) *MockButtonWidget_ComputePoint_Call { | |
| 124 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 125 | + | var arg0 layout.Widget | |
| 126 | + | if args[0] != nil { | |
| 127 | + | arg0 = args[0].(layout.Widget) | |
| 128 | + | } | |
| 129 | + | run( | |
| 130 | + | arg0, | |
| 131 | + | ) | |
| 132 | + | }) | |
| 133 | + | return _c | |
| 134 | + | } | |
| 135 | + | ||
| 136 | + | func (_c *MockButtonWidget_ComputePoint_Call) Return(x float64, y float64, ok bool) *MockButtonWidget_ComputePoint_Call { | |
| 137 | + | _c.Call.Return(x, y, ok) | |
| 138 | + | return _c | |
| 139 | + | } | |
| 140 | + | ||
| 141 | + | func (_c *MockButtonWidget_ComputePoint_Call) RunAndReturn(run func(target layout.Widget) (float64, float64, bool)) *MockButtonWidget_ComputePoint_Call { | |
| 142 | + | _c.Call.Return(run) | |
| 143 | + | return _c | |
| 144 | + | } | |
| 145 | + | ||
| 80 | 146 | // ConnectClicked provides a mock function for the type MockButtonWidget | |
| 81 | 147 | func (_mock *MockButtonWidget) ConnectClicked(callback func()) uint32 { | |
| 82 | 148 | ret := _mock.Called(callback) | |
| @@ -128,6 +194,94 @@ func (_c *MockButtonWidget_ConnectClicked_Call) RunAndReturn(run func(callback f | |||
| 128 | 194 | return _c | |
| 129 | 195 | } | |
| 130 | 196 | ||
| 197 | + | // GetAllocatedHeight provides a mock function for the type MockButtonWidget | |
| 198 | + | func (_mock *MockButtonWidget) GetAllocatedHeight() int { | |
| 199 | + | ret := _mock.Called() | |
| 200 | + | ||
| 201 | + | if len(ret) == 0 { | |
| 202 | + | panic("no return value specified for GetAllocatedHeight") | |
| 203 | + | } | |
| 204 | + | ||
| 205 | + | var r0 int | |
| 206 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |
| 207 | + | r0 = returnFunc() | |
| 208 | + | } else { | |
| 209 | + | r0 = ret.Get(0).(int) | |
| 210 | + | } | |
| 211 | + | return r0 | |
| 212 | + | } | |
| 213 | + | ||
| 214 | + | // MockButtonWidget_GetAllocatedHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedHeight' | |
| 215 | + | type MockButtonWidget_GetAllocatedHeight_Call struct { | |
| 216 | + | *mock.Call | |
| 217 | + | } | |
| 218 | + | ||
| 219 | + | // GetAllocatedHeight is a helper method to define mock.On call | |
| 220 | + | func (_e *MockButtonWidget_Expecter) GetAllocatedHeight() *MockButtonWidget_GetAllocatedHeight_Call { | |
| 221 | + | return &MockButtonWidget_GetAllocatedHeight_Call{Call: _e.mock.On("GetAllocatedHeight")} | |
| 222 | + | } | |
| 223 | + | ||
| 224 | + | func (_c *MockButtonWidget_GetAllocatedHeight_Call) Run(run func()) *MockButtonWidget_GetAllocatedHeight_Call { | |
| 225 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 226 | + | run() | |
| 227 | + | }) | |
| 228 | + | return _c | |
| 229 | + | } | |
| 230 | + | ||
| 231 | + | func (_c *MockButtonWidget_GetAllocatedHeight_Call) Return(n int) *MockButtonWidget_GetAllocatedHeight_Call { | |
| 232 | + | _c.Call.Return(n) | |
| 233 | + | return _c | |
| 234 | + | } | |
| 235 | + | ||
| 236 | + | func (_c *MockButtonWidget_GetAllocatedHeight_Call) RunAndReturn(run func() int) *MockButtonWidget_GetAllocatedHeight_Call { | |
| 237 | + | _c.Call.Return(run) | |
| 238 | + | return _c | |
| 239 | + | } | |
| 240 | + | ||
| 241 | + | // GetAllocatedWidth provides a mock function for the type MockButtonWidget | |
| 242 | + | func (_mock *MockButtonWidget) GetAllocatedWidth() int { | |
| 243 | + | ret := _mock.Called() | |
| 244 | + | ||
| 245 | + | if len(ret) == 0 { | |
| 246 | + | panic("no return value specified for GetAllocatedWidth") | |
| 247 | + | } | |
| 248 | + | ||
| 249 | + | var r0 int | |
| 250 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |
| 251 | + | r0 = returnFunc() | |
| 252 | + | } else { | |
| 253 | + | r0 = ret.Get(0).(int) | |
| 254 | + | } | |
| 255 | + | return r0 | |
| 256 | + | } | |
| 257 | + | ||
| 258 | + | // MockButtonWidget_GetAllocatedWidth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedWidth' | |
| 259 | + | type MockButtonWidget_GetAllocatedWidth_Call struct { | |
| 260 | + | *mock.Call | |
| 261 | + | } | |
| 262 | + | ||
| 263 | + | // GetAllocatedWidth is a helper method to define mock.On call | |
| 264 | + | func (_e *MockButtonWidget_Expecter) GetAllocatedWidth() *MockButtonWidget_GetAllocatedWidth_Call { | |
| 265 | + | return &MockButtonWidget_GetAllocatedWidth_Call{Call: _e.mock.On("GetAllocatedWidth")} | |
| 266 | + | } | |
| 267 | + | ||
| 268 | + | func (_c *MockButtonWidget_GetAllocatedWidth_Call) Run(run func()) *MockButtonWidget_GetAllocatedWidth_Call { | |
| 269 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 270 | + | run() | |
| 271 | + | }) | |
| 272 | + | return _c | |
| 273 | + | } | |
| 274 | + | ||
| 275 | + | func (_c *MockButtonWidget_GetAllocatedWidth_Call) Return(n int) *MockButtonWidget_GetAllocatedWidth_Call { | |
| 276 | + | _c.Call.Return(n) | |
| 277 | + | return _c | |
| 278 | + | } | |
| 279 | + | ||
| 280 | + | func (_c *MockButtonWidget_GetAllocatedWidth_Call) RunAndReturn(run func() int) *MockButtonWidget_GetAllocatedWidth_Call { | |
| 281 | + | _c.Call.Return(run) | |
| 282 | + | return _c | |
| 283 | + | } | |
| 284 | + | ||
| 131 | 285 | // GetChild provides a mock function for the type MockButtonWidget | |
| 132 | 286 | func (_mock *MockButtonWidget) GetChild() layout.Widget { | |
| 133 | 287 | ret := _mock.Called() | |
| @@ -77,6 +77,72 @@ func (_c *MockButtonWidget_AddCssClass_Call) RunAndReturn(run func(cssClass stri | |||||
| 77 | return _c | 77 | return _c | ||
| 78 | } | 78 | } | ||
| 79 | 79 | ||||
| 80 | + | // ComputePoint provides a mock function for the type MockButtonWidget | |||
| 81 | + | func (_mock *MockButtonWidget) ComputePoint(target layout.Widget) (float64, float64, bool) { | |||
| 82 | + | ret := _mock.Called(target) | |||
| 83 | + | ||||
| 84 | + | if len(ret) == 0 { | |||
| 85 | + | panic("no return value specified for ComputePoint") | |||
| 86 | + | } | |||
| 87 | + | ||||
| 88 | + | var r0 float64 | |||
| 89 | + | var r1 float64 | |||
| 90 | + | var r2 bool | |||
| 91 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) (float64, float64, bool)); ok { | |||
| 92 | + | return returnFunc(target) | |||
| 93 | + | } | |||
| 94 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) float64); ok { | |||
| 95 | + | r0 = returnFunc(target) | |||
| 96 | + | } else { | |||
| 97 | + | r0 = ret.Get(0).(float64) | |||
| 98 | + | } | |||
| 99 | + | if returnFunc, ok := ret.Get(1).(func(layout.Widget) float64); ok { | |||
| 100 | + | r1 = returnFunc(target) | |||
| 101 | + | } else { | |||
| 102 | + | r1 = ret.Get(1).(float64) | |||
| 103 | + | } | |||
| 104 | + | if returnFunc, ok := ret.Get(2).(func(layout.Widget) bool); ok { | |||
| 105 | + | r2 = returnFunc(target) | |||
| 106 | + | } else { | |||
| 107 | + | r2 = ret.Get(2).(bool) | |||
| 108 | + | } | |||
| 109 | + | return r0, r1, r2 | |||
| 110 | + | } | |||
| 111 | + | ||||
| 112 | + | // MockButtonWidget_ComputePoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputePoint' | |||
| 113 | + | type MockButtonWidget_ComputePoint_Call struct { | |||
| 114 | + | *mock.Call | |||
| 115 | + | } | |||
| 116 | + | ||||
| 117 | + | // ComputePoint is a helper method to define mock.On call | |||
| 118 | + | // - target layout.Widget | |||
| 119 | + | func (_e *MockButtonWidget_Expecter) ComputePoint(target interface{}) *MockButtonWidget_ComputePoint_Call { | |||
| 120 | + | return &MockButtonWidget_ComputePoint_Call{Call: _e.mock.On("ComputePoint", target)} | |||
| 121 | + | } | |||
| 122 | + | ||||
| 123 | + | func (_c *MockButtonWidget_ComputePoint_Call) Run(run func(target layout.Widget)) *MockButtonWidget_ComputePoint_Call { | |||
| 124 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 125 | + | var arg0 layout.Widget | |||
| 126 | + | if args[0] != nil { | |||
| 127 | + | arg0 = args[0].(layout.Widget) | |||
| 128 | + | } | |||
| 129 | + | run( | |||
| 130 | + | arg0, | |||
| 131 | + | ) | |||
| 132 | + | }) | |||
| 133 | + | return _c | |||
| 134 | + | } | |||
| 135 | + | ||||
| 136 | + | func (_c *MockButtonWidget_ComputePoint_Call) Return(x float64, y float64, ok bool) *MockButtonWidget_ComputePoint_Call { | |||
| 137 | + | _c.Call.Return(x, y, ok) | |||
| 138 | + | return _c | |||
| 139 | + | } | |||
| 140 | + | ||||
| 141 | + | func (_c *MockButtonWidget_ComputePoint_Call) RunAndReturn(run func(target layout.Widget) (float64, float64, bool)) *MockButtonWidget_ComputePoint_Call { | |||
| 142 | + | _c.Call.Return(run) | |||
| 143 | + | return _c | |||
| 144 | + | } | |||
| 145 | + | ||||
| 80 | // ConnectClicked provides a mock function for the type MockButtonWidget | 146 | // ConnectClicked provides a mock function for the type MockButtonWidget | ||
| 81 | func (_mock *MockButtonWidget) ConnectClicked(callback func()) uint32 { | 147 | func (_mock *MockButtonWidget) ConnectClicked(callback func()) uint32 { | ||
| 82 | ret := _mock.Called(callback) | 148 | ret := _mock.Called(callback) | ||
| @@ -128,6 +194,94 @@ func (_c *MockButtonWidget_ConnectClicked_Call) RunAndReturn(run func(callback f | |||||
| 128 | return _c | 194 | return _c | ||
| 129 | } | 195 | } | ||
| 130 | 196 | ||||
| 197 | + | // GetAllocatedHeight provides a mock function for the type MockButtonWidget | |||
| 198 | + | func (_mock *MockButtonWidget) GetAllocatedHeight() int { | |||
| 199 | + | ret := _mock.Called() | |||
| 200 | + | ||||
| 201 | + | if len(ret) == 0 { | |||
| 202 | + | panic("no return value specified for GetAllocatedHeight") | |||
| 203 | + | } | |||
| 204 | + | ||||
| 205 | + | var r0 int | |||
| 206 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |||
| 207 | + | r0 = returnFunc() | |||
| 208 | + | } else { | |||
| 209 | + | r0 = ret.Get(0).(int) | |||
| 210 | + | } | |||
| 211 | + | return r0 | |||
| 212 | + | } | |||
| 213 | + | ||||
| 214 | + | // MockButtonWidget_GetAllocatedHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedHeight' | |||
| 215 | + | type MockButtonWidget_GetAllocatedHeight_Call struct { | |||
| 216 | + | *mock.Call | |||
| 217 | + | } | |||
| 218 | + | ||||
| 219 | + | // GetAllocatedHeight is a helper method to define mock.On call | |||
| 220 | + | func (_e *MockButtonWidget_Expecter) GetAllocatedHeight() *MockButtonWidget_GetAllocatedHeight_Call { | |||
| 221 | + | return &MockButtonWidget_GetAllocatedHeight_Call{Call: _e.mock.On("GetAllocatedHeight")} | |||
| 222 | + | } | |||
| 223 | + | ||||
| 224 | + | func (_c *MockButtonWidget_GetAllocatedHeight_Call) Run(run func()) *MockButtonWidget_GetAllocatedHeight_Call { | |||
| 225 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 226 | + | run() | |||
| 227 | + | }) | |||
| 228 | + | return _c | |||
| 229 | + | } | |||
| 230 | + | ||||
| 231 | + | func (_c *MockButtonWidget_GetAllocatedHeight_Call) Return(n int) *MockButtonWidget_GetAllocatedHeight_Call { | |||
| 232 | + | _c.Call.Return(n) | |||
| 233 | + | return _c | |||
| 234 | + | } | |||
| 235 | + | ||||
| 236 | + | func (_c *MockButtonWidget_GetAllocatedHeight_Call) RunAndReturn(run func() int) *MockButtonWidget_GetAllocatedHeight_Call { | |||
| 237 | + | _c.Call.Return(run) | |||
| 238 | + | return _c | |||
| 239 | + | } | |||
| 240 | + | ||||
| 241 | + | // GetAllocatedWidth provides a mock function for the type MockButtonWidget | |||
| 242 | + | func (_mock *MockButtonWidget) GetAllocatedWidth() int { | |||
| 243 | + | ret := _mock.Called() | |||
| 244 | + | ||||
| 245 | + | if len(ret) == 0 { | |||
| 246 | + | panic("no return value specified for GetAllocatedWidth") | |||
| 247 | + | } | |||
| 248 | + | ||||
| 249 | + | var r0 int | |||
| 250 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |||
| 251 | + | r0 = returnFunc() | |||
| 252 | + | } else { | |||
| 253 | + | r0 = ret.Get(0).(int) | |||
| 254 | + | } | |||
| 255 | + | return r0 | |||
| 256 | + | } | |||
| 257 | + | ||||
| 258 | + | // MockButtonWidget_GetAllocatedWidth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedWidth' | |||
| 259 | + | type MockButtonWidget_GetAllocatedWidth_Call struct { | |||
| 260 | + | *mock.Call | |||
| 261 | + | } | |||
| 262 | + | ||||
| 263 | + | // GetAllocatedWidth is a helper method to define mock.On call | |||
| 264 | + | func (_e *MockButtonWidget_Expecter) GetAllocatedWidth() *MockButtonWidget_GetAllocatedWidth_Call { | |||
| 265 | + | return &MockButtonWidget_GetAllocatedWidth_Call{Call: _e.mock.On("GetAllocatedWidth")} | |||
| 266 | + | } | |||
| 267 | + | ||||
| 268 | + | func (_c *MockButtonWidget_GetAllocatedWidth_Call) Run(run func()) *MockButtonWidget_GetAllocatedWidth_Call { | |||
| 269 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 270 | + | run() | |||
| 271 | + | }) | |||
| 272 | + | return _c | |||
| 273 | + | } | |||
| 274 | + | ||||
| 275 | + | func (_c *MockButtonWidget_GetAllocatedWidth_Call) Return(n int) *MockButtonWidget_GetAllocatedWidth_Call { | |||
| 276 | + | _c.Call.Return(n) | |||
| 277 | + | return _c | |||
| 278 | + | } | |||
| 279 | + | ||||
| 280 | + | func (_c *MockButtonWidget_GetAllocatedWidth_Call) RunAndReturn(run func() int) *MockButtonWidget_GetAllocatedWidth_Call { | |||
| 281 | + | _c.Call.Return(run) | |||
| 282 | + | return _c | |||
| 283 | + | } | |||
| 284 | + | ||||
| 131 | // GetChild provides a mock function for the type MockButtonWidget | 285 | // GetChild provides a mock function for the type MockButtonWidget | ||
| 132 | func (_mock *MockButtonWidget) GetChild() layout.Widget { | 286 | func (_mock *MockButtonWidget) GetChild() layout.Widget { | ||
| 133 | ret := _mock.Called() | 287 | ret := _mock.Called() | ||
M internal/ui/layout/mocks/mock_image_widget.go +194 -0
| @@ -110,6 +110,160 @@ func (_c *MockImageWidget_Clear_Call) RunAndReturn(run func()) *MockImageWidget_ | |||
| 110 | 110 | return _c | |
| 111 | 111 | } | |
| 112 | 112 | ||
| 113 | + | // ComputePoint provides a mock function for the type MockImageWidget | |
| 114 | + | func (_mock *MockImageWidget) ComputePoint(target layout.Widget) (float64, float64, bool) { | |
| 115 | + | ret := _mock.Called(target) | |
| 116 | + | ||
| 117 | + | if len(ret) == 0 { | |
| 118 | + | panic("no return value specified for ComputePoint") | |
| 119 | + | } | |
| 120 | + | ||
| 121 | + | var r0 float64 | |
| 122 | + | var r1 float64 | |
| 123 | + | var r2 bool | |
| 124 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) (float64, float64, bool)); ok { | |
| 125 | + | return returnFunc(target) | |
| 126 | + | } | |
| 127 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) float64); ok { | |
| 128 | + | r0 = returnFunc(target) | |
| 129 | + | } else { | |
| 130 | + | r0 = ret.Get(0).(float64) | |
| 131 | + | } | |
| 132 | + | if returnFunc, ok := ret.Get(1).(func(layout.Widget) float64); ok { | |
| 133 | + | r1 = returnFunc(target) | |
| 134 | + | } else { | |
| 135 | + | r1 = ret.Get(1).(float64) | |
| 136 | + | } | |
| 137 | + | if returnFunc, ok := ret.Get(2).(func(layout.Widget) bool); ok { | |
| 138 | + | r2 = returnFunc(target) | |
| 139 | + | } else { | |
| 140 | + | r2 = ret.Get(2).(bool) | |
| 141 | + | } | |
| 142 | + | return r0, r1, r2 | |
| 143 | + | } | |
| 144 | + | ||
| 145 | + | // MockImageWidget_ComputePoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputePoint' | |
| 146 | + | type MockImageWidget_ComputePoint_Call struct { | |
| 147 | + | *mock.Call | |
| 148 | + | } | |
| 149 | + | ||
| 150 | + | // ComputePoint is a helper method to define mock.On call | |
| 151 | + | // - target layout.Widget | |
| 152 | + | func (_e *MockImageWidget_Expecter) ComputePoint(target interface{}) *MockImageWidget_ComputePoint_Call { | |
| 153 | + | return &MockImageWidget_ComputePoint_Call{Call: _e.mock.On("ComputePoint", target)} | |
| 154 | + | } | |
| 155 | + | ||
| 156 | + | func (_c *MockImageWidget_ComputePoint_Call) Run(run func(target layout.Widget)) *MockImageWidget_ComputePoint_Call { | |
| 157 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 158 | + | var arg0 layout.Widget | |
| 159 | + | if args[0] != nil { | |
| 160 | + | arg0 = args[0].(layout.Widget) | |
| 161 | + | } | |
| 162 | + | run( | |
| 163 | + | arg0, | |
| 164 | + | ) | |
| 165 | + | }) | |
| 166 | + | return _c | |
| 167 | + | } | |
| 168 | + | ||
| 169 | + | func (_c *MockImageWidget_ComputePoint_Call) Return(x float64, y float64, ok bool) *MockImageWidget_ComputePoint_Call { | |
| 170 | + | _c.Call.Return(x, y, ok) | |
| 171 | + | return _c | |
| 172 | + | } | |
| 173 | + | ||
| 174 | + | func (_c *MockImageWidget_ComputePoint_Call) RunAndReturn(run func(target layout.Widget) (float64, float64, bool)) *MockImageWidget_ComputePoint_Call { | |
| 175 | + | _c.Call.Return(run) | |
| 176 | + | return _c | |
| 177 | + | } | |
| 178 | + | ||
| 179 | + | // GetAllocatedHeight provides a mock function for the type MockImageWidget | |
| 180 | + | func (_mock *MockImageWidget) GetAllocatedHeight() int { | |
| 181 | + | ret := _mock.Called() | |
| 182 | + | ||
| 183 | + | if len(ret) == 0 { | |
| 184 | + | panic("no return value specified for GetAllocatedHeight") | |
| 185 | + | } | |
| 186 | + | ||
| 187 | + | var r0 int | |
| 188 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |
| 189 | + | r0 = returnFunc() | |
| 190 | + | } else { | |
| 191 | + | r0 = ret.Get(0).(int) | |
| 192 | + | } | |
| 193 | + | return r0 | |
| 194 | + | } | |
| 195 | + | ||
| 196 | + | // MockImageWidget_GetAllocatedHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedHeight' | |
| 197 | + | type MockImageWidget_GetAllocatedHeight_Call struct { | |
| 198 | + | *mock.Call | |
| 199 | + | } | |
| 200 | + | ||
| 201 | + | // GetAllocatedHeight is a helper method to define mock.On call | |
| 202 | + | func (_e *MockImageWidget_Expecter) GetAllocatedHeight() *MockImageWidget_GetAllocatedHeight_Call { | |
| 203 | + | return &MockImageWidget_GetAllocatedHeight_Call{Call: _e.mock.On("GetAllocatedHeight")} | |
| 204 | + | } | |
| 205 | + | ||
| 206 | + | func (_c *MockImageWidget_GetAllocatedHeight_Call) Run(run func()) *MockImageWidget_GetAllocatedHeight_Call { | |
| 207 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 208 | + | run() | |
| 209 | + | }) | |
| 210 | + | return _c | |
| 211 | + | } | |
| 212 | + | ||
| 213 | + | func (_c *MockImageWidget_GetAllocatedHeight_Call) Return(n int) *MockImageWidget_GetAllocatedHeight_Call { | |
| 214 | + | _c.Call.Return(n) | |
| 215 | + | return _c | |
| 216 | + | } | |
| 217 | + | ||
| 218 | + | func (_c *MockImageWidget_GetAllocatedHeight_Call) RunAndReturn(run func() int) *MockImageWidget_GetAllocatedHeight_Call { | |
| 219 | + | _c.Call.Return(run) | |
| 220 | + | return _c | |
| 221 | + | } | |
| 222 | + | ||
| 223 | + | // GetAllocatedWidth provides a mock function for the type MockImageWidget | |
| 224 | + | func (_mock *MockImageWidget) GetAllocatedWidth() int { | |
| 225 | + | ret := _mock.Called() | |
| 226 | + | ||
| 227 | + | if len(ret) == 0 { | |
| 228 | + | panic("no return value specified for GetAllocatedWidth") | |
| 229 | + | } | |
| 230 | + | ||
| 231 | + | var r0 int | |
| 232 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |
| 233 | + | r0 = returnFunc() | |
| 234 | + | } else { | |
| 235 | + | r0 = ret.Get(0).(int) | |
| 236 | + | } | |
| 237 | + | return r0 | |
| 238 | + | } | |
| 239 | + | ||
| 240 | + | // MockImageWidget_GetAllocatedWidth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedWidth' | |
| 241 | + | type MockImageWidget_GetAllocatedWidth_Call struct { | |
| 242 | + | *mock.Call | |
| 243 | + | } | |
| 244 | + | ||
| 245 | + | // GetAllocatedWidth is a helper method to define mock.On call | |
| 246 | + | func (_e *MockImageWidget_Expecter) GetAllocatedWidth() *MockImageWidget_GetAllocatedWidth_Call { | |
| 247 | + | return &MockImageWidget_GetAllocatedWidth_Call{Call: _e.mock.On("GetAllocatedWidth")} | |
| 248 | + | } | |
| 249 | + | ||
| 250 | + | func (_c *MockImageWidget_GetAllocatedWidth_Call) Run(run func()) *MockImageWidget_GetAllocatedWidth_Call { | |
| 251 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 252 | + | run() | |
| 253 | + | }) | |
| 254 | + | return _c | |
| 255 | + | } | |
| 256 | + | ||
| 257 | + | func (_c *MockImageWidget_GetAllocatedWidth_Call) Return(n int) *MockImageWidget_GetAllocatedWidth_Call { | |
| 258 | + | _c.Call.Return(n) | |
| 259 | + | return _c | |
| 260 | + | } | |
| 261 | + | ||
| 262 | + | func (_c *MockImageWidget_GetAllocatedWidth_Call) RunAndReturn(run func() int) *MockImageWidget_GetAllocatedWidth_Call { | |
| 263 | + | _c.Call.Return(run) | |
| 264 | + | return _c | |
| 265 | + | } | |
| 266 | + | ||
| 113 | 267 | // GetHexpand provides a mock function for the type MockImageWidget | |
| 114 | 268 | func (_mock *MockImageWidget) GetHexpand() bool { | |
| 115 | 269 | ret := _mock.Called() | |
| @@ -746,6 +900,46 @@ func (_c *MockImageWidget_SetFromIconName_Call) RunAndReturn(run func(iconName s | |||
| 746 | 900 | return _c | |
| 747 | 901 | } | |
| 748 | 902 | ||
| 903 | + | // SetFromPaintable provides a mock function for the type MockImageWidget | |
| 904 | + | func (_mock *MockImageWidget) SetFromPaintable(paintable layout.Paintable) { | |
| 905 | + | _mock.Called(paintable) | |
| 906 | + | return | |
| 907 | + | } | |
| 908 | + | ||
| 909 | + | // MockImageWidget_SetFromPaintable_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetFromPaintable' | |
| 910 | + | type MockImageWidget_SetFromPaintable_Call struct { | |
| 911 | + | *mock.Call | |
| 912 | + | } | |
| 913 | + | ||
| 914 | + | // SetFromPaintable is a helper method to define mock.On call | |
| 915 | + | // - paintable layout.Paintable | |
| 916 | + | func (_e *MockImageWidget_Expecter) SetFromPaintable(paintable interface{}) *MockImageWidget_SetFromPaintable_Call { | |
| 917 | + | return &MockImageWidget_SetFromPaintable_Call{Call: _e.mock.On("SetFromPaintable", paintable)} | |
| 918 | + | } | |
| 919 | + | ||
| 920 | + | func (_c *MockImageWidget_SetFromPaintable_Call) Run(run func(paintable layout.Paintable)) *MockImageWidget_SetFromPaintable_Call { | |
| 921 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 922 | + | var arg0 layout.Paintable | |
| 923 | + | if args[0] != nil { | |
| 924 | + | arg0 = args[0].(layout.Paintable) | |
| 925 | + | } | |
| 926 | + | run( | |
| 927 | + | arg0, | |
| 928 | + | ) | |
| 929 | + | }) | |
| 930 | + | return _c | |
| 931 | + | } | |
| 932 | + | ||
| 933 | + | func (_c *MockImageWidget_SetFromPaintable_Call) Return() *MockImageWidget_SetFromPaintable_Call { | |
| 934 | + | _c.Call.Return() | |
| 935 | + | return _c | |
| 936 | + | } | |
| 937 | + | ||
| 938 | + | func (_c *MockImageWidget_SetFromPaintable_Call) RunAndReturn(run func(paintable layout.Paintable)) *MockImageWidget_SetFromPaintable_Call { | |
| 939 | + | _c.Run(run) | |
| 940 | + | return _c | |
| 941 | + | } | |
| 942 | + | ||
| 749 | 943 | // SetHalign provides a mock function for the type MockImageWidget | |
| 750 | 944 | func (_mock *MockImageWidget) SetHalign(align gtk.Align) { | |
| 751 | 945 | _mock.Called(align) | |
| @@ -110,6 +110,160 @@ func (_c *MockImageWidget_Clear_Call) RunAndReturn(run func()) *MockImageWidget_ | |||||
| 110 | return _c | 110 | return _c | ||
| 111 | } | 111 | } | ||
| 112 | 112 | ||||
| 113 | + | // ComputePoint provides a mock function for the type MockImageWidget | |||
| 114 | + | func (_mock *MockImageWidget) ComputePoint(target layout.Widget) (float64, float64, bool) { | |||
| 115 | + | ret := _mock.Called(target) | |||
| 116 | + | ||||
| 117 | + | if len(ret) == 0 { | |||
| 118 | + | panic("no return value specified for ComputePoint") | |||
| 119 | + | } | |||
| 120 | + | ||||
| 121 | + | var r0 float64 | |||
| 122 | + | var r1 float64 | |||
| 123 | + | var r2 bool | |||
| 124 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) (float64, float64, bool)); ok { | |||
| 125 | + | return returnFunc(target) | |||
| 126 | + | } | |||
| 127 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) float64); ok { | |||
| 128 | + | r0 = returnFunc(target) | |||
| 129 | + | } else { | |||
| 130 | + | r0 = ret.Get(0).(float64) | |||
| 131 | + | } | |||
| 132 | + | if returnFunc, ok := ret.Get(1).(func(layout.Widget) float64); ok { | |||
| 133 | + | r1 = returnFunc(target) | |||
| 134 | + | } else { | |||
| 135 | + | r1 = ret.Get(1).(float64) | |||
| 136 | + | } | |||
| 137 | + | if returnFunc, ok := ret.Get(2).(func(layout.Widget) bool); ok { | |||
| 138 | + | r2 = returnFunc(target) | |||
| 139 | + | } else { | |||
| 140 | + | r2 = ret.Get(2).(bool) | |||
| 141 | + | } | |||
| 142 | + | return r0, r1, r2 | |||
| 143 | + | } | |||
| 144 | + | ||||
| 145 | + | // MockImageWidget_ComputePoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputePoint' | |||
| 146 | + | type MockImageWidget_ComputePoint_Call struct { | |||
| 147 | + | *mock.Call | |||
| 148 | + | } | |||
| 149 | + | ||||
| 150 | + | // ComputePoint is a helper method to define mock.On call | |||
| 151 | + | // - target layout.Widget | |||
| 152 | + | func (_e *MockImageWidget_Expecter) ComputePoint(target interface{}) *MockImageWidget_ComputePoint_Call { | |||
| 153 | + | return &MockImageWidget_ComputePoint_Call{Call: _e.mock.On("ComputePoint", target)} | |||
| 154 | + | } | |||
| 155 | + | ||||
| 156 | + | func (_c *MockImageWidget_ComputePoint_Call) Run(run func(target layout.Widget)) *MockImageWidget_ComputePoint_Call { | |||
| 157 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 158 | + | var arg0 layout.Widget | |||
| 159 | + | if args[0] != nil { | |||
| 160 | + | arg0 = args[0].(layout.Widget) | |||
| 161 | + | } | |||
| 162 | + | run( | |||
| 163 | + | arg0, | |||
| 164 | + | ) | |||
| 165 | + | }) | |||
| 166 | + | return _c | |||
| 167 | + | } | |||
| 168 | + | ||||
| 169 | + | func (_c *MockImageWidget_ComputePoint_Call) Return(x float64, y float64, ok bool) *MockImageWidget_ComputePoint_Call { | |||
| 170 | + | _c.Call.Return(x, y, ok) | |||
| 171 | + | return _c | |||
| 172 | + | } | |||
| 173 | + | ||||
| 174 | + | func (_c *MockImageWidget_ComputePoint_Call) RunAndReturn(run func(target layout.Widget) (float64, float64, bool)) *MockImageWidget_ComputePoint_Call { | |||
| 175 | + | _c.Call.Return(run) | |||
| 176 | + | return _c | |||
| 177 | + | } | |||
| 178 | + | ||||
| 179 | + | // GetAllocatedHeight provides a mock function for the type MockImageWidget | |||
| 180 | + | func (_mock *MockImageWidget) GetAllocatedHeight() int { | |||
| 181 | + | ret := _mock.Called() | |||
| 182 | + | ||||
| 183 | + | if len(ret) == 0 { | |||
| 184 | + | panic("no return value specified for GetAllocatedHeight") | |||
| 185 | + | } | |||
| 186 | + | ||||
| 187 | + | var r0 int | |||
| 188 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |||
| 189 | + | r0 = returnFunc() | |||
| 190 | + | } else { | |||
| 191 | + | r0 = ret.Get(0).(int) | |||
| 192 | + | } | |||
| 193 | + | return r0 | |||
| 194 | + | } | |||
| 195 | + | ||||
| 196 | + | // MockImageWidget_GetAllocatedHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedHeight' | |||
| 197 | + | type MockImageWidget_GetAllocatedHeight_Call struct { | |||
| 198 | + | *mock.Call | |||
| 199 | + | } | |||
| 200 | + | ||||
| 201 | + | // GetAllocatedHeight is a helper method to define mock.On call | |||
| 202 | + | func (_e *MockImageWidget_Expecter) GetAllocatedHeight() *MockImageWidget_GetAllocatedHeight_Call { | |||
| 203 | + | return &MockImageWidget_GetAllocatedHeight_Call{Call: _e.mock.On("GetAllocatedHeight")} | |||
| 204 | + | } | |||
| 205 | + | ||||
| 206 | + | func (_c *MockImageWidget_GetAllocatedHeight_Call) Run(run func()) *MockImageWidget_GetAllocatedHeight_Call { | |||
| 207 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 208 | + | run() | |||
| 209 | + | }) | |||
| 210 | + | return _c | |||
| 211 | + | } | |||
| 212 | + | ||||
| 213 | + | func (_c *MockImageWidget_GetAllocatedHeight_Call) Return(n int) *MockImageWidget_GetAllocatedHeight_Call { | |||
| 214 | + | _c.Call.Return(n) | |||
| 215 | + | return _c | |||
| 216 | + | } | |||
| 217 | + | ||||
| 218 | + | func (_c *MockImageWidget_GetAllocatedHeight_Call) RunAndReturn(run func() int) *MockImageWidget_GetAllocatedHeight_Call { | |||
| 219 | + | _c.Call.Return(run) | |||
| 220 | + | return _c | |||
| 221 | + | } | |||
| 222 | + | ||||
| 223 | + | // GetAllocatedWidth provides a mock function for the type MockImageWidget | |||
| 224 | + | func (_mock *MockImageWidget) GetAllocatedWidth() int { | |||
| 225 | + | ret := _mock.Called() | |||
| 226 | + | ||||
| 227 | + | if len(ret) == 0 { | |||
| 228 | + | panic("no return value specified for GetAllocatedWidth") | |||
| 229 | + | } | |||
| 230 | + | ||||
| 231 | + | var r0 int | |||
| 232 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |||
| 233 | + | r0 = returnFunc() | |||
| 234 | + | } else { | |||
| 235 | + | r0 = ret.Get(0).(int) | |||
| 236 | + | } | |||
| 237 | + | return r0 | |||
| 238 | + | } | |||
| 239 | + | ||||
| 240 | + | // MockImageWidget_GetAllocatedWidth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedWidth' | |||
| 241 | + | type MockImageWidget_GetAllocatedWidth_Call struct { | |||
| 242 | + | *mock.Call | |||
| 243 | + | } | |||
| 244 | + | ||||
| 245 | + | // GetAllocatedWidth is a helper method to define mock.On call | |||
| 246 | + | func (_e *MockImageWidget_Expecter) GetAllocatedWidth() *MockImageWidget_GetAllocatedWidth_Call { | |||
| 247 | + | return &MockImageWidget_GetAllocatedWidth_Call{Call: _e.mock.On("GetAllocatedWidth")} | |||
| 248 | + | } | |||
| 249 | + | ||||
| 250 | + | func (_c *MockImageWidget_GetAllocatedWidth_Call) Run(run func()) *MockImageWidget_GetAllocatedWidth_Call { | |||
| 251 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 252 | + | run() | |||
| 253 | + | }) | |||
| 254 | + | return _c | |||
| 255 | + | } | |||
| 256 | + | ||||
| 257 | + | func (_c *MockImageWidget_GetAllocatedWidth_Call) Return(n int) *MockImageWidget_GetAllocatedWidth_Call { | |||
| 258 | + | _c.Call.Return(n) | |||
| 259 | + | return _c | |||
| 260 | + | } | |||
| 261 | + | ||||
| 262 | + | func (_c *MockImageWidget_GetAllocatedWidth_Call) RunAndReturn(run func() int) *MockImageWidget_GetAllocatedWidth_Call { | |||
| 263 | + | _c.Call.Return(run) | |||
| 264 | + | return _c | |||
| 265 | + | } | |||
| 266 | + | ||||
| 113 | // GetHexpand provides a mock function for the type MockImageWidget | 267 | // GetHexpand provides a mock function for the type MockImageWidget | ||
| 114 | func (_mock *MockImageWidget) GetHexpand() bool { | 268 | func (_mock *MockImageWidget) GetHexpand() bool { | ||
| 115 | ret := _mock.Called() | 269 | ret := _mock.Called() | ||
| @@ -746,6 +900,46 @@ func (_c *MockImageWidget_SetFromIconName_Call) RunAndReturn(run func(iconName s | |||||
| 746 | return _c | 900 | return _c | ||
| 747 | } | 901 | } | ||
| 748 | 902 | ||||
| 903 | + | // SetFromPaintable provides a mock function for the type MockImageWidget | |||
| 904 | + | func (_mock *MockImageWidget) SetFromPaintable(paintable layout.Paintable) { | |||
| 905 | + | _mock.Called(paintable) | |||
| 906 | + | return | |||
| 907 | + | } | |||
| 908 | + | ||||
| 909 | + | // MockImageWidget_SetFromPaintable_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetFromPaintable' | |||
| 910 | + | type MockImageWidget_SetFromPaintable_Call struct { | |||
| 911 | + | *mock.Call | |||
| 912 | + | } | |||
| 913 | + | ||||
| 914 | + | // SetFromPaintable is a helper method to define mock.On call | |||
| 915 | + | // - paintable layout.Paintable | |||
| 916 | + | func (_e *MockImageWidget_Expecter) SetFromPaintable(paintable interface{}) *MockImageWidget_SetFromPaintable_Call { | |||
| 917 | + | return &MockImageWidget_SetFromPaintable_Call{Call: _e.mock.On("SetFromPaintable", paintable)} | |||
| 918 | + | } | |||
| 919 | + | ||||
| 920 | + | func (_c *MockImageWidget_SetFromPaintable_Call) Run(run func(paintable layout.Paintable)) *MockImageWidget_SetFromPaintable_Call { | |||
| 921 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 922 | + | var arg0 layout.Paintable | |||
| 923 | + | if args[0] != nil { | |||
| 924 | + | arg0 = args[0].(layout.Paintable) | |||
| 925 | + | } | |||
| 926 | + | run( | |||
| 927 | + | arg0, | |||
| 928 | + | ) | |||
| 929 | + | }) | |||
| 930 | + | return _c | |||
| 931 | + | } | |||
| 932 | + | ||||
| 933 | + | func (_c *MockImageWidget_SetFromPaintable_Call) Return() *MockImageWidget_SetFromPaintable_Call { | |||
| 934 | + | _c.Call.Return() | |||
| 935 | + | return _c | |||
| 936 | + | } | |||
| 937 | + | ||||
| 938 | + | func (_c *MockImageWidget_SetFromPaintable_Call) RunAndReturn(run func(paintable layout.Paintable)) *MockImageWidget_SetFromPaintable_Call { | |||
| 939 | + | _c.Run(run) | |||
| 940 | + | return _c | |||
| 941 | + | } | |||
| 942 | + | ||||
| 749 | // SetHalign provides a mock function for the type MockImageWidget | 943 | // SetHalign provides a mock function for the type MockImageWidget | ||
| 750 | func (_mock *MockImageWidget) SetHalign(align gtk.Align) { | 944 | func (_mock *MockImageWidget) SetHalign(align gtk.Align) { | ||
| 751 | _mock.Called(align) | 945 | _mock.Called(align) | ||
M internal/ui/layout/mocks/mock_label_widget.go +154 -0
| @@ -77,6 +77,160 @@ func (_c *MockLabelWidget_AddCssClass_Call) RunAndReturn(run func(cssClass strin | |||
| 77 | 77 | return _c | |
| 78 | 78 | } | |
| 79 | 79 | ||
| 80 | + | // ComputePoint provides a mock function for the type MockLabelWidget | |
| 81 | + | func (_mock *MockLabelWidget) ComputePoint(target layout.Widget) (float64, float64, bool) { | |
| 82 | + | ret := _mock.Called(target) | |
| 83 | + | ||
| 84 | + | if len(ret) == 0 { | |
| 85 | + | panic("no return value specified for ComputePoint") | |
| 86 | + | } | |
| 87 | + | ||
| 88 | + | var r0 float64 | |
| 89 | + | var r1 float64 | |
| 90 | + | var r2 bool | |
| 91 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) (float64, float64, bool)); ok { | |
| 92 | + | return returnFunc(target) | |
| 93 | + | } | |
| 94 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) float64); ok { | |
| 95 | + | r0 = returnFunc(target) | |
| 96 | + | } else { | |
| 97 | + | r0 = ret.Get(0).(float64) | |
| 98 | + | } | |
| 99 | + | if returnFunc, ok := ret.Get(1).(func(layout.Widget) float64); ok { | |
| 100 | + | r1 = returnFunc(target) | |
| 101 | + | } else { | |
| 102 | + | r1 = ret.Get(1).(float64) | |
| 103 | + | } | |
| 104 | + | if returnFunc, ok := ret.Get(2).(func(layout.Widget) bool); ok { | |
| 105 | + | r2 = returnFunc(target) | |
| 106 | + | } else { | |
| 107 | + | r2 = ret.Get(2).(bool) | |
| 108 | + | } | |
| 109 | + | return r0, r1, r2 | |
| 110 | + | } | |
| 111 | + | ||
| 112 | + | // MockLabelWidget_ComputePoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputePoint' | |
| 113 | + | type MockLabelWidget_ComputePoint_Call struct { | |
| 114 | + | *mock.Call | |
| 115 | + | } | |
| 116 | + | ||
| 117 | + | // ComputePoint is a helper method to define mock.On call | |
| 118 | + | // - target layout.Widget | |
| 119 | + | func (_e *MockLabelWidget_Expecter) ComputePoint(target interface{}) *MockLabelWidget_ComputePoint_Call { | |
| 120 | + | return &MockLabelWidget_ComputePoint_Call{Call: _e.mock.On("ComputePoint", target)} | |
| 121 | + | } | |
| 122 | + | ||
| 123 | + | func (_c *MockLabelWidget_ComputePoint_Call) Run(run func(target layout.Widget)) *MockLabelWidget_ComputePoint_Call { | |
| 124 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 125 | + | var arg0 layout.Widget | |
| 126 | + | if args[0] != nil { | |
| 127 | + | arg0 = args[0].(layout.Widget) | |
| 128 | + | } | |
| 129 | + | run( | |
| 130 | + | arg0, | |
| 131 | + | ) | |
| 132 | + | }) | |
| 133 | + | return _c | |
| 134 | + | } | |
| 135 | + | ||
| 136 | + | func (_c *MockLabelWidget_ComputePoint_Call) Return(x float64, y float64, ok bool) *MockLabelWidget_ComputePoint_Call { | |
| 137 | + | _c.Call.Return(x, y, ok) | |
| 138 | + | return _c | |
| 139 | + | } | |
| 140 | + | ||
| 141 | + | func (_c *MockLabelWidget_ComputePoint_Call) RunAndReturn(run func(target layout.Widget) (float64, float64, bool)) *MockLabelWidget_ComputePoint_Call { | |
| 142 | + | _c.Call.Return(run) | |
| 143 | + | return _c | |
| 144 | + | } | |
| 145 | + | ||
| 146 | + | // GetAllocatedHeight provides a mock function for the type MockLabelWidget | |
| 147 | + | func (_mock *MockLabelWidget) GetAllocatedHeight() int { | |
| 148 | + | ret := _mock.Called() | |
| 149 | + | ||
| 150 | + | if len(ret) == 0 { | |
| 151 | + | panic("no return value specified for GetAllocatedHeight") | |
| 152 | + | } | |
| 153 | + | ||
| 154 | + | var r0 int | |
| 155 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |
| 156 | + | r0 = returnFunc() | |
| 157 | + | } else { | |
| 158 | + | r0 = ret.Get(0).(int) | |
| 159 | + | } | |
| 160 | + | return r0 | |
| 161 | + | } | |
| 162 | + | ||
| 163 | + | // MockLabelWidget_GetAllocatedHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedHeight' | |
| 164 | + | type MockLabelWidget_GetAllocatedHeight_Call struct { | |
| 165 | + | *mock.Call | |
| 166 | + | } | |
| 167 | + | ||
| 168 | + | // GetAllocatedHeight is a helper method to define mock.On call | |
| 169 | + | func (_e *MockLabelWidget_Expecter) GetAllocatedHeight() *MockLabelWidget_GetAllocatedHeight_Call { | |
| 170 | + | return &MockLabelWidget_GetAllocatedHeight_Call{Call: _e.mock.On("GetAllocatedHeight")} | |
| 171 | + | } | |
| 172 | + | ||
| 173 | + | func (_c *MockLabelWidget_GetAllocatedHeight_Call) Run(run func()) *MockLabelWidget_GetAllocatedHeight_Call { | |
| 174 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 175 | + | run() | |
| 176 | + | }) | |
| 177 | + | return _c | |
| 178 | + | } | |
| 179 | + | ||
| 180 | + | func (_c *MockLabelWidget_GetAllocatedHeight_Call) Return(n int) *MockLabelWidget_GetAllocatedHeight_Call { | |
| 181 | + | _c.Call.Return(n) | |
| 182 | + | return _c | |
| 183 | + | } | |
| 184 | + | ||
| 185 | + | func (_c *MockLabelWidget_GetAllocatedHeight_Call) RunAndReturn(run func() int) *MockLabelWidget_GetAllocatedHeight_Call { | |
| 186 | + | _c.Call.Return(run) | |
| 187 | + | return _c | |
| 188 | + | } | |
| 189 | + | ||
| 190 | + | // GetAllocatedWidth provides a mock function for the type MockLabelWidget | |
| 191 | + | func (_mock *MockLabelWidget) GetAllocatedWidth() int { | |
| 192 | + | ret := _mock.Called() | |
| 193 | + | ||
| 194 | + | if len(ret) == 0 { | |
| 195 | + | panic("no return value specified for GetAllocatedWidth") | |
| 196 | + | } | |
| 197 | + | ||
| 198 | + | var r0 int | |
| 199 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |
| 200 | + | r0 = returnFunc() | |
| 201 | + | } else { | |
| 202 | + | r0 = ret.Get(0).(int) | |
| 203 | + | } | |
| 204 | + | return r0 | |
| 205 | + | } | |
| 206 | + | ||
| 207 | + | // MockLabelWidget_GetAllocatedWidth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedWidth' | |
| 208 | + | type MockLabelWidget_GetAllocatedWidth_Call struct { | |
| 209 | + | *mock.Call | |
| 210 | + | } | |
| 211 | + | ||
| 212 | + | // GetAllocatedWidth is a helper method to define mock.On call | |
| 213 | + | func (_e *MockLabelWidget_Expecter) GetAllocatedWidth() *MockLabelWidget_GetAllocatedWidth_Call { | |
| 214 | + | return &MockLabelWidget_GetAllocatedWidth_Call{Call: _e.mock.On("GetAllocatedWidth")} | |
| 215 | + | } | |
| 216 | + | ||
| 217 | + | func (_c *MockLabelWidget_GetAllocatedWidth_Call) Run(run func()) *MockLabelWidget_GetAllocatedWidth_Call { | |
| 218 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 219 | + | run() | |
| 220 | + | }) | |
| 221 | + | return _c | |
| 222 | + | } | |
| 223 | + | ||
| 224 | + | func (_c *MockLabelWidget_GetAllocatedWidth_Call) Return(n int) *MockLabelWidget_GetAllocatedWidth_Call { | |
| 225 | + | _c.Call.Return(n) | |
| 226 | + | return _c | |
| 227 | + | } | |
| 228 | + | ||
| 229 | + | func (_c *MockLabelWidget_GetAllocatedWidth_Call) RunAndReturn(run func() int) *MockLabelWidget_GetAllocatedWidth_Call { | |
| 230 | + | _c.Call.Return(run) | |
| 231 | + | return _c | |
| 232 | + | } | |
| 233 | + | ||
| 80 | 234 | // GetHexpand provides a mock function for the type MockLabelWidget | |
| 81 | 235 | func (_mock *MockLabelWidget) GetHexpand() bool { | |
| 82 | 236 | ret := _mock.Called() | |
| @@ -77,6 +77,160 @@ func (_c *MockLabelWidget_AddCssClass_Call) RunAndReturn(run func(cssClass strin | |||||
| 77 | return _c | 77 | return _c | ||
| 78 | } | 78 | } | ||
| 79 | 79 | ||||
| 80 | + | // ComputePoint provides a mock function for the type MockLabelWidget | |||
| 81 | + | func (_mock *MockLabelWidget) ComputePoint(target layout.Widget) (float64, float64, bool) { | |||
| 82 | + | ret := _mock.Called(target) | |||
| 83 | + | ||||
| 84 | + | if len(ret) == 0 { | |||
| 85 | + | panic("no return value specified for ComputePoint") | |||
| 86 | + | } | |||
| 87 | + | ||||
| 88 | + | var r0 float64 | |||
| 89 | + | var r1 float64 | |||
| 90 | + | var r2 bool | |||
| 91 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) (float64, float64, bool)); ok { | |||
| 92 | + | return returnFunc(target) | |||
| 93 | + | } | |||
| 94 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) float64); ok { | |||
| 95 | + | r0 = returnFunc(target) | |||
| 96 | + | } else { | |||
| 97 | + | r0 = ret.Get(0).(float64) | |||
| 98 | + | } | |||
| 99 | + | if returnFunc, ok := ret.Get(1).(func(layout.Widget) float64); ok { | |||
| 100 | + | r1 = returnFunc(target) | |||
| 101 | + | } else { | |||
| 102 | + | r1 = ret.Get(1).(float64) | |||
| 103 | + | } | |||
| 104 | + | if returnFunc, ok := ret.Get(2).(func(layout.Widget) bool); ok { | |||
| 105 | + | r2 = returnFunc(target) | |||
| 106 | + | } else { | |||
| 107 | + | r2 = ret.Get(2).(bool) | |||
| 108 | + | } | |||
| 109 | + | return r0, r1, r2 | |||
| 110 | + | } | |||
| 111 | + | ||||
| 112 | + | // MockLabelWidget_ComputePoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputePoint' | |||
| 113 | + | type MockLabelWidget_ComputePoint_Call struct { | |||
| 114 | + | *mock.Call | |||
| 115 | + | } | |||
| 116 | + | ||||
| 117 | + | // ComputePoint is a helper method to define mock.On call | |||
| 118 | + | // - target layout.Widget | |||
| 119 | + | func (_e *MockLabelWidget_Expecter) ComputePoint(target interface{}) *MockLabelWidget_ComputePoint_Call { | |||
| 120 | + | return &MockLabelWidget_ComputePoint_Call{Call: _e.mock.On("ComputePoint", target)} | |||
| 121 | + | } | |||
| 122 | + | ||||
| 123 | + | func (_c *MockLabelWidget_ComputePoint_Call) Run(run func(target layout.Widget)) *MockLabelWidget_ComputePoint_Call { | |||
| 124 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 125 | + | var arg0 layout.Widget | |||
| 126 | + | if args[0] != nil { | |||
| 127 | + | arg0 = args[0].(layout.Widget) | |||
| 128 | + | } | |||
| 129 | + | run( | |||
| 130 | + | arg0, | |||
| 131 | + | ) | |||
| 132 | + | }) | |||
| 133 | + | return _c | |||
| 134 | + | } | |||
| 135 | + | ||||
| 136 | + | func (_c *MockLabelWidget_ComputePoint_Call) Return(x float64, y float64, ok bool) *MockLabelWidget_ComputePoint_Call { | |||
| 137 | + | _c.Call.Return(x, y, ok) | |||
| 138 | + | return _c | |||
| 139 | + | } | |||
| 140 | + | ||||
| 141 | + | func (_c *MockLabelWidget_ComputePoint_Call) RunAndReturn(run func(target layout.Widget) (float64, float64, bool)) *MockLabelWidget_ComputePoint_Call { | |||
| 142 | + | _c.Call.Return(run) | |||
| 143 | + | return _c | |||
| 144 | + | } | |||
| 145 | + | ||||
| 146 | + | // GetAllocatedHeight provides a mock function for the type MockLabelWidget | |||
| 147 | + | func (_mock *MockLabelWidget) GetAllocatedHeight() int { | |||
| 148 | + | ret := _mock.Called() | |||
| 149 | + | ||||
| 150 | + | if len(ret) == 0 { | |||
| 151 | + | panic("no return value specified for GetAllocatedHeight") | |||
| 152 | + | } | |||
| 153 | + | ||||
| 154 | + | var r0 int | |||
| 155 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |||
| 156 | + | r0 = returnFunc() | |||
| 157 | + | } else { | |||
| 158 | + | r0 = ret.Get(0).(int) | |||
| 159 | + | } | |||
| 160 | + | return r0 | |||
| 161 | + | } | |||
| 162 | + | ||||
| 163 | + | // MockLabelWidget_GetAllocatedHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedHeight' | |||
| 164 | + | type MockLabelWidget_GetAllocatedHeight_Call struct { | |||
| 165 | + | *mock.Call | |||
| 166 | + | } | |||
| 167 | + | ||||
| 168 | + | // GetAllocatedHeight is a helper method to define mock.On call | |||
| 169 | + | func (_e *MockLabelWidget_Expecter) GetAllocatedHeight() *MockLabelWidget_GetAllocatedHeight_Call { | |||
| 170 | + | return &MockLabelWidget_GetAllocatedHeight_Call{Call: _e.mock.On("GetAllocatedHeight")} | |||
| 171 | + | } | |||
| 172 | + | ||||
| 173 | + | func (_c *MockLabelWidget_GetAllocatedHeight_Call) Run(run func()) *MockLabelWidget_GetAllocatedHeight_Call { | |||
| 174 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 175 | + | run() | |||
| 176 | + | }) | |||
| 177 | + | return _c | |||
| 178 | + | } | |||
| 179 | + | ||||
| 180 | + | func (_c *MockLabelWidget_GetAllocatedHeight_Call) Return(n int) *MockLabelWidget_GetAllocatedHeight_Call { | |||
| 181 | + | _c.Call.Return(n) | |||
| 182 | + | return _c | |||
| 183 | + | } | |||
| 184 | + | ||||
| 185 | + | func (_c *MockLabelWidget_GetAllocatedHeight_Call) RunAndReturn(run func() int) *MockLabelWidget_GetAllocatedHeight_Call { | |||
| 186 | + | _c.Call.Return(run) | |||
| 187 | + | return _c | |||
| 188 | + | } | |||
| 189 | + | ||||
| 190 | + | // GetAllocatedWidth provides a mock function for the type MockLabelWidget | |||
| 191 | + | func (_mock *MockLabelWidget) GetAllocatedWidth() int { | |||
| 192 | + | ret := _mock.Called() | |||
| 193 | + | ||||
| 194 | + | if len(ret) == 0 { | |||
| 195 | + | panic("no return value specified for GetAllocatedWidth") | |||
| 196 | + | } | |||
| 197 | + | ||||
| 198 | + | var r0 int | |||
| 199 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |||
| 200 | + | r0 = returnFunc() | |||
| 201 | + | } else { | |||
| 202 | + | r0 = ret.Get(0).(int) | |||
| 203 | + | } | |||
| 204 | + | return r0 | |||
| 205 | + | } | |||
| 206 | + | ||||
| 207 | + | // MockLabelWidget_GetAllocatedWidth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedWidth' | |||
| 208 | + | type MockLabelWidget_GetAllocatedWidth_Call struct { | |||
| 209 | + | *mock.Call | |||
| 210 | + | } | |||
| 211 | + | ||||
| 212 | + | // GetAllocatedWidth is a helper method to define mock.On call | |||
| 213 | + | func (_e *MockLabelWidget_Expecter) GetAllocatedWidth() *MockLabelWidget_GetAllocatedWidth_Call { | |||
| 214 | + | return &MockLabelWidget_GetAllocatedWidth_Call{Call: _e.mock.On("GetAllocatedWidth")} | |||
| 215 | + | } | |||
| 216 | + | ||||
| 217 | + | func (_c *MockLabelWidget_GetAllocatedWidth_Call) Run(run func()) *MockLabelWidget_GetAllocatedWidth_Call { | |||
| 218 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 219 | + | run() | |||
| 220 | + | }) | |||
| 221 | + | return _c | |||
| 222 | + | } | |||
| 223 | + | ||||
| 224 | + | func (_c *MockLabelWidget_GetAllocatedWidth_Call) Return(n int) *MockLabelWidget_GetAllocatedWidth_Call { | |||
| 225 | + | _c.Call.Return(n) | |||
| 226 | + | return _c | |||
| 227 | + | } | |||
| 228 | + | ||||
| 229 | + | func (_c *MockLabelWidget_GetAllocatedWidth_Call) RunAndReturn(run func() int) *MockLabelWidget_GetAllocatedWidth_Call { | |||
| 230 | + | _c.Call.Return(run) | |||
| 231 | + | return _c | |||
| 232 | + | } | |||
| 233 | + | ||||
| 80 | // GetHexpand provides a mock function for the type MockLabelWidget | 234 | // GetHexpand provides a mock function for the type MockLabelWidget | ||
| 81 | func (_mock *MockLabelWidget) GetHexpand() bool { | 235 | func (_mock *MockLabelWidget) GetHexpand() bool { | ||
| 82 | ret := _mock.Called() | 236 | ret := _mock.Called() | ||
M internal/ui/layout/mocks/mock_overlay_widget.go +154 -0
| @@ -117,6 +117,160 @@ func (_c *MockOverlayWidget_AddOverlay_Call) RunAndReturn(run func(overlay layou | |||
| 117 | 117 | return _c | |
| 118 | 118 | } | |
| 119 | 119 | ||
| 120 | + | // ComputePoint provides a mock function for the type MockOverlayWidget | |
| 121 | + | func (_mock *MockOverlayWidget) ComputePoint(target layout.Widget) (float64, float64, bool) { | |
| 122 | + | ret := _mock.Called(target) | |
| 123 | + | ||
| 124 | + | if len(ret) == 0 { | |
| 125 | + | panic("no return value specified for ComputePoint") | |
| 126 | + | } | |
| 127 | + | ||
| 128 | + | var r0 float64 | |
| 129 | + | var r1 float64 | |
| 130 | + | var r2 bool | |
| 131 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) (float64, float64, bool)); ok { | |
| 132 | + | return returnFunc(target) | |
| 133 | + | } | |
| 134 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) float64); ok { | |
| 135 | + | r0 = returnFunc(target) | |
| 136 | + | } else { | |
| 137 | + | r0 = ret.Get(0).(float64) | |
| 138 | + | } | |
| 139 | + | if returnFunc, ok := ret.Get(1).(func(layout.Widget) float64); ok { | |
| 140 | + | r1 = returnFunc(target) | |
| 141 | + | } else { | |
| 142 | + | r1 = ret.Get(1).(float64) | |
| 143 | + | } | |
| 144 | + | if returnFunc, ok := ret.Get(2).(func(layout.Widget) bool); ok { | |
| 145 | + | r2 = returnFunc(target) | |
| 146 | + | } else { | |
| 147 | + | r2 = ret.Get(2).(bool) | |
| 148 | + | } | |
| 149 | + | return r0, r1, r2 | |
| 150 | + | } | |
| 151 | + | ||
| 152 | + | // MockOverlayWidget_ComputePoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputePoint' | |
| 153 | + | type MockOverlayWidget_ComputePoint_Call struct { | |
| 154 | + | *mock.Call | |
| 155 | + | } | |
| 156 | + | ||
| 157 | + | // ComputePoint is a helper method to define mock.On call | |
| 158 | + | // - target layout.Widget | |
| 159 | + | func (_e *MockOverlayWidget_Expecter) ComputePoint(target interface{}) *MockOverlayWidget_ComputePoint_Call { | |
| 160 | + | return &MockOverlayWidget_ComputePoint_Call{Call: _e.mock.On("ComputePoint", target)} | |
| 161 | + | } | |
| 162 | + | ||
| 163 | + | func (_c *MockOverlayWidget_ComputePoint_Call) Run(run func(target layout.Widget)) *MockOverlayWidget_ComputePoint_Call { | |
| 164 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 165 | + | var arg0 layout.Widget | |
| 166 | + | if args[0] != nil { | |
| 167 | + | arg0 = args[0].(layout.Widget) | |
| 168 | + | } | |
| 169 | + | run( | |
| 170 | + | arg0, | |
| 171 | + | ) | |
| 172 | + | }) | |
| 173 | + | return _c | |
| 174 | + | } | |
| 175 | + | ||
| 176 | + | func (_c *MockOverlayWidget_ComputePoint_Call) Return(x float64, y float64, ok bool) *MockOverlayWidget_ComputePoint_Call { | |
| 177 | + | _c.Call.Return(x, y, ok) | |
| 178 | + | return _c | |
| 179 | + | } | |
| 180 | + | ||
| 181 | + | func (_c *MockOverlayWidget_ComputePoint_Call) RunAndReturn(run func(target layout.Widget) (float64, float64, bool)) *MockOverlayWidget_ComputePoint_Call { | |
| 182 | + | _c.Call.Return(run) | |
| 183 | + | return _c | |
| 184 | + | } | |
| 185 | + | ||
| 186 | + | // GetAllocatedHeight provides a mock function for the type MockOverlayWidget | |
| 187 | + | func (_mock *MockOverlayWidget) GetAllocatedHeight() int { | |
| 188 | + | ret := _mock.Called() | |
| 189 | + | ||
| 190 | + | if len(ret) == 0 { | |
| 191 | + | panic("no return value specified for GetAllocatedHeight") | |
| 192 | + | } | |
| 193 | + | ||
| 194 | + | var r0 int | |
| 195 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |
| 196 | + | r0 = returnFunc() | |
| 197 | + | } else { | |
| 198 | + | r0 = ret.Get(0).(int) | |
| 199 | + | } | |
| 200 | + | return r0 | |
| 201 | + | } | |
| 202 | + | ||
| 203 | + | // MockOverlayWidget_GetAllocatedHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedHeight' | |
| 204 | + | type MockOverlayWidget_GetAllocatedHeight_Call struct { | |
| 205 | + | *mock.Call | |
| 206 | + | } | |
| 207 | + | ||
| 208 | + | // GetAllocatedHeight is a helper method to define mock.On call | |
| 209 | + | func (_e *MockOverlayWidget_Expecter) GetAllocatedHeight() *MockOverlayWidget_GetAllocatedHeight_Call { | |
| 210 | + | return &MockOverlayWidget_GetAllocatedHeight_Call{Call: _e.mock.On("GetAllocatedHeight")} | |
| 211 | + | } | |
| 212 | + | ||
| 213 | + | func (_c *MockOverlayWidget_GetAllocatedHeight_Call) Run(run func()) *MockOverlayWidget_GetAllocatedHeight_Call { | |
| 214 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 215 | + | run() | |
| 216 | + | }) | |
| 217 | + | return _c | |
| 218 | + | } | |
| 219 | + | ||
| 220 | + | func (_c *MockOverlayWidget_GetAllocatedHeight_Call) Return(n int) *MockOverlayWidget_GetAllocatedHeight_Call { | |
| 221 | + | _c.Call.Return(n) | |
| 222 | + | return _c | |
| 223 | + | } | |
| 224 | + | ||
| 225 | + | func (_c *MockOverlayWidget_GetAllocatedHeight_Call) RunAndReturn(run func() int) *MockOverlayWidget_GetAllocatedHeight_Call { | |
| 226 | + | _c.Call.Return(run) | |
| 227 | + | return _c | |
| 228 | + | } | |
| 229 | + | ||
| 230 | + | // GetAllocatedWidth provides a mock function for the type MockOverlayWidget | |
| 231 | + | func (_mock *MockOverlayWidget) GetAllocatedWidth() int { | |
| 232 | + | ret := _mock.Called() | |
| 233 | + | ||
| 234 | + | if len(ret) == 0 { | |
| 235 | + | panic("no return value specified for GetAllocatedWidth") | |
| 236 | + | } | |
| 237 | + | ||
| 238 | + | var r0 int | |
| 239 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |
| 240 | + | r0 = returnFunc() | |
| 241 | + | } else { | |
| 242 | + | r0 = ret.Get(0).(int) | |
| 243 | + | } | |
| 244 | + | return r0 | |
| 245 | + | } | |
| 246 | + | ||
| 247 | + | // MockOverlayWidget_GetAllocatedWidth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedWidth' | |
| 248 | + | type MockOverlayWidget_GetAllocatedWidth_Call struct { | |
| 249 | + | *mock.Call | |
| 250 | + | } | |
| 251 | + | ||
| 252 | + | // GetAllocatedWidth is a helper method to define mock.On call | |
| 253 | + | func (_e *MockOverlayWidget_Expecter) GetAllocatedWidth() *MockOverlayWidget_GetAllocatedWidth_Call { | |
| 254 | + | return &MockOverlayWidget_GetAllocatedWidth_Call{Call: _e.mock.On("GetAllocatedWidth")} | |
| 255 | + | } | |
| 256 | + | ||
| 257 | + | func (_c *MockOverlayWidget_GetAllocatedWidth_Call) Run(run func()) *MockOverlayWidget_GetAllocatedWidth_Call { | |
| 258 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 259 | + | run() | |
| 260 | + | }) | |
| 261 | + | return _c | |
| 262 | + | } | |
| 263 | + | ||
| 264 | + | func (_c *MockOverlayWidget_GetAllocatedWidth_Call) Return(n int) *MockOverlayWidget_GetAllocatedWidth_Call { | |
| 265 | + | _c.Call.Return(n) | |
| 266 | + | return _c | |
| 267 | + | } | |
| 268 | + | ||
| 269 | + | func (_c *MockOverlayWidget_GetAllocatedWidth_Call) RunAndReturn(run func() int) *MockOverlayWidget_GetAllocatedWidth_Call { | |
| 270 | + | _c.Call.Return(run) | |
| 271 | + | return _c | |
| 272 | + | } | |
| 273 | + | ||
| 120 | 274 | // GetChild provides a mock function for the type MockOverlayWidget | |
| 121 | 275 | func (_mock *MockOverlayWidget) GetChild() layout.Widget { | |
| 122 | 276 | ret := _mock.Called() | |
| @@ -117,6 +117,160 @@ func (_c *MockOverlayWidget_AddOverlay_Call) RunAndReturn(run func(overlay layou | |||||
| 117 | return _c | 117 | return _c | ||
| 118 | } | 118 | } | ||
| 119 | 119 | ||||
| 120 | + | // ComputePoint provides a mock function for the type MockOverlayWidget | |||
| 121 | + | func (_mock *MockOverlayWidget) ComputePoint(target layout.Widget) (float64, float64, bool) { | |||
| 122 | + | ret := _mock.Called(target) | |||
| 123 | + | ||||
| 124 | + | if len(ret) == 0 { | |||
| 125 | + | panic("no return value specified for ComputePoint") | |||
| 126 | + | } | |||
| 127 | + | ||||
| 128 | + | var r0 float64 | |||
| 129 | + | var r1 float64 | |||
| 130 | + | var r2 bool | |||
| 131 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) (float64, float64, bool)); ok { | |||
| 132 | + | return returnFunc(target) | |||
| 133 | + | } | |||
| 134 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) float64); ok { | |||
| 135 | + | r0 = returnFunc(target) | |||
| 136 | + | } else { | |||
| 137 | + | r0 = ret.Get(0).(float64) | |||
| 138 | + | } | |||
| 139 | + | if returnFunc, ok := ret.Get(1).(func(layout.Widget) float64); ok { | |||
| 140 | + | r1 = returnFunc(target) | |||
| 141 | + | } else { | |||
| 142 | + | r1 = ret.Get(1).(float64) | |||
| 143 | + | } | |||
| 144 | + | if returnFunc, ok := ret.Get(2).(func(layout.Widget) bool); ok { | |||
| 145 | + | r2 = returnFunc(target) | |||
| 146 | + | } else { | |||
| 147 | + | r2 = ret.Get(2).(bool) | |||
| 148 | + | } | |||
| 149 | + | return r0, r1, r2 | |||
| 150 | + | } | |||
| 151 | + | ||||
| 152 | + | // MockOverlayWidget_ComputePoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputePoint' | |||
| 153 | + | type MockOverlayWidget_ComputePoint_Call struct { | |||
| 154 | + | *mock.Call | |||
| 155 | + | } | |||
| 156 | + | ||||
| 157 | + | // ComputePoint is a helper method to define mock.On call | |||
| 158 | + | // - target layout.Widget | |||
| 159 | + | func (_e *MockOverlayWidget_Expecter) ComputePoint(target interface{}) *MockOverlayWidget_ComputePoint_Call { | |||
| 160 | + | return &MockOverlayWidget_ComputePoint_Call{Call: _e.mock.On("ComputePoint", target)} | |||
| 161 | + | } | |||
| 162 | + | ||||
| 163 | + | func (_c *MockOverlayWidget_ComputePoint_Call) Run(run func(target layout.Widget)) *MockOverlayWidget_ComputePoint_Call { | |||
| 164 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 165 | + | var arg0 layout.Widget | |||
| 166 | + | if args[0] != nil { | |||
| 167 | + | arg0 = args[0].(layout.Widget) | |||
| 168 | + | } | |||
| 169 | + | run( | |||
| 170 | + | arg0, | |||
| 171 | + | ) | |||
| 172 | + | }) | |||
| 173 | + | return _c | |||
| 174 | + | } | |||
| 175 | + | ||||
| 176 | + | func (_c *MockOverlayWidget_ComputePoint_Call) Return(x float64, y float64, ok bool) *MockOverlayWidget_ComputePoint_Call { | |||
| 177 | + | _c.Call.Return(x, y, ok) | |||
| 178 | + | return _c | |||
| 179 | + | } | |||
| 180 | + | ||||
| 181 | + | func (_c *MockOverlayWidget_ComputePoint_Call) RunAndReturn(run func(target layout.Widget) (float64, float64, bool)) *MockOverlayWidget_ComputePoint_Call { | |||
| 182 | + | _c.Call.Return(run) | |||
| 183 | + | return _c | |||
| 184 | + | } | |||
| 185 | + | ||||
| 186 | + | // GetAllocatedHeight provides a mock function for the type MockOverlayWidget | |||
| 187 | + | func (_mock *MockOverlayWidget) GetAllocatedHeight() int { | |||
| 188 | + | ret := _mock.Called() | |||
| 189 | + | ||||
| 190 | + | if len(ret) == 0 { | |||
| 191 | + | panic("no return value specified for GetAllocatedHeight") | |||
| 192 | + | } | |||
| 193 | + | ||||
| 194 | + | var r0 int | |||
| 195 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |||
| 196 | + | r0 = returnFunc() | |||
| 197 | + | } else { | |||
| 198 | + | r0 = ret.Get(0).(int) | |||
| 199 | + | } | |||
| 200 | + | return r0 | |||
| 201 | + | } | |||
| 202 | + | ||||
| 203 | + | // MockOverlayWidget_GetAllocatedHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedHeight' | |||
| 204 | + | type MockOverlayWidget_GetAllocatedHeight_Call struct { | |||
| 205 | + | *mock.Call | |||
| 206 | + | } | |||
| 207 | + | ||||
| 208 | + | // GetAllocatedHeight is a helper method to define mock.On call | |||
| 209 | + | func (_e *MockOverlayWidget_Expecter) GetAllocatedHeight() *MockOverlayWidget_GetAllocatedHeight_Call { | |||
| 210 | + | return &MockOverlayWidget_GetAllocatedHeight_Call{Call: _e.mock.On("GetAllocatedHeight")} | |||
| 211 | + | } | |||
| 212 | + | ||||
| 213 | + | func (_c *MockOverlayWidget_GetAllocatedHeight_Call) Run(run func()) *MockOverlayWidget_GetAllocatedHeight_Call { | |||
| 214 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 215 | + | run() | |||
| 216 | + | }) | |||
| 217 | + | return _c | |||
| 218 | + | } | |||
| 219 | + | ||||
| 220 | + | func (_c *MockOverlayWidget_GetAllocatedHeight_Call) Return(n int) *MockOverlayWidget_GetAllocatedHeight_Call { | |||
| 221 | + | _c.Call.Return(n) | |||
| 222 | + | return _c | |||
| 223 | + | } | |||
| 224 | + | ||||
| 225 | + | func (_c *MockOverlayWidget_GetAllocatedHeight_Call) RunAndReturn(run func() int) *MockOverlayWidget_GetAllocatedHeight_Call { | |||
| 226 | + | _c.Call.Return(run) | |||
| 227 | + | return _c | |||
| 228 | + | } | |||
| 229 | + | ||||
| 230 | + | // GetAllocatedWidth provides a mock function for the type MockOverlayWidget | |||
| 231 | + | func (_mock *MockOverlayWidget) GetAllocatedWidth() int { | |||
| 232 | + | ret := _mock.Called() | |||
| 233 | + | ||||
| 234 | + | if len(ret) == 0 { | |||
| 235 | + | panic("no return value specified for GetAllocatedWidth") | |||
| 236 | + | } | |||
| 237 | + | ||||
| 238 | + | var r0 int | |||
| 239 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |||
| 240 | + | r0 = returnFunc() | |||
| 241 | + | } else { | |||
| 242 | + | r0 = ret.Get(0).(int) | |||
| 243 | + | } | |||
| 244 | + | return r0 | |||
| 245 | + | } | |||
| 246 | + | ||||
| 247 | + | // MockOverlayWidget_GetAllocatedWidth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedWidth' | |||
| 248 | + | type MockOverlayWidget_GetAllocatedWidth_Call struct { | |||
| 249 | + | *mock.Call | |||
| 250 | + | } | |||
| 251 | + | ||||
| 252 | + | // GetAllocatedWidth is a helper method to define mock.On call | |||
| 253 | + | func (_e *MockOverlayWidget_Expecter) GetAllocatedWidth() *MockOverlayWidget_GetAllocatedWidth_Call { | |||
| 254 | + | return &MockOverlayWidget_GetAllocatedWidth_Call{Call: _e.mock.On("GetAllocatedWidth")} | |||
| 255 | + | } | |||
| 256 | + | ||||
| 257 | + | func (_c *MockOverlayWidget_GetAllocatedWidth_Call) Run(run func()) *MockOverlayWidget_GetAllocatedWidth_Call { | |||
| 258 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 259 | + | run() | |||
| 260 | + | }) | |||
| 261 | + | return _c | |||
| 262 | + | } | |||
| 263 | + | ||||
| 264 | + | func (_c *MockOverlayWidget_GetAllocatedWidth_Call) Return(n int) *MockOverlayWidget_GetAllocatedWidth_Call { | |||
| 265 | + | _c.Call.Return(n) | |||
| 266 | + | return _c | |||
| 267 | + | } | |||
| 268 | + | ||||
| 269 | + | func (_c *MockOverlayWidget_GetAllocatedWidth_Call) RunAndReturn(run func() int) *MockOverlayWidget_GetAllocatedWidth_Call { | |||
| 270 | + | _c.Call.Return(run) | |||
| 271 | + | return _c | |||
| 272 | + | } | |||
| 273 | + | ||||
| 120 | // GetChild provides a mock function for the type MockOverlayWidget | 274 | // GetChild provides a mock function for the type MockOverlayWidget | ||
| 121 | func (_mock *MockOverlayWidget) GetChild() layout.Widget { | 275 | func (_mock *MockOverlayWidget) GetChild() layout.Widget { | ||
| 122 | ret := _mock.Called() | 276 | ret := _mock.Called() | ||
M internal/ui/layout/mocks/mock_paned_widget.go +66 -0
| @@ -128,6 +128,72 @@ func (_c *MockPanedWidget_AddTickCallback_Call) RunAndReturn(run func(callback f | |||
| 128 | 128 | return _c | |
| 129 | 129 | } | |
| 130 | 130 | ||
| 131 | + | // ComputePoint provides a mock function for the type MockPanedWidget | |
| 132 | + | func (_mock *MockPanedWidget) ComputePoint(target layout.Widget) (float64, float64, bool) { | |
| 133 | + | ret := _mock.Called(target) | |
| 134 | + | ||
| 135 | + | if len(ret) == 0 { | |
| 136 | + | panic("no return value specified for ComputePoint") | |
| 137 | + | } | |
| 138 | + | ||
| 139 | + | var r0 float64 | |
| 140 | + | var r1 float64 | |
| 141 | + | var r2 bool | |
| 142 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) (float64, float64, bool)); ok { | |
| 143 | + | return returnFunc(target) | |
| 144 | + | } | |
| 145 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) float64); ok { | |
| 146 | + | r0 = returnFunc(target) | |
| 147 | + | } else { | |
| 148 | + | r0 = ret.Get(0).(float64) | |
| 149 | + | } | |
| 150 | + | if returnFunc, ok := ret.Get(1).(func(layout.Widget) float64); ok { | |
| 151 | + | r1 = returnFunc(target) | |
| 152 | + | } else { | |
| 153 | + | r1 = ret.Get(1).(float64) | |
| 154 | + | } | |
| 155 | + | if returnFunc, ok := ret.Get(2).(func(layout.Widget) bool); ok { | |
| 156 | + | r2 = returnFunc(target) | |
| 157 | + | } else { | |
| 158 | + | r2 = ret.Get(2).(bool) | |
| 159 | + | } | |
| 160 | + | return r0, r1, r2 | |
| 161 | + | } | |
| 162 | + | ||
| 163 | + | // MockPanedWidget_ComputePoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputePoint' | |
| 164 | + | type MockPanedWidget_ComputePoint_Call struct { | |
| 165 | + | *mock.Call | |
| 166 | + | } | |
| 167 | + | ||
| 168 | + | // ComputePoint is a helper method to define mock.On call | |
| 169 | + | // - target layout.Widget | |
| 170 | + | func (_e *MockPanedWidget_Expecter) ComputePoint(target interface{}) *MockPanedWidget_ComputePoint_Call { | |
| 171 | + | return &MockPanedWidget_ComputePoint_Call{Call: _e.mock.On("ComputePoint", target)} | |
| 172 | + | } | |
| 173 | + | ||
| 174 | + | func (_c *MockPanedWidget_ComputePoint_Call) Run(run func(target layout.Widget)) *MockPanedWidget_ComputePoint_Call { | |
| 175 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 176 | + | var arg0 layout.Widget | |
| 177 | + | if args[0] != nil { | |
| 178 | + | arg0 = args[0].(layout.Widget) | |
| 179 | + | } | |
| 180 | + | run( | |
| 181 | + | arg0, | |
| 182 | + | ) | |
| 183 | + | }) | |
| 184 | + | return _c | |
| 185 | + | } | |
| 186 | + | ||
| 187 | + | func (_c *MockPanedWidget_ComputePoint_Call) Return(x float64, y float64, ok bool) *MockPanedWidget_ComputePoint_Call { | |
| 188 | + | _c.Call.Return(x, y, ok) | |
| 189 | + | return _c | |
| 190 | + | } | |
| 191 | + | ||
| 192 | + | func (_c *MockPanedWidget_ComputePoint_Call) RunAndReturn(run func(target layout.Widget) (float64, float64, bool)) *MockPanedWidget_ComputePoint_Call { | |
| 193 | + | _c.Call.Return(run) | |
| 194 | + | return _c | |
| 195 | + | } | |
| 196 | + | ||
| 131 | 197 | // ConnectMap provides a mock function for the type MockPanedWidget | |
| 132 | 198 | func (_mock *MockPanedWidget) ConnectMap(callback func()) uint32 { | |
| 133 | 199 | ret := _mock.Called(callback) | |
| @@ -128,6 +128,72 @@ func (_c *MockPanedWidget_AddTickCallback_Call) RunAndReturn(run func(callback f | |||||
| 128 | return _c | 128 | return _c | ||
| 129 | } | 129 | } | ||
| 130 | 130 | ||||
| 131 | + | // ComputePoint provides a mock function for the type MockPanedWidget | |||
| 132 | + | func (_mock *MockPanedWidget) ComputePoint(target layout.Widget) (float64, float64, bool) { | |||
| 133 | + | ret := _mock.Called(target) | |||
| 134 | + | ||||
| 135 | + | if len(ret) == 0 { | |||
| 136 | + | panic("no return value specified for ComputePoint") | |||
| 137 | + | } | |||
| 138 | + | ||||
| 139 | + | var r0 float64 | |||
| 140 | + | var r1 float64 | |||
| 141 | + | var r2 bool | |||
| 142 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) (float64, float64, bool)); ok { | |||
| 143 | + | return returnFunc(target) | |||
| 144 | + | } | |||
| 145 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) float64); ok { | |||
| 146 | + | r0 = returnFunc(target) | |||
| 147 | + | } else { | |||
| 148 | + | r0 = ret.Get(0).(float64) | |||
| 149 | + | } | |||
| 150 | + | if returnFunc, ok := ret.Get(1).(func(layout.Widget) float64); ok { | |||
| 151 | + | r1 = returnFunc(target) | |||
| 152 | + | } else { | |||
| 153 | + | r1 = ret.Get(1).(float64) | |||
| 154 | + | } | |||
| 155 | + | if returnFunc, ok := ret.Get(2).(func(layout.Widget) bool); ok { | |||
| 156 | + | r2 = returnFunc(target) | |||
| 157 | + | } else { | |||
| 158 | + | r2 = ret.Get(2).(bool) | |||
| 159 | + | } | |||
| 160 | + | return r0, r1, r2 | |||
| 161 | + | } | |||
| 162 | + | ||||
| 163 | + | // MockPanedWidget_ComputePoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputePoint' | |||
| 164 | + | type MockPanedWidget_ComputePoint_Call struct { | |||
| 165 | + | *mock.Call | |||
| 166 | + | } | |||
| 167 | + | ||||
| 168 | + | // ComputePoint is a helper method to define mock.On call | |||
| 169 | + | // - target layout.Widget | |||
| 170 | + | func (_e *MockPanedWidget_Expecter) ComputePoint(target interface{}) *MockPanedWidget_ComputePoint_Call { | |||
| 171 | + | return &MockPanedWidget_ComputePoint_Call{Call: _e.mock.On("ComputePoint", target)} | |||
| 172 | + | } | |||
| 173 | + | ||||
| 174 | + | func (_c *MockPanedWidget_ComputePoint_Call) Run(run func(target layout.Widget)) *MockPanedWidget_ComputePoint_Call { | |||
| 175 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 176 | + | var arg0 layout.Widget | |||
| 177 | + | if args[0] != nil { | |||
| 178 | + | arg0 = args[0].(layout.Widget) | |||
| 179 | + | } | |||
| 180 | + | run( | |||
| 181 | + | arg0, | |||
| 182 | + | ) | |||
| 183 | + | }) | |||
| 184 | + | return _c | |||
| 185 | + | } | |||
| 186 | + | ||||
| 187 | + | func (_c *MockPanedWidget_ComputePoint_Call) Return(x float64, y float64, ok bool) *MockPanedWidget_ComputePoint_Call { | |||
| 188 | + | _c.Call.Return(x, y, ok) | |||
| 189 | + | return _c | |||
| 190 | + | } | |||
| 191 | + | ||||
| 192 | + | func (_c *MockPanedWidget_ComputePoint_Call) RunAndReturn(run func(target layout.Widget) (float64, float64, bool)) *MockPanedWidget_ComputePoint_Call { | |||
| 193 | + | _c.Call.Return(run) | |||
| 194 | + | return _c | |||
| 195 | + | } | |||
| 196 | + | ||||
| 131 | // ConnectMap provides a mock function for the type MockPanedWidget | 197 | // ConnectMap provides a mock function for the type MockPanedWidget | ||
| 132 | func (_mock *MockPanedWidget) ConnectMap(callback func()) uint32 { | 198 | func (_mock *MockPanedWidget) ConnectMap(callback func()) uint32 { | ||
| 133 | ret := _mock.Called(callback) | 199 | ret := _mock.Called(callback) | ||
M internal/ui/layout/mocks/mock_widget.go +154 -0
| @@ -77,6 +77,160 @@ func (_c *MockWidget_AddCssClass_Call) RunAndReturn(run func(cssClass string)) * | |||
| 77 | 77 | return _c | |
| 78 | 78 | } | |
| 79 | 79 | ||
| 80 | + | // ComputePoint provides a mock function for the type MockWidget | |
| 81 | + | func (_mock *MockWidget) ComputePoint(target layout.Widget) (float64, float64, bool) { | |
| 82 | + | ret := _mock.Called(target) | |
| 83 | + | ||
| 84 | + | if len(ret) == 0 { | |
| 85 | + | panic("no return value specified for ComputePoint") | |
| 86 | + | } | |
| 87 | + | ||
| 88 | + | var r0 float64 | |
| 89 | + | var r1 float64 | |
| 90 | + | var r2 bool | |
| 91 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) (float64, float64, bool)); ok { | |
| 92 | + | return returnFunc(target) | |
| 93 | + | } | |
| 94 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) float64); ok { | |
| 95 | + | r0 = returnFunc(target) | |
| 96 | + | } else { | |
| 97 | + | r0 = ret.Get(0).(float64) | |
| 98 | + | } | |
| 99 | + | if returnFunc, ok := ret.Get(1).(func(layout.Widget) float64); ok { | |
| 100 | + | r1 = returnFunc(target) | |
| 101 | + | } else { | |
| 102 | + | r1 = ret.Get(1).(float64) | |
| 103 | + | } | |
| 104 | + | if returnFunc, ok := ret.Get(2).(func(layout.Widget) bool); ok { | |
| 105 | + | r2 = returnFunc(target) | |
| 106 | + | } else { | |
| 107 | + | r2 = ret.Get(2).(bool) | |
| 108 | + | } | |
| 109 | + | return r0, r1, r2 | |
| 110 | + | } | |
| 111 | + | ||
| 112 | + | // MockWidget_ComputePoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputePoint' | |
| 113 | + | type MockWidget_ComputePoint_Call struct { | |
| 114 | + | *mock.Call | |
| 115 | + | } | |
| 116 | + | ||
| 117 | + | // ComputePoint is a helper method to define mock.On call | |
| 118 | + | // - target layout.Widget | |
| 119 | + | func (_e *MockWidget_Expecter) ComputePoint(target interface{}) *MockWidget_ComputePoint_Call { | |
| 120 | + | return &MockWidget_ComputePoint_Call{Call: _e.mock.On("ComputePoint", target)} | |
| 121 | + | } | |
| 122 | + | ||
| 123 | + | func (_c *MockWidget_ComputePoint_Call) Run(run func(target layout.Widget)) *MockWidget_ComputePoint_Call { | |
| 124 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 125 | + | var arg0 layout.Widget | |
| 126 | + | if args[0] != nil { | |
| 127 | + | arg0 = args[0].(layout.Widget) | |
| 128 | + | } | |
| 129 | + | run( | |
| 130 | + | arg0, | |
| 131 | + | ) | |
| 132 | + | }) | |
| 133 | + | return _c | |
| 134 | + | } | |
| 135 | + | ||
| 136 | + | func (_c *MockWidget_ComputePoint_Call) Return(x float64, y float64, ok bool) *MockWidget_ComputePoint_Call { | |
| 137 | + | _c.Call.Return(x, y, ok) | |
| 138 | + | return _c | |
| 139 | + | } | |
| 140 | + | ||
| 141 | + | func (_c *MockWidget_ComputePoint_Call) RunAndReturn(run func(target layout.Widget) (float64, float64, bool)) *MockWidget_ComputePoint_Call { | |
| 142 | + | _c.Call.Return(run) | |
| 143 | + | return _c | |
| 144 | + | } | |
| 145 | + | ||
| 146 | + | // GetAllocatedHeight provides a mock function for the type MockWidget | |
| 147 | + | func (_mock *MockWidget) GetAllocatedHeight() int { | |
| 148 | + | ret := _mock.Called() | |
| 149 | + | ||
| 150 | + | if len(ret) == 0 { | |
| 151 | + | panic("no return value specified for GetAllocatedHeight") | |
| 152 | + | } | |
| 153 | + | ||
| 154 | + | var r0 int | |
| 155 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |
| 156 | + | r0 = returnFunc() | |
| 157 | + | } else { | |
| 158 | + | r0 = ret.Get(0).(int) | |
| 159 | + | } | |
| 160 | + | return r0 | |
| 161 | + | } | |
| 162 | + | ||
| 163 | + | // MockWidget_GetAllocatedHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedHeight' | |
| 164 | + | type MockWidget_GetAllocatedHeight_Call struct { | |
| 165 | + | *mock.Call | |
| 166 | + | } | |
| 167 | + | ||
| 168 | + | // GetAllocatedHeight is a helper method to define mock.On call | |
| 169 | + | func (_e *MockWidget_Expecter) GetAllocatedHeight() *MockWidget_GetAllocatedHeight_Call { | |
| 170 | + | return &MockWidget_GetAllocatedHeight_Call{Call: _e.mock.On("GetAllocatedHeight")} | |
| 171 | + | } | |
| 172 | + | ||
| 173 | + | func (_c *MockWidget_GetAllocatedHeight_Call) Run(run func()) *MockWidget_GetAllocatedHeight_Call { | |
| 174 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 175 | + | run() | |
| 176 | + | }) | |
| 177 | + | return _c | |
| 178 | + | } | |
| 179 | + | ||
| 180 | + | func (_c *MockWidget_GetAllocatedHeight_Call) Return(n int) *MockWidget_GetAllocatedHeight_Call { | |
| 181 | + | _c.Call.Return(n) | |
| 182 | + | return _c | |
| 183 | + | } | |
| 184 | + | ||
| 185 | + | func (_c *MockWidget_GetAllocatedHeight_Call) RunAndReturn(run func() int) *MockWidget_GetAllocatedHeight_Call { | |
| 186 | + | _c.Call.Return(run) | |
| 187 | + | return _c | |
| 188 | + | } | |
| 189 | + | ||
| 190 | + | // GetAllocatedWidth provides a mock function for the type MockWidget | |
| 191 | + | func (_mock *MockWidget) GetAllocatedWidth() int { | |
| 192 | + | ret := _mock.Called() | |
| 193 | + | ||
| 194 | + | if len(ret) == 0 { | |
| 195 | + | panic("no return value specified for GetAllocatedWidth") | |
| 196 | + | } | |
| 197 | + | ||
| 198 | + | var r0 int | |
| 199 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |
| 200 | + | r0 = returnFunc() | |
| 201 | + | } else { | |
| 202 | + | r0 = ret.Get(0).(int) | |
| 203 | + | } | |
| 204 | + | return r0 | |
| 205 | + | } | |
| 206 | + | ||
| 207 | + | // MockWidget_GetAllocatedWidth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedWidth' | |
| 208 | + | type MockWidget_GetAllocatedWidth_Call struct { | |
| 209 | + | *mock.Call | |
| 210 | + | } | |
| 211 | + | ||
| 212 | + | // GetAllocatedWidth is a helper method to define mock.On call | |
| 213 | + | func (_e *MockWidget_Expecter) GetAllocatedWidth() *MockWidget_GetAllocatedWidth_Call { | |
| 214 | + | return &MockWidget_GetAllocatedWidth_Call{Call: _e.mock.On("GetAllocatedWidth")} | |
| 215 | + | } | |
| 216 | + | ||
| 217 | + | func (_c *MockWidget_GetAllocatedWidth_Call) Run(run func()) *MockWidget_GetAllocatedWidth_Call { | |
| 218 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 219 | + | run() | |
| 220 | + | }) | |
| 221 | + | return _c | |
| 222 | + | } | |
| 223 | + | ||
| 224 | + | func (_c *MockWidget_GetAllocatedWidth_Call) Return(n int) *MockWidget_GetAllocatedWidth_Call { | |
| 225 | + | _c.Call.Return(n) | |
| 226 | + | return _c | |
| 227 | + | } | |
| 228 | + | ||
| 229 | + | func (_c *MockWidget_GetAllocatedWidth_Call) RunAndReturn(run func() int) *MockWidget_GetAllocatedWidth_Call { | |
| 230 | + | _c.Call.Return(run) | |
| 231 | + | return _c | |
| 232 | + | } | |
| 233 | + | ||
| 80 | 234 | // GetHexpand provides a mock function for the type MockWidget | |
| 81 | 235 | func (_mock *MockWidget) GetHexpand() bool { | |
| 82 | 236 | ret := _mock.Called() | |
| @@ -77,6 +77,160 @@ func (_c *MockWidget_AddCssClass_Call) RunAndReturn(run func(cssClass string)) * | |||||
| 77 | return _c | 77 | return _c | ||
| 78 | } | 78 | } | ||
| 79 | 79 | ||||
| 80 | + | // ComputePoint provides a mock function for the type MockWidget | |||
| 81 | + | func (_mock *MockWidget) ComputePoint(target layout.Widget) (float64, float64, bool) { | |||
| 82 | + | ret := _mock.Called(target) | |||
| 83 | + | ||||
| 84 | + | if len(ret) == 0 { | |||
| 85 | + | panic("no return value specified for ComputePoint") | |||
| 86 | + | } | |||
| 87 | + | ||||
| 88 | + | var r0 float64 | |||
| 89 | + | var r1 float64 | |||
| 90 | + | var r2 bool | |||
| 91 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) (float64, float64, bool)); ok { | |||
| 92 | + | return returnFunc(target) | |||
| 93 | + | } | |||
| 94 | + | if returnFunc, ok := ret.Get(0).(func(layout.Widget) float64); ok { | |||
| 95 | + | r0 = returnFunc(target) | |||
| 96 | + | } else { | |||
| 97 | + | r0 = ret.Get(0).(float64) | |||
| 98 | + | } | |||
| 99 | + | if returnFunc, ok := ret.Get(1).(func(layout.Widget) float64); ok { | |||
| 100 | + | r1 = returnFunc(target) | |||
| 101 | + | } else { | |||
| 102 | + | r1 = ret.Get(1).(float64) | |||
| 103 | + | } | |||
| 104 | + | if returnFunc, ok := ret.Get(2).(func(layout.Widget) bool); ok { | |||
| 105 | + | r2 = returnFunc(target) | |||
| 106 | + | } else { | |||
| 107 | + | r2 = ret.Get(2).(bool) | |||
| 108 | + | } | |||
| 109 | + | return r0, r1, r2 | |||
| 110 | + | } | |||
| 111 | + | ||||
| 112 | + | // MockWidget_ComputePoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComputePoint' | |||
| 113 | + | type MockWidget_ComputePoint_Call struct { | |||
| 114 | + | *mock.Call | |||
| 115 | + | } | |||
| 116 | + | ||||
| 117 | + | // ComputePoint is a helper method to define mock.On call | |||
| 118 | + | // - target layout.Widget | |||
| 119 | + | func (_e *MockWidget_Expecter) ComputePoint(target interface{}) *MockWidget_ComputePoint_Call { | |||
| 120 | + | return &MockWidget_ComputePoint_Call{Call: _e.mock.On("ComputePoint", target)} | |||
| 121 | + | } | |||
| 122 | + | ||||
| 123 | + | func (_c *MockWidget_ComputePoint_Call) Run(run func(target layout.Widget)) *MockWidget_ComputePoint_Call { | |||
| 124 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 125 | + | var arg0 layout.Widget | |||
| 126 | + | if args[0] != nil { | |||
| 127 | + | arg0 = args[0].(layout.Widget) | |||
| 128 | + | } | |||
| 129 | + | run( | |||
| 130 | + | arg0, | |||
| 131 | + | ) | |||
| 132 | + | }) | |||
| 133 | + | return _c | |||
| 134 | + | } | |||
| 135 | + | ||||
| 136 | + | func (_c *MockWidget_ComputePoint_Call) Return(x float64, y float64, ok bool) *MockWidget_ComputePoint_Call { | |||
| 137 | + | _c.Call.Return(x, y, ok) | |||
| 138 | + | return _c | |||
| 139 | + | } | |||
| 140 | + | ||||
| 141 | + | func (_c *MockWidget_ComputePoint_Call) RunAndReturn(run func(target layout.Widget) (float64, float64, bool)) *MockWidget_ComputePoint_Call { | |||
| 142 | + | _c.Call.Return(run) | |||
| 143 | + | return _c | |||
| 144 | + | } | |||
| 145 | + | ||||
| 146 | + | // GetAllocatedHeight provides a mock function for the type MockWidget | |||
| 147 | + | func (_mock *MockWidget) GetAllocatedHeight() int { | |||
| 148 | + | ret := _mock.Called() | |||
| 149 | + | ||||
| 150 | + | if len(ret) == 0 { | |||
| 151 | + | panic("no return value specified for GetAllocatedHeight") | |||
| 152 | + | } | |||
| 153 | + | ||||
| 154 | + | var r0 int | |||
| 155 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |||
| 156 | + | r0 = returnFunc() | |||
| 157 | + | } else { | |||
| 158 | + | r0 = ret.Get(0).(int) | |||
| 159 | + | } | |||
| 160 | + | return r0 | |||
| 161 | + | } | |||
| 162 | + | ||||
| 163 | + | // MockWidget_GetAllocatedHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedHeight' | |||
| 164 | + | type MockWidget_GetAllocatedHeight_Call struct { | |||
| 165 | + | *mock.Call | |||
| 166 | + | } | |||
| 167 | + | ||||
| 168 | + | // GetAllocatedHeight is a helper method to define mock.On call | |||
| 169 | + | func (_e *MockWidget_Expecter) GetAllocatedHeight() *MockWidget_GetAllocatedHeight_Call { | |||
| 170 | + | return &MockWidget_GetAllocatedHeight_Call{Call: _e.mock.On("GetAllocatedHeight")} | |||
| 171 | + | } | |||
| 172 | + | ||||
| 173 | + | func (_c *MockWidget_GetAllocatedHeight_Call) Run(run func()) *MockWidget_GetAllocatedHeight_Call { | |||
| 174 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 175 | + | run() | |||
| 176 | + | }) | |||
| 177 | + | return _c | |||
| 178 | + | } | |||
| 179 | + | ||||
| 180 | + | func (_c *MockWidget_GetAllocatedHeight_Call) Return(n int) *MockWidget_GetAllocatedHeight_Call { | |||
| 181 | + | _c.Call.Return(n) | |||
| 182 | + | return _c | |||
| 183 | + | } | |||
| 184 | + | ||||
| 185 | + | func (_c *MockWidget_GetAllocatedHeight_Call) RunAndReturn(run func() int) *MockWidget_GetAllocatedHeight_Call { | |||
| 186 | + | _c.Call.Return(run) | |||
| 187 | + | return _c | |||
| 188 | + | } | |||
| 189 | + | ||||
| 190 | + | // GetAllocatedWidth provides a mock function for the type MockWidget | |||
| 191 | + | func (_mock *MockWidget) GetAllocatedWidth() int { | |||
| 192 | + | ret := _mock.Called() | |||
| 193 | + | ||||
| 194 | + | if len(ret) == 0 { | |||
| 195 | + | panic("no return value specified for GetAllocatedWidth") | |||
| 196 | + | } | |||
| 197 | + | ||||
| 198 | + | var r0 int | |||
| 199 | + | if returnFunc, ok := ret.Get(0).(func() int); ok { | |||
| 200 | + | r0 = returnFunc() | |||
| 201 | + | } else { | |||
| 202 | + | r0 = ret.Get(0).(int) | |||
| 203 | + | } | |||
| 204 | + | return r0 | |||
| 205 | + | } | |||
| 206 | + | ||||
| 207 | + | // MockWidget_GetAllocatedWidth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatedWidth' | |||
| 208 | + | type MockWidget_GetAllocatedWidth_Call struct { | |||
| 209 | + | *mock.Call | |||
| 210 | + | } | |||
| 211 | + | ||||
| 212 | + | // GetAllocatedWidth is a helper method to define mock.On call | |||
| 213 | + | func (_e *MockWidget_Expecter) GetAllocatedWidth() *MockWidget_GetAllocatedWidth_Call { | |||
| 214 | + | return &MockWidget_GetAllocatedWidth_Call{Call: _e.mock.On("GetAllocatedWidth")} | |||
| 215 | + | } | |||
| 216 | + | ||||
| 217 | + | func (_c *MockWidget_GetAllocatedWidth_Call) Run(run func()) *MockWidget_GetAllocatedWidth_Call { | |||
| 218 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 219 | + | run() | |||
| 220 | + | }) | |||
| 221 | + | return _c | |||
| 222 | + | } | |||
| 223 | + | ||||
| 224 | + | func (_c *MockWidget_GetAllocatedWidth_Call) Return(n int) *MockWidget_GetAllocatedWidth_Call { | |||
| 225 | + | _c.Call.Return(n) | |||
| 226 | + | return _c | |||
| 227 | + | } | |||
| 228 | + | ||||
| 229 | + | func (_c *MockWidget_GetAllocatedWidth_Call) RunAndReturn(run func() int) *MockWidget_GetAllocatedWidth_Call { | |||
| 230 | + | _c.Call.Return(run) | |||
| 231 | + | return _c | |||
| 232 | + | } | |||
| 233 | + | ||||
| 80 | // GetHexpand provides a mock function for the type MockWidget | 234 | // GetHexpand provides a mock function for the type MockWidget | ||
| 81 | func (_mock *MockWidget) GetHexpand() bool { | 235 | func (_mock *MockWidget) GetHexpand() bool { | ||
| 82 | ret := _mock.Called() | 236 | ret := _mock.Called() | ||
M internal/ui/layout/split_test.go +29 -15
| @@ -1,9 +1,9 @@ | |||
| 1 | 1 | package layout_test | |
| 2 | 2 | ||
| 3 | 3 | import ( | |
| 4 | + | "context" | |
| 4 | 5 | "testing" | |
| 5 | 6 | ||
| 6 | - | "github.com/rs/zerolog" | |
| 7 | 7 | "github.com/stretchr/testify/assert" | |
| 8 | 8 | "github.com/stretchr/testify/mock" | |
| 9 | 9 | "github.com/stretchr/testify/require" | |
| @@ -35,6 +35,7 @@ func setupSplitViewMocks(mockPaned *mocks.MockPanedWidget, orientation layout.Or | |||
| 35 | 35 | ||
| 36 | 36 | func TestNewSplitView_Horizontal(t *testing.T) { | |
| 37 | 37 | // Arrange | |
| 38 | + | ctx := context.Background() | |
| 38 | 39 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 39 | 40 | mockPaned := mocks.NewMockPanedWidget(t) | |
| 40 | 41 | mockStartChild := mocks.NewMockWidget(t) | |
| @@ -46,7 +47,7 @@ func TestNewSplitView_Horizontal(t *testing.T) { | |||
| 46 | 47 | mockPaned.EXPECT().SetEndChild(mockEndChild).Once() | |
| 47 | 48 | ||
| 48 | 49 | // Act | |
| 49 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, mockStartChild, mockEndChild, 0.5) | |
| 50 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, mockStartChild, mockEndChild, 0.5) | |
| 50 | 51 | ||
| 51 | 52 | // Assert | |
| 52 | 53 | require.NotNil(t, sv) | |
| @@ -58,6 +59,7 @@ func TestNewSplitView_Horizontal(t *testing.T) { | |||
| 58 | 59 | ||
| 59 | 60 | func TestNewSplitView_Vertical(t *testing.T) { | |
| 60 | 61 | // Arrange | |
| 62 | + | ctx := context.Background() | |
| 61 | 63 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 62 | 64 | mockPaned := mocks.NewMockPanedWidget(t) | |
| 63 | 65 | mockStartChild := mocks.NewMockWidget(t) | |
| @@ -69,7 +71,7 @@ func TestNewSplitView_Vertical(t *testing.T) { | |||
| 69 | 71 | mockPaned.EXPECT().SetEndChild(mockEndChild).Once() | |
| 70 | 72 | ||
| 71 | 73 | // Act | |
| 72 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationVertical, mockStartChild, mockEndChild, 0.5) | |
| 74 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationVertical, mockStartChild, mockEndChild, 0.5) | |
| 73 | 75 | ||
| 74 | 76 | // Assert | |
| 75 | 77 | require.NotNil(t, sv) | |
| @@ -78,6 +80,7 @@ func TestNewSplitView_Vertical(t *testing.T) { | |||
| 78 | 80 | ||
| 79 | 81 | func TestNewSplitView_NilChildren(t *testing.T) { | |
| 80 | 82 | // Arrange | |
| 83 | + | ctx := context.Background() | |
| 81 | 84 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 82 | 85 | mockPaned := mocks.NewMockPanedWidget(t) | |
| 83 | 86 | ||
| @@ -86,7 +89,7 @@ func TestNewSplitView_NilChildren(t *testing.T) { | |||
| 86 | 89 | // SetStartChild and SetEndChild should NOT be called when children are nil | |
| 87 | 90 | ||
| 88 | 91 | // Act | |
| 89 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, 0.5) | |
| 92 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, 0.5) | |
| 90 | 93 | ||
| 91 | 94 | // Assert | |
| 92 | 95 | require.NotNil(t, sv) | |
| @@ -109,6 +112,7 @@ func TestSetRatio_ValidRange(t *testing.T) { | |||
| 109 | 112 | ||
| 110 | 113 | for _, tt := range tests { | |
| 111 | 114 | t.Run(tt.name, func(t *testing.T) { | |
| 115 | + | ctx := context.Background() | |
| 112 | 116 | // Arrange | |
| 113 | 117 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 114 | 118 | mockPaned := mocks.NewMockPanedWidget(t) | |
| @@ -116,7 +120,7 @@ func TestSetRatio_ValidRange(t *testing.T) { | |||
| 116 | 120 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | |
| 117 | 121 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | |
| 118 | 122 | ||
| 119 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, 0.5) | |
| 123 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, 0.5) | |
| 120 | 124 | ||
| 121 | 125 | // Act | |
| 122 | 126 | sv.SetRatio(tt.input) | |
| @@ -141,6 +145,7 @@ func TestSetRatio_OutOfRange_Clamped(t *testing.T) { | |||
| 141 | 145 | ||
| 142 | 146 | for _, tt := range tests { | |
| 143 | 147 | t.Run(tt.name, func(t *testing.T) { | |
| 148 | + | ctx := context.Background() | |
| 144 | 149 | // Arrange | |
| 145 | 150 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 146 | 151 | mockPaned := mocks.NewMockPanedWidget(t) | |
| @@ -148,7 +153,7 @@ func TestSetRatio_OutOfRange_Clamped(t *testing.T) { | |||
| 148 | 153 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | |
| 149 | 154 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | |
| 150 | 155 | ||
| 151 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, 0.5) | |
| 156 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, 0.5) | |
| 152 | 157 | ||
| 153 | 158 | // Act | |
| 154 | 159 | sv.SetRatio(tt.input) | |
| @@ -161,6 +166,7 @@ func TestSetRatio_OutOfRange_Clamped(t *testing.T) { | |||
| 161 | 166 | ||
| 162 | 167 | func TestSwapStart_ReplacesChild(t *testing.T) { | |
| 163 | 168 | // Arrange | |
| 169 | + | ctx := context.Background() | |
| 164 | 170 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 165 | 171 | mockPaned := mocks.NewMockPanedWidget(t) | |
| 166 | 172 | mockOldChild := mocks.NewMockWidget(t) | |
| @@ -170,7 +176,7 @@ func TestSwapStart_ReplacesChild(t *testing.T) { | |||
| 170 | 176 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | |
| 171 | 177 | mockPaned.EXPECT().SetStartChild(mockOldChild).Once() | |
| 172 | 178 | ||
| 173 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, mockOldChild, nil, 0.5) | |
| 179 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, mockOldChild, nil, 0.5) | |
| 174 | 180 | ||
| 175 | 181 | // Expect swap operations | |
| 176 | 182 | mockPaned.EXPECT().SetStartChild(nil).Once() // Remove old | |
| @@ -185,6 +191,7 @@ func TestSwapStart_ReplacesChild(t *testing.T) { | |||
| 185 | 191 | ||
| 186 | 192 | func TestSwapEnd_ReplacesChild(t *testing.T) { | |
| 187 | 193 | // Arrange | |
| 194 | + | ctx := context.Background() | |
| 188 | 195 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 189 | 196 | mockPaned := mocks.NewMockPanedWidget(t) | |
| 190 | 197 | mockOldChild := mocks.NewMockWidget(t) | |
| @@ -194,7 +201,7 @@ func TestSwapEnd_ReplacesChild(t *testing.T) { | |||
| 194 | 201 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | |
| 195 | 202 | mockPaned.EXPECT().SetEndChild(mockOldChild).Once() | |
| 196 | 203 | ||
| 197 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, mockOldChild, 0.5) | |
| 204 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, mockOldChild, 0.5) | |
| 198 | 205 | ||
| 199 | 206 | // Expect swap operations | |
| 200 | 207 | mockPaned.EXPECT().SetEndChild(nil).Once() // Remove old | |
| @@ -209,6 +216,7 @@ func TestSwapEnd_ReplacesChild(t *testing.T) { | |||
| 209 | 216 | ||
| 210 | 217 | func TestSwapStart_FromNil(t *testing.T) { | |
| 211 | 218 | // Arrange | |
| 219 | + | ctx := context.Background() | |
| 212 | 220 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 213 | 221 | mockPaned := mocks.NewMockPanedWidget(t) | |
| 214 | 222 | mockNewChild := mocks.NewMockWidget(t) | |
| @@ -216,7 +224,7 @@ func TestSwapStart_FromNil(t *testing.T) { | |||
| 216 | 224 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | |
| 217 | 225 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | |
| 218 | 226 | ||
| 219 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, 0.5) | |
| 227 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, 0.5) | |
| 220 | 228 | ||
| 221 | 229 | // Expect only adding new child (no removal since old was nil) | |
| 222 | 230 | mockPaned.EXPECT().SetStartChild(mockNewChild).Once() | |
| @@ -230,6 +238,7 @@ func TestSwapStart_FromNil(t *testing.T) { | |||
| 230 | 238 | ||
| 231 | 239 | func TestSwapEnd_ToNil(t *testing.T) { | |
| 232 | 240 | // Arrange | |
| 241 | + | ctx := context.Background() | |
| 233 | 242 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 234 | 243 | mockPaned := mocks.NewMockPanedWidget(t) | |
| 235 | 244 | mockOldChild := mocks.NewMockWidget(t) | |
| @@ -238,7 +247,7 @@ func TestSwapEnd_ToNil(t *testing.T) { | |||
| 238 | 247 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | |
| 239 | 248 | mockPaned.EXPECT().SetEndChild(mockOldChild).Once() | |
| 240 | 249 | ||
| 241 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, mockOldChild, 0.5) | |
| 250 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, mockOldChild, 0.5) | |
| 242 | 251 | ||
| 243 | 252 | // Expect removal (SetEndChild(nil) called for clearing old) | |
| 244 | 253 | mockPaned.EXPECT().SetEndChild(nil).Once() | |
| @@ -252,13 +261,14 @@ func TestSwapEnd_ToNil(t *testing.T) { | |||
| 252 | 261 | ||
| 253 | 262 | func TestWidget_ReturnsPanedWidget(t *testing.T) { | |
| 254 | 263 | // Arrange | |
| 264 | + | ctx := context.Background() | |
| 255 | 265 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 256 | 266 | mockPaned := mocks.NewMockPanedWidget(t) | |
| 257 | 267 | ||
| 258 | 268 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | |
| 259 | 269 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | |
| 260 | 270 | ||
| 261 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, 0.5) | |
| 271 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, 0.5) | |
| 262 | 272 | ||
| 263 | 273 | // Act | |
| 264 | 274 | widget := sv.Widget() | |
| @@ -269,13 +279,14 @@ func TestWidget_ReturnsPanedWidget(t *testing.T) { | |||
| 269 | 279 | ||
| 270 | 280 | func TestSetPosition_DelegatesToPaned(t *testing.T) { | |
| 271 | 281 | // Arrange | |
| 282 | + | ctx := context.Background() | |
| 272 | 283 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 273 | 284 | mockPaned := mocks.NewMockPanedWidget(t) | |
| 274 | 285 | ||
| 275 | 286 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | |
| 276 | 287 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | |
| 277 | 288 | ||
| 278 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, 0.5) | |
| 289 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, 0.5) | |
| 279 | 290 | ||
| 280 | 291 | mockPaned.EXPECT().SetPosition(400).Once() | |
| 281 | 292 | ||
| @@ -287,13 +298,14 @@ func TestSetPosition_DelegatesToPaned(t *testing.T) { | |||
| 287 | 298 | ||
| 288 | 299 | func TestGetPosition_DelegatesToPaned(t *testing.T) { | |
| 289 | 300 | // Arrange | |
| 301 | + | ctx := context.Background() | |
| 290 | 302 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 291 | 303 | mockPaned := mocks.NewMockPanedWidget(t) | |
| 292 | 304 | ||
| 293 | 305 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | |
| 294 | 306 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | |
| 295 | 307 | ||
| 296 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, 0.5) | |
| 308 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, 0.5) | |
| 297 | 309 | ||
| 298 | 310 | mockPaned.EXPECT().GetPosition().Return(400).Once() | |
| 299 | 311 | ||
| @@ -306,13 +318,14 @@ func TestGetPosition_DelegatesToPaned(t *testing.T) { | |||
| 306 | 318 | ||
| 307 | 319 | func TestSetWideHandle_DelegatesToPaned(t *testing.T) { | |
| 308 | 320 | // Arrange | |
| 321 | + | ctx := context.Background() | |
| 309 | 322 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 310 | 323 | mockPaned := mocks.NewMockPanedWidget(t) | |
| 311 | 324 | ||
| 312 | 325 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | |
| 313 | 326 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | |
| 314 | 327 | ||
| 315 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, 0.5) | |
| 328 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, 0.5) | |
| 316 | 329 | ||
| 317 | 330 | mockPaned.EXPECT().SetWideHandle(true).Once() | |
| 318 | 331 | ||
| @@ -335,6 +348,7 @@ func TestNewSplitView_InitialRatio_Clamped(t *testing.T) { | |||
| 335 | 348 | ||
| 336 | 349 | for _, tt := range tests { | |
| 337 | 350 | t.Run(tt.name, func(t *testing.T) { | |
| 351 | + | ctx := context.Background() | |
| 338 | 352 | // Arrange | |
| 339 | 353 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 340 | 354 | mockPaned := mocks.NewMockPanedWidget(t) | |
| @@ -343,7 +357,7 @@ func TestNewSplitView_InitialRatio_Clamped(t *testing.T) { | |||
| 343 | 357 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | |
| 344 | 358 | ||
| 345 | 359 | // Act | |
| 346 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, tt.input) | |
| 360 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, tt.input) | |
| 347 | 361 | ||
| 348 | 362 | // Assert | |
| 349 | 363 | assert.Equal(t, tt.expected, sv.GetRatio()) | |
| @@ -1,9 +1,9 @@ | |||||
| 1 | package layout_test | 1 | package layout_test | ||
| 2 | 2 | ||||
| 3 | import ( | 3 | import ( | ||
| 4 | + | "context" | |||
| 4 | "testing" | 5 | "testing" | ||
| 5 | 6 | ||||
| 6 | - | "github.com/rs/zerolog" | |||
| 7 | "github.com/stretchr/testify/assert" | 7 | "github.com/stretchr/testify/assert" | ||
| 8 | "github.com/stretchr/testify/mock" | 8 | "github.com/stretchr/testify/mock" | ||
| 9 | "github.com/stretchr/testify/require" | 9 | "github.com/stretchr/testify/require" | ||
| @@ -35,6 +35,7 @@ func setupSplitViewMocks(mockPaned *mocks.MockPanedWidget, orientation layout.Or | |||||
| 35 | 35 | ||||
| 36 | func TestNewSplitView_Horizontal(t *testing.T) { | 36 | func TestNewSplitView_Horizontal(t *testing.T) { | ||
| 37 | // Arrange | 37 | // Arrange | ||
| 38 | + | ctx := context.Background() | |||
| 38 | mockFactory := mocks.NewMockWidgetFactory(t) | 39 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 39 | mockPaned := mocks.NewMockPanedWidget(t) | 40 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| 40 | mockStartChild := mocks.NewMockWidget(t) | 41 | mockStartChild := mocks.NewMockWidget(t) | ||
| @@ -46,7 +47,7 @@ func TestNewSplitView_Horizontal(t *testing.T) { | |||||
| 46 | mockPaned.EXPECT().SetEndChild(mockEndChild).Once() | 47 | mockPaned.EXPECT().SetEndChild(mockEndChild).Once() | ||
| 47 | 48 | ||||
| 48 | // Act | 49 | // Act | ||
| 49 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, mockStartChild, mockEndChild, 0.5) | 50 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, mockStartChild, mockEndChild, 0.5) |
| 50 | 51 | ||||
| 51 | // Assert | 52 | // Assert | ||
| 52 | require.NotNil(t, sv) | 53 | require.NotNil(t, sv) | ||
| @@ -58,6 +59,7 @@ func TestNewSplitView_Horizontal(t *testing.T) { | |||||
| 58 | 59 | ||||
| 59 | func TestNewSplitView_Vertical(t *testing.T) { | 60 | func TestNewSplitView_Vertical(t *testing.T) { | ||
| 60 | // Arrange | 61 | // Arrange | ||
| 62 | + | ctx := context.Background() | |||
| 61 | mockFactory := mocks.NewMockWidgetFactory(t) | 63 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 62 | mockPaned := mocks.NewMockPanedWidget(t) | 64 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| 63 | mockStartChild := mocks.NewMockWidget(t) | 65 | mockStartChild := mocks.NewMockWidget(t) | ||
| @@ -69,7 +71,7 @@ func TestNewSplitView_Vertical(t *testing.T) { | |||||
| 69 | mockPaned.EXPECT().SetEndChild(mockEndChild).Once() | 71 | mockPaned.EXPECT().SetEndChild(mockEndChild).Once() | ||
| 70 | 72 | ||||
| 71 | // Act | 73 | // Act | ||
| 72 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationVertical, mockStartChild, mockEndChild, 0.5) | 74 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationVertical, mockStartChild, mockEndChild, 0.5) |
| 73 | 75 | ||||
| 74 | // Assert | 76 | // Assert | ||
| 75 | require.NotNil(t, sv) | 77 | require.NotNil(t, sv) | ||
| @@ -78,6 +80,7 @@ func TestNewSplitView_Vertical(t *testing.T) { | |||||
| 78 | 80 | ||||
| 79 | func TestNewSplitView_NilChildren(t *testing.T) { | 81 | func TestNewSplitView_NilChildren(t *testing.T) { | ||
| 80 | // Arrange | 82 | // Arrange | ||
| 83 | + | ctx := context.Background() | |||
| 81 | mockFactory := mocks.NewMockWidgetFactory(t) | 84 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 82 | mockPaned := mocks.NewMockPanedWidget(t) | 85 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| 83 | 86 | ||||
| @@ -86,7 +89,7 @@ func TestNewSplitView_NilChildren(t *testing.T) { | |||||
| 86 | // SetStartChild and SetEndChild should NOT be called when children are nil | 89 | // SetStartChild and SetEndChild should NOT be called when children are nil | ||
| 87 | 90 | ||||
| 88 | // Act | 91 | // Act | ||
| 89 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, 0.5) | 92 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, 0.5) |
| 90 | 93 | ||||
| 91 | // Assert | 94 | // Assert | ||
| 92 | require.NotNil(t, sv) | 95 | require.NotNil(t, sv) | ||
| @@ -109,6 +112,7 @@ func TestSetRatio_ValidRange(t *testing.T) { | |||||
| 109 | 112 | ||||
| 110 | for _, tt := range tests { | 113 | for _, tt := range tests { | ||
| 111 | t.Run(tt.name, func(t *testing.T) { | 114 | t.Run(tt.name, func(t *testing.T) { | ||
| 115 | + | ctx := context.Background() | |||
| 112 | // Arrange | 116 | // Arrange | ||
| 113 | mockFactory := mocks.NewMockWidgetFactory(t) | 117 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 114 | mockPaned := mocks.NewMockPanedWidget(t) | 118 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| @@ -116,7 +120,7 @@ func TestSetRatio_ValidRange(t *testing.T) { | |||||
| 116 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | 120 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | ||
| 117 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | 121 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | ||
| 118 | 122 | ||||
| 119 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, 0.5) | 123 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, 0.5) |
| 120 | 124 | ||||
| 121 | // Act | 125 | // Act | ||
| 122 | sv.SetRatio(tt.input) | 126 | sv.SetRatio(tt.input) | ||
| @@ -141,6 +145,7 @@ func TestSetRatio_OutOfRange_Clamped(t *testing.T) { | |||||
| 141 | 145 | ||||
| 142 | for _, tt := range tests { | 146 | for _, tt := range tests { | ||
| 143 | t.Run(tt.name, func(t *testing.T) { | 147 | t.Run(tt.name, func(t *testing.T) { | ||
| 148 | + | ctx := context.Background() | |||
| 144 | // Arrange | 149 | // Arrange | ||
| 145 | mockFactory := mocks.NewMockWidgetFactory(t) | 150 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 146 | mockPaned := mocks.NewMockPanedWidget(t) | 151 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| @@ -148,7 +153,7 @@ func TestSetRatio_OutOfRange_Clamped(t *testing.T) { | |||||
| 148 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | 153 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | ||
| 149 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | 154 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | ||
| 150 | 155 | ||||
| 151 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, 0.5) | 156 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, 0.5) |
| 152 | 157 | ||||
| 153 | // Act | 158 | // Act | ||
| 154 | sv.SetRatio(tt.input) | 159 | sv.SetRatio(tt.input) | ||
| @@ -161,6 +166,7 @@ func TestSetRatio_OutOfRange_Clamped(t *testing.T) { | |||||
| 161 | 166 | ||||
| 162 | func TestSwapStart_ReplacesChild(t *testing.T) { | 167 | func TestSwapStart_ReplacesChild(t *testing.T) { | ||
| 163 | // Arrange | 168 | // Arrange | ||
| 169 | + | ctx := context.Background() | |||
| 164 | mockFactory := mocks.NewMockWidgetFactory(t) | 170 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 165 | mockPaned := mocks.NewMockPanedWidget(t) | 171 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| 166 | mockOldChild := mocks.NewMockWidget(t) | 172 | mockOldChild := mocks.NewMockWidget(t) | ||
| @@ -170,7 +176,7 @@ func TestSwapStart_ReplacesChild(t *testing.T) { | |||||
| 170 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | 176 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | ||
| 171 | mockPaned.EXPECT().SetStartChild(mockOldChild).Once() | 177 | mockPaned.EXPECT().SetStartChild(mockOldChild).Once() | ||
| 172 | 178 | ||||
| 173 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, mockOldChild, nil, 0.5) | 179 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, mockOldChild, nil, 0.5) |
| 174 | 180 | ||||
| 175 | // Expect swap operations | 181 | // Expect swap operations | ||
| 176 | mockPaned.EXPECT().SetStartChild(nil).Once() // Remove old | 182 | mockPaned.EXPECT().SetStartChild(nil).Once() // Remove old | ||
| @@ -185,6 +191,7 @@ func TestSwapStart_ReplacesChild(t *testing.T) { | |||||
| 185 | 191 | ||||
| 186 | func TestSwapEnd_ReplacesChild(t *testing.T) { | 192 | func TestSwapEnd_ReplacesChild(t *testing.T) { | ||
| 187 | // Arrange | 193 | // Arrange | ||
| 194 | + | ctx := context.Background() | |||
| 188 | mockFactory := mocks.NewMockWidgetFactory(t) | 195 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 189 | mockPaned := mocks.NewMockPanedWidget(t) | 196 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| 190 | mockOldChild := mocks.NewMockWidget(t) | 197 | mockOldChild := mocks.NewMockWidget(t) | ||
| @@ -194,7 +201,7 @@ func TestSwapEnd_ReplacesChild(t *testing.T) { | |||||
| 194 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | 201 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | ||
| 195 | mockPaned.EXPECT().SetEndChild(mockOldChild).Once() | 202 | mockPaned.EXPECT().SetEndChild(mockOldChild).Once() | ||
| 196 | 203 | ||||
| 197 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, mockOldChild, 0.5) | 204 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, mockOldChild, 0.5) |
| 198 | 205 | ||||
| 199 | // Expect swap operations | 206 | // Expect swap operations | ||
| 200 | mockPaned.EXPECT().SetEndChild(nil).Once() // Remove old | 207 | mockPaned.EXPECT().SetEndChild(nil).Once() // Remove old | ||
| @@ -209,6 +216,7 @@ func TestSwapEnd_ReplacesChild(t *testing.T) { | |||||
| 209 | 216 | ||||
| 210 | func TestSwapStart_FromNil(t *testing.T) { | 217 | func TestSwapStart_FromNil(t *testing.T) { | ||
| 211 | // Arrange | 218 | // Arrange | ||
| 219 | + | ctx := context.Background() | |||
| 212 | mockFactory := mocks.NewMockWidgetFactory(t) | 220 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 213 | mockPaned := mocks.NewMockPanedWidget(t) | 221 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| 214 | mockNewChild := mocks.NewMockWidget(t) | 222 | mockNewChild := mocks.NewMockWidget(t) | ||
| @@ -216,7 +224,7 @@ func TestSwapStart_FromNil(t *testing.T) { | |||||
| 216 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | 224 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | ||
| 217 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | 225 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | ||
| 218 | 226 | ||||
| 219 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, 0.5) | 227 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, 0.5) |
| 220 | 228 | ||||
| 221 | // Expect only adding new child (no removal since old was nil) | 229 | // Expect only adding new child (no removal since old was nil) | ||
| 222 | mockPaned.EXPECT().SetStartChild(mockNewChild).Once() | 230 | mockPaned.EXPECT().SetStartChild(mockNewChild).Once() | ||
| @@ -230,6 +238,7 @@ func TestSwapStart_FromNil(t *testing.T) { | |||||
| 230 | 238 | ||||
| 231 | func TestSwapEnd_ToNil(t *testing.T) { | 239 | func TestSwapEnd_ToNil(t *testing.T) { | ||
| 232 | // Arrange | 240 | // Arrange | ||
| 241 | + | ctx := context.Background() | |||
| 233 | mockFactory := mocks.NewMockWidgetFactory(t) | 242 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 234 | mockPaned := mocks.NewMockPanedWidget(t) | 243 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| 235 | mockOldChild := mocks.NewMockWidget(t) | 244 | mockOldChild := mocks.NewMockWidget(t) | ||
| @@ -238,7 +247,7 @@ func TestSwapEnd_ToNil(t *testing.T) { | |||||
| 238 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | 247 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | ||
| 239 | mockPaned.EXPECT().SetEndChild(mockOldChild).Once() | 248 | mockPaned.EXPECT().SetEndChild(mockOldChild).Once() | ||
| 240 | 249 | ||||
| 241 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, mockOldChild, 0.5) | 250 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, mockOldChild, 0.5) |
| 242 | 251 | ||||
| 243 | // Expect removal (SetEndChild(nil) called for clearing old) | 252 | // Expect removal (SetEndChild(nil) called for clearing old) | ||
| 244 | mockPaned.EXPECT().SetEndChild(nil).Once() | 253 | mockPaned.EXPECT().SetEndChild(nil).Once() | ||
| @@ -252,13 +261,14 @@ func TestSwapEnd_ToNil(t *testing.T) { | |||||
| 252 | 261 | ||||
| 253 | func TestWidget_ReturnsPanedWidget(t *testing.T) { | 262 | func TestWidget_ReturnsPanedWidget(t *testing.T) { | ||
| 254 | // Arrange | 263 | // Arrange | ||
| 264 | + | ctx := context.Background() | |||
| 255 | mockFactory := mocks.NewMockWidgetFactory(t) | 265 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 256 | mockPaned := mocks.NewMockPanedWidget(t) | 266 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| 257 | 267 | ||||
| 258 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | 268 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | ||
| 259 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | 269 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | ||
| 260 | 270 | ||||
| 261 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, 0.5) | 271 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, 0.5) |
| 262 | 272 | ||||
| 263 | // Act | 273 | // Act | ||
| 264 | widget := sv.Widget() | 274 | widget := sv.Widget() | ||
| @@ -269,13 +279,14 @@ func TestWidget_ReturnsPanedWidget(t *testing.T) { | |||||
| 269 | 279 | ||||
| 270 | func TestSetPosition_DelegatesToPaned(t *testing.T) { | 280 | func TestSetPosition_DelegatesToPaned(t *testing.T) { | ||
| 271 | // Arrange | 281 | // Arrange | ||
| 282 | + | ctx := context.Background() | |||
| 272 | mockFactory := mocks.NewMockWidgetFactory(t) | 283 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 273 | mockPaned := mocks.NewMockPanedWidget(t) | 284 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| 274 | 285 | ||||
| 275 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | 286 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | ||
| 276 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | 287 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | ||
| 277 | 288 | ||||
| 278 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, 0.5) | 289 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, 0.5) |
| 279 | 290 | ||||
| 280 | mockPaned.EXPECT().SetPosition(400).Once() | 291 | mockPaned.EXPECT().SetPosition(400).Once() | ||
| 281 | 292 | ||||
| @@ -287,13 +298,14 @@ func TestSetPosition_DelegatesToPaned(t *testing.T) { | |||||
| 287 | 298 | ||||
| 288 | func TestGetPosition_DelegatesToPaned(t *testing.T) { | 299 | func TestGetPosition_DelegatesToPaned(t *testing.T) { | ||
| 289 | // Arrange | 300 | // Arrange | ||
| 301 | + | ctx := context.Background() | |||
| 290 | mockFactory := mocks.NewMockWidgetFactory(t) | 302 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 291 | mockPaned := mocks.NewMockPanedWidget(t) | 303 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| 292 | 304 | ||||
| 293 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | 305 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | ||
| 294 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | 306 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | ||
| 295 | 307 | ||||
| 296 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, 0.5) | 308 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, 0.5) |
| 297 | 309 | ||||
| 298 | mockPaned.EXPECT().GetPosition().Return(400).Once() | 310 | mockPaned.EXPECT().GetPosition().Return(400).Once() | ||
| 299 | 311 | ||||
| @@ -306,13 +318,14 @@ func TestGetPosition_DelegatesToPaned(t *testing.T) { | |||||
| 306 | 318 | ||||
| 307 | func TestSetWideHandle_DelegatesToPaned(t *testing.T) { | 319 | func TestSetWideHandle_DelegatesToPaned(t *testing.T) { | ||
| 308 | // Arrange | 320 | // Arrange | ||
| 321 | + | ctx := context.Background() | |||
| 309 | mockFactory := mocks.NewMockWidgetFactory(t) | 322 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 310 | mockPaned := mocks.NewMockPanedWidget(t) | 323 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| 311 | 324 | ||||
| 312 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | 325 | mockFactory.EXPECT().NewPaned(mock.Anything).Return(mockPaned).Once() | ||
| 313 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | 326 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | ||
| 314 | 327 | ||||
| 315 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, 0.5) | 328 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, 0.5) |
| 316 | 329 | ||||
| 317 | mockPaned.EXPECT().SetWideHandle(true).Once() | 330 | mockPaned.EXPECT().SetWideHandle(true).Once() | ||
| 318 | 331 | ||||
| @@ -335,6 +348,7 @@ func TestNewSplitView_InitialRatio_Clamped(t *testing.T) { | |||||
| 335 | 348 | ||||
| 336 | for _, tt := range tests { | 349 | for _, tt := range tests { | ||
| 337 | t.Run(tt.name, func(t *testing.T) { | 350 | t.Run(tt.name, func(t *testing.T) { | ||
| 351 | + | ctx := context.Background() | |||
| 338 | // Arrange | 352 | // Arrange | ||
| 339 | mockFactory := mocks.NewMockWidgetFactory(t) | 353 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 340 | mockPaned := mocks.NewMockPanedWidget(t) | 354 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| @@ -343,7 +357,7 @@ func TestNewSplitView_InitialRatio_Clamped(t *testing.T) { | |||||
| 343 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | 357 | setupSplitViewMocks(mockPaned, layout.OrientationHorizontal) | ||
| 344 | 358 | ||||
| 345 | // Act | 359 | // Act | ||
| 346 | - | sv := layout.NewSplitView(mockFactory, zerolog.Nop(), layout.OrientationHorizontal, nil, nil, tt.input) | 360 | + | sv := layout.NewSplitView(ctx, mockFactory, layout.OrientationHorizontal, nil, nil, tt.input) |
| 347 | 361 | ||||
| 348 | // Assert | 362 | // Assert | ||
| 349 | assert.Equal(t, tt.expected, sv.GetRatio()) | 363 | assert.Equal(t, tt.expected, sv.GetRatio()) | ||
M internal/ui/layout/stacked_test.go +47 -30
| @@ -1,6 +1,7 @@ | |||
| 1 | 1 | package layout_test | |
| 2 | 2 | ||
| 3 | 3 | import ( | |
| 4 | + | "context" | |
| 4 | 5 | "testing" | |
| 5 | 6 | ||
| 6 | 7 | "github.com/stretchr/testify/assert" | |
| @@ -80,6 +81,7 @@ func TestNewStackedView_EmptyStack(t *testing.T) { | |||
| 80 | 81 | ||
| 81 | 82 | func TestAddPane_SinglePane_BecomesActive(t *testing.T) { | |
| 82 | 83 | // Arrange | |
| 84 | + | ctx := context.Background() | |
| 83 | 85 | mockFactory, mockBox := setupMockFactory(t) | |
| 84 | 86 | mockTitleBar, _, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | |
| 85 | 87 | ||
| @@ -91,7 +93,7 @@ func TestAddPane_SinglePane_BecomesActive(t *testing.T) { | |||
| 91 | 93 | sv := layout.NewStackedView(mockFactory) | |
| 92 | 94 | ||
| 93 | 95 | // Act | |
| 94 | - | index := sv.AddPane("Test Page", "web-browser-symbolic", mockContainer) | |
| 96 | + | index := sv.AddPane(ctx, "Test Page", "web-browser-symbolic", mockContainer) | |
| 95 | 97 | ||
| 96 | 98 | // Assert | |
| 97 | 99 | assert.Equal(t, 0, index) | |
| @@ -101,6 +103,7 @@ func TestAddPane_SinglePane_BecomesActive(t *testing.T) { | |||
| 101 | 103 | ||
| 102 | 104 | func TestAddPane_MultiplePanes_LastBecomesActive(t *testing.T) { | |
| 103 | 105 | // Arrange | |
| 106 | + | ctx := context.Background() | |
| 104 | 107 | mockFactory, mockBox := setupMockFactory(t) | |
| 105 | 108 | ||
| 106 | 109 | // First pane | |
| @@ -124,8 +127,8 @@ func TestAddPane_MultiplePanes_LastBecomesActive(t *testing.T) { | |||
| 124 | 127 | sv := layout.NewStackedView(mockFactory) | |
| 125 | 128 | ||
| 126 | 129 | // Act | |
| 127 | - | sv.AddPane("Page 1", "", mockContainer1) | |
| 128 | - | index := sv.AddPane("Page 2", "", mockContainer2) | |
| 130 | + | sv.AddPane(ctx, "Page 1", "", mockContainer1) | |
| 131 | + | index := sv.AddPane(ctx, "Page 2", "", mockContainer2) | |
| 129 | 132 | ||
| 130 | 133 | // Assert | |
| 131 | 134 | assert.Equal(t, 1, index) | |
| @@ -135,6 +138,7 @@ func TestAddPane_MultiplePanes_LastBecomesActive(t *testing.T) { | |||
| 135 | 138 | ||
| 136 | 139 | func TestRemovePane_MiddlePane(t *testing.T) { | |
| 137 | 140 | // Arrange | |
| 141 | + | ctx := context.Background() | |
| 138 | 142 | mockFactory, mockBox := setupMockFactory(t) | |
| 139 | 143 | ||
| 140 | 144 | // Setup 3 panes (simplified - just track the key behaviors) | |
| @@ -159,9 +163,9 @@ func TestRemovePane_MiddlePane(t *testing.T) { | |||
| 159 | 163 | } | |
| 160 | 164 | ||
| 161 | 165 | sv := layout.NewStackedView(mockFactory) | |
| 162 | - | sv.AddPane("Page 1", "", containers[0]) | |
| 163 | - | sv.AddPane("Page 2", "", containers[1]) | |
| 164 | - | sv.AddPane("Page 3", "", containers[2]) | |
| 166 | + | sv.AddPane(ctx, "Page 1", "", containers[0]) | |
| 167 | + | sv.AddPane(ctx, "Page 2", "", containers[1]) | |
| 168 | + | sv.AddPane(ctx, "Page 3", "", containers[2]) | |
| 165 | 169 | ||
| 166 | 170 | // Remove middle pane (index 1) | |
| 167 | 171 | // The parent of titleBar is the button widget | |
| @@ -169,7 +173,7 @@ func TestRemovePane_MiddlePane(t *testing.T) { | |||
| 169 | 173 | mockBox.EXPECT().Remove(containers[1]).Once() | |
| 170 | 174 | ||
| 171 | 175 | // Act | |
| 172 | - | err := sv.RemovePane(1) | |
| 176 | + | err := sv.RemovePane(ctx, 1) | |
| 173 | 177 | ||
| 174 | 178 | // Assert | |
| 175 | 179 | require.NoError(t, err) | |
| @@ -178,6 +182,7 @@ func TestRemovePane_MiddlePane(t *testing.T) { | |||
| 178 | 182 | ||
| 179 | 183 | func TestRemovePane_LastPane_ReturnsError(t *testing.T) { | |
| 180 | 184 | // Arrange | |
| 185 | + | ctx := context.Background() | |
| 181 | 186 | mockFactory, mockBox := setupMockFactory(t) | |
| 182 | 187 | mockTitleBar, _, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | |
| 183 | 188 | ||
| @@ -186,10 +191,10 @@ func TestRemovePane_LastPane_ReturnsError(t *testing.T) { | |||
| 186 | 191 | mockTitleBar.EXPECT().AddCssClass("active").Once() | |
| 187 | 192 | ||
| 188 | 193 | sv := layout.NewStackedView(mockFactory) | |
| 189 | - | sv.AddPane("Only Page", "", mockContainer) | |
| 194 | + | sv.AddPane(ctx, "Only Page", "", mockContainer) | |
| 190 | 195 | ||
| 191 | 196 | // Act | |
| 192 | - | err := sv.RemovePane(0) | |
| 197 | + | err := sv.RemovePane(ctx, 0) | |
| 193 | 198 | ||
| 194 | 199 | // Assert | |
| 195 | 200 | assert.ErrorIs(t, err, layout.ErrCannotRemoveLastPane) | |
| @@ -198,11 +203,12 @@ func TestRemovePane_LastPane_ReturnsError(t *testing.T) { | |||
| 198 | 203 | ||
| 199 | 204 | func TestRemovePane_EmptyStack_ReturnsError(t *testing.T) { | |
| 200 | 205 | // Arrange | |
| 206 | + | ctx := context.Background() | |
| 201 | 207 | mockFactory, _ := setupMockFactory(t) | |
| 202 | 208 | sv := layout.NewStackedView(mockFactory) | |
| 203 | 209 | ||
| 204 | 210 | // Act | |
| 205 | - | err := sv.RemovePane(0) | |
| 211 | + | err := sv.RemovePane(ctx, 0) | |
| 206 | 212 | ||
| 207 | 213 | // Assert | |
| 208 | 214 | assert.ErrorIs(t, err, layout.ErrStackEmpty) | |
| @@ -210,6 +216,7 @@ func TestRemovePane_EmptyStack_ReturnsError(t *testing.T) { | |||
| 210 | 216 | ||
| 211 | 217 | func TestRemovePane_IndexOutOfBounds(t *testing.T) { | |
| 212 | 218 | // Arrange | |
| 219 | + | ctx := context.Background() | |
| 213 | 220 | mockFactory, mockBox := setupMockFactory(t) | |
| 214 | 221 | mockTitleBar, _, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | |
| 215 | 222 | ||
| @@ -218,10 +225,10 @@ func TestRemovePane_IndexOutOfBounds(t *testing.T) { | |||
| 218 | 225 | mockTitleBar.EXPECT().AddCssClass("active").Once() | |
| 219 | 226 | ||
| 220 | 227 | sv := layout.NewStackedView(mockFactory) | |
| 221 | - | sv.AddPane("Page", "", mockContainer) | |
| 228 | + | sv.AddPane(ctx, "Page", "", mockContainer) | |
| 222 | 229 | ||
| 223 | 230 | // Act | |
| 224 | - | err := sv.RemovePane(5) | |
| 231 | + | err := sv.RemovePane(ctx, 5) | |
| 225 | 232 | ||
| 226 | 233 | // Assert | |
| 227 | 234 | assert.ErrorIs(t, err, layout.ErrIndexOutOfBounds) | |
| @@ -229,6 +236,7 @@ func TestRemovePane_IndexOutOfBounds(t *testing.T) { | |||
| 229 | 236 | ||
| 230 | 237 | func TestSetActive_ValidIndex(t *testing.T) { | |
| 231 | 238 | // Arrange | |
| 239 | + | ctx := context.Background() | |
| 232 | 240 | mockFactory, mockBox := setupMockFactory(t) | |
| 233 | 241 | ||
| 234 | 242 | containers := make([]*mocks.MockWidget, 2) | |
| @@ -243,11 +251,11 @@ func TestSetActive_ValidIndex(t *testing.T) { | |||
| 243 | 251 | } | |
| 244 | 252 | ||
| 245 | 253 | sv := layout.NewStackedView(mockFactory) | |
| 246 | - | sv.AddPane("Page 1", "", containers[0]) | |
| 247 | - | sv.AddPane("Page 2", "", containers[1]) | |
| 254 | + | sv.AddPane(ctx, "Page 1", "", containers[0]) | |
| 255 | + | sv.AddPane(ctx, "Page 2", "", containers[1]) | |
| 248 | 256 | ||
| 249 | 257 | // Act - switch back to first pane | |
| 250 | - | err := sv.SetActive(0) | |
| 258 | + | err := sv.SetActive(ctx, 0) | |
| 251 | 259 | ||
| 252 | 260 | // Assert | |
| 253 | 261 | require.NoError(t, err) | |
| @@ -256,6 +264,7 @@ func TestSetActive_ValidIndex(t *testing.T) { | |||
| 256 | 264 | ||
| 257 | 265 | func TestSetActive_OutOfBounds(t *testing.T) { | |
| 258 | 266 | // Arrange | |
| 267 | + | ctx := context.Background() | |
| 259 | 268 | mockFactory, mockBox := setupMockFactory(t) | |
| 260 | 269 | mockTitleBar, _, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | |
| 261 | 270 | ||
| @@ -264,10 +273,10 @@ func TestSetActive_OutOfBounds(t *testing.T) { | |||
| 264 | 273 | mockTitleBar.EXPECT().AddCssClass("active").Once() | |
| 265 | 274 | ||
| 266 | 275 | sv := layout.NewStackedView(mockFactory) | |
| 267 | - | sv.AddPane("Page", "", mockContainer) | |
| 276 | + | sv.AddPane(ctx, "Page", "", mockContainer) | |
| 268 | 277 | ||
| 269 | 278 | // Act | |
| 270 | - | err := sv.SetActive(5) | |
| 279 | + | err := sv.SetActive(ctx, 5) | |
| 271 | 280 | ||
| 272 | 281 | // Assert | |
| 273 | 282 | assert.ErrorIs(t, err, layout.ErrIndexOutOfBounds) | |
| @@ -275,11 +284,12 @@ func TestSetActive_OutOfBounds(t *testing.T) { | |||
| 275 | 284 | ||
| 276 | 285 | func TestSetActive_EmptyStack(t *testing.T) { | |
| 277 | 286 | // Arrange | |
| 287 | + | ctx := context.Background() | |
| 278 | 288 | mockFactory, _ := setupMockFactory(t) | |
| 279 | 289 | sv := layout.NewStackedView(mockFactory) | |
| 280 | 290 | ||
| 281 | 291 | // Act | |
| 282 | - | err := sv.SetActive(0) | |
| 292 | + | err := sv.SetActive(ctx, 0) | |
| 283 | 293 | ||
| 284 | 294 | // Assert | |
| 285 | 295 | assert.ErrorIs(t, err, layout.ErrStackEmpty) | |
| @@ -287,6 +297,7 @@ func TestSetActive_EmptyStack(t *testing.T) { | |||
| 287 | 297 | ||
| 288 | 298 | func TestUpdateTitle(t *testing.T) { | |
| 289 | 299 | // Arrange | |
| 300 | + | ctx := context.Background() | |
| 290 | 301 | mockFactory, mockBox := setupMockFactory(t) | |
| 291 | 302 | mockTitleBar, _, mockLabel, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | |
| 292 | 303 | ||
| @@ -295,7 +306,7 @@ func TestUpdateTitle(t *testing.T) { | |||
| 295 | 306 | mockTitleBar.EXPECT().AddCssClass("active").Once() | |
| 296 | 307 | ||
| 297 | 308 | sv := layout.NewStackedView(mockFactory) | |
| 298 | - | sv.AddPane("Old Title", "", mockContainer) | |
| 309 | + | sv.AddPane(ctx, "Old Title", "", mockContainer) | |
| 299 | 310 | ||
| 300 | 311 | mockLabel.EXPECT().SetText("New Title").Once() | |
| 301 | 312 | ||
| @@ -320,6 +331,7 @@ func TestUpdateTitle_InvalidIndex(t *testing.T) { | |||
| 320 | 331 | ||
| 321 | 332 | func TestUpdateFavicon(t *testing.T) { | |
| 322 | 333 | // Arrange | |
| 334 | + | ctx := context.Background() | |
| 323 | 335 | mockFactory, mockBox := setupMockFactory(t) | |
| 324 | 336 | mockTitleBar, mockFavicon, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | |
| 325 | 337 | ||
| @@ -328,7 +340,7 @@ func TestUpdateFavicon(t *testing.T) { | |||
| 328 | 340 | mockTitleBar.EXPECT().AddCssClass("active").Once() | |
| 329 | 341 | ||
| 330 | 342 | sv := layout.NewStackedView(mockFactory) | |
| 331 | - | sv.AddPane("Page", "", mockContainer) | |
| 343 | + | sv.AddPane(ctx, "Page", "", mockContainer) | |
| 332 | 344 | ||
| 333 | 345 | mockFavicon.EXPECT().SetFromIconName("new-icon").Once() | |
| 334 | 346 | ||
| @@ -341,6 +353,7 @@ func TestUpdateFavicon(t *testing.T) { | |||
| 341 | 353 | ||
| 342 | 354 | func TestGetContainer(t *testing.T) { | |
| 343 | 355 | // Arrange | |
| 356 | + | ctx := context.Background() | |
| 344 | 357 | mockFactory, mockBox := setupMockFactory(t) | |
| 345 | 358 | mockTitleBar, _, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | |
| 346 | 359 | ||
| @@ -349,7 +362,7 @@ func TestGetContainer(t *testing.T) { | |||
| 349 | 362 | mockTitleBar.EXPECT().AddCssClass("active").Once() | |
| 350 | 363 | ||
| 351 | 364 | sv := layout.NewStackedView(mockFactory) | |
| 352 | - | sv.AddPane("Page", "", mockContainer) | |
| 365 | + | sv.AddPane(ctx, "Page", "", mockContainer) | |
| 353 | 366 | ||
| 354 | 367 | // Act | |
| 355 | 368 | container, err := sv.GetContainer(0) | |
| @@ -386,6 +399,7 @@ func TestWidget_ReturnsBoxWidget(t *testing.T) { | |||
| 386 | 399 | ||
| 387 | 400 | func TestNavigateNext_WrapsAround(t *testing.T) { | |
| 388 | 401 | // Arrange | |
| 402 | + | ctx := context.Background() | |
| 389 | 403 | mockFactory, mockBox := setupMockFactory(t) | |
| 390 | 404 | ||
| 391 | 405 | containers := make([]*mocks.MockWidget, 2) | |
| @@ -400,14 +414,14 @@ func TestNavigateNext_WrapsAround(t *testing.T) { | |||
| 400 | 414 | } | |
| 401 | 415 | ||
| 402 | 416 | sv := layout.NewStackedView(mockFactory) | |
| 403 | - | sv.AddPane("Page 1", "", containers[0]) | |
| 404 | - | sv.AddPane("Page 2", "", containers[1]) | |
| 417 | + | sv.AddPane(ctx, "Page 1", "", containers[0]) | |
| 418 | + | sv.AddPane(ctx, "Page 2", "", containers[1]) | |
| 405 | 419 | ||
| 406 | 420 | // Currently at index 1 (last added) | |
| 407 | 421 | assert.Equal(t, 1, sv.ActiveIndex()) | |
| 408 | 422 | ||
| 409 | 423 | // Act - navigate next should wrap to 0 | |
| 410 | - | err := sv.NavigateNext() | |
| 424 | + | err := sv.NavigateNext(ctx) | |
| 411 | 425 | ||
| 412 | 426 | // Assert | |
| 413 | 427 | require.NoError(t, err) | |
| @@ -416,6 +430,7 @@ func TestNavigateNext_WrapsAround(t *testing.T) { | |||
| 416 | 430 | ||
| 417 | 431 | func TestNavigatePrevious_WrapsAround(t *testing.T) { | |
| 418 | 432 | // Arrange | |
| 433 | + | ctx := context.Background() | |
| 419 | 434 | mockFactory, mockBox := setupMockFactory(t) | |
| 420 | 435 | ||
| 421 | 436 | containers := make([]*mocks.MockWidget, 2) | |
| @@ -430,14 +445,14 @@ func TestNavigatePrevious_WrapsAround(t *testing.T) { | |||
| 430 | 445 | } | |
| 431 | 446 | ||
| 432 | 447 | sv := layout.NewStackedView(mockFactory) | |
| 433 | - | sv.AddPane("Page 1", "", containers[0]) | |
| 434 | - | sv.AddPane("Page 2", "", containers[1]) | |
| 448 | + | sv.AddPane(ctx, "Page 1", "", containers[0]) | |
| 449 | + | sv.AddPane(ctx, "Page 2", "", containers[1]) | |
| 435 | 450 | ||
| 436 | 451 | // Set to first pane | |
| 437 | - | sv.SetActive(0) | |
| 452 | + | sv.SetActive(ctx, 0) | |
| 438 | 453 | ||
| 439 | 454 | // Act - navigate previous should wrap to 1 | |
| 440 | - | err := sv.NavigatePrevious() | |
| 455 | + | err := sv.NavigatePrevious(ctx) | |
| 441 | 456 | ||
| 442 | 457 | // Assert | |
| 443 | 458 | require.NoError(t, err) | |
| @@ -446,11 +461,12 @@ func TestNavigatePrevious_WrapsAround(t *testing.T) { | |||
| 446 | 461 | ||
| 447 | 462 | func TestNavigateNext_EmptyStack(t *testing.T) { | |
| 448 | 463 | // Arrange | |
| 464 | + | ctx := context.Background() | |
| 449 | 465 | mockFactory, _ := setupMockFactory(t) | |
| 450 | 466 | sv := layout.NewStackedView(mockFactory) | |
| 451 | 467 | ||
| 452 | 468 | // Act | |
| 453 | - | err := sv.NavigateNext() | |
| 469 | + | err := sv.NavigateNext(ctx) | |
| 454 | 470 | ||
| 455 | 471 | // Assert | |
| 456 | 472 | assert.ErrorIs(t, err, layout.ErrStackEmpty) | |
| @@ -458,11 +474,12 @@ func TestNavigateNext_EmptyStack(t *testing.T) { | |||
| 458 | 474 | ||
| 459 | 475 | func TestNavigatePrevious_EmptyStack(t *testing.T) { | |
| 460 | 476 | // Arrange | |
| 477 | + | ctx := context.Background() | |
| 461 | 478 | mockFactory, _ := setupMockFactory(t) | |
| 462 | 479 | sv := layout.NewStackedView(mockFactory) | |
| 463 | 480 | ||
| 464 | 481 | // Act | |
| 465 | - | err := sv.NavigatePrevious() | |
| 482 | + | err := sv.NavigatePrevious(ctx) | |
| 466 | 483 | ||
| 467 | 484 | // Assert | |
| 468 | 485 | assert.ErrorIs(t, err, layout.ErrStackEmpty) | |
| @@ -1,6 +1,7 @@ | |||||
| 1 | package layout_test | 1 | package layout_test | ||
| 2 | 2 | ||||
| 3 | import ( | 3 | import ( | ||
| 4 | + | "context" | |||
| 4 | "testing" | 5 | "testing" | ||
| 5 | 6 | ||||
| 6 | "github.com/stretchr/testify/assert" | 7 | "github.com/stretchr/testify/assert" | ||
| @@ -80,6 +81,7 @@ func TestNewStackedView_EmptyStack(t *testing.T) { | |||||
| 80 | 81 | ||||
| 81 | func TestAddPane_SinglePane_BecomesActive(t *testing.T) { | 82 | func TestAddPane_SinglePane_BecomesActive(t *testing.T) { | ||
| 82 | // Arrange | 83 | // Arrange | ||
| 84 | + | ctx := context.Background() | |||
| 83 | mockFactory, mockBox := setupMockFactory(t) | 85 | mockFactory, mockBox := setupMockFactory(t) | ||
| 84 | mockTitleBar, _, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | 86 | mockTitleBar, _, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | ||
| 85 | 87 | ||||
| @@ -91,7 +93,7 @@ func TestAddPane_SinglePane_BecomesActive(t *testing.T) { | |||||
| 91 | sv := layout.NewStackedView(mockFactory) | 93 | sv := layout.NewStackedView(mockFactory) | ||
| 92 | 94 | ||||
| 93 | // Act | 95 | // Act | ||
| 94 | - | index := sv.AddPane("Test Page", "web-browser-symbolic", mockContainer) | 96 | + | index := sv.AddPane(ctx, "Test Page", "web-browser-symbolic", mockContainer) |
| 95 | 97 | ||||
| 96 | // Assert | 98 | // Assert | ||
| 97 | assert.Equal(t, 0, index) | 99 | assert.Equal(t, 0, index) | ||
| @@ -101,6 +103,7 @@ func TestAddPane_SinglePane_BecomesActive(t *testing.T) { | |||||
| 101 | 103 | ||||
| 102 | func TestAddPane_MultiplePanes_LastBecomesActive(t *testing.T) { | 104 | func TestAddPane_MultiplePanes_LastBecomesActive(t *testing.T) { | ||
| 103 | // Arrange | 105 | // Arrange | ||
| 106 | + | ctx := context.Background() | |||
| 104 | mockFactory, mockBox := setupMockFactory(t) | 107 | mockFactory, mockBox := setupMockFactory(t) | ||
| 105 | 108 | ||||
| 106 | // First pane | 109 | // First pane | ||
| @@ -124,8 +127,8 @@ func TestAddPane_MultiplePanes_LastBecomesActive(t *testing.T) { | |||||
| 124 | sv := layout.NewStackedView(mockFactory) | 127 | sv := layout.NewStackedView(mockFactory) | ||
| 125 | 128 | ||||
| 126 | // Act | 129 | // Act | ||
| 127 | - | sv.AddPane("Page 1", "", mockContainer1) | 130 | + | sv.AddPane(ctx, "Page 1", "", mockContainer1) |
| 128 | - | index := sv.AddPane("Page 2", "", mockContainer2) | 131 | + | index := sv.AddPane(ctx, "Page 2", "", mockContainer2) |
| 129 | 132 | ||||
| 130 | // Assert | 133 | // Assert | ||
| 131 | assert.Equal(t, 1, index) | 134 | assert.Equal(t, 1, index) | ||
| @@ -135,6 +138,7 @@ func TestAddPane_MultiplePanes_LastBecomesActive(t *testing.T) { | |||||
| 135 | 138 | ||||
| 136 | func TestRemovePane_MiddlePane(t *testing.T) { | 139 | func TestRemovePane_MiddlePane(t *testing.T) { | ||
| 137 | // Arrange | 140 | // Arrange | ||
| 141 | + | ctx := context.Background() | |||
| 138 | mockFactory, mockBox := setupMockFactory(t) | 142 | mockFactory, mockBox := setupMockFactory(t) | ||
| 139 | 143 | ||||
| 140 | // Setup 3 panes (simplified - just track the key behaviors) | 144 | // Setup 3 panes (simplified - just track the key behaviors) | ||
| @@ -159,9 +163,9 @@ func TestRemovePane_MiddlePane(t *testing.T) { | |||||
| 159 | } | 163 | } | ||
| 160 | 164 | ||||
| 161 | sv := layout.NewStackedView(mockFactory) | 165 | sv := layout.NewStackedView(mockFactory) | ||
| 162 | - | sv.AddPane("Page 1", "", containers[0]) | 166 | + | sv.AddPane(ctx, "Page 1", "", containers[0]) |
| 163 | - | sv.AddPane("Page 2", "", containers[1]) | 167 | + | sv.AddPane(ctx, "Page 2", "", containers[1]) |
| 164 | - | sv.AddPane("Page 3", "", containers[2]) | 168 | + | sv.AddPane(ctx, "Page 3", "", containers[2]) |
| 165 | 169 | ||||
| 166 | // Remove middle pane (index 1) | 170 | // Remove middle pane (index 1) | ||
| 167 | // The parent of titleBar is the button widget | 171 | // The parent of titleBar is the button widget | ||
| @@ -169,7 +173,7 @@ func TestRemovePane_MiddlePane(t *testing.T) { | |||||
| 169 | mockBox.EXPECT().Remove(containers[1]).Once() | 173 | mockBox.EXPECT().Remove(containers[1]).Once() | ||
| 170 | 174 | ||||
| 171 | // Act | 175 | // Act | ||
| 172 | - | err := sv.RemovePane(1) | 176 | + | err := sv.RemovePane(ctx, 1) |
| 173 | 177 | ||||
| 174 | // Assert | 178 | // Assert | ||
| 175 | require.NoError(t, err) | 179 | require.NoError(t, err) | ||
| @@ -178,6 +182,7 @@ func TestRemovePane_MiddlePane(t *testing.T) { | |||||
| 178 | 182 | ||||
| 179 | func TestRemovePane_LastPane_ReturnsError(t *testing.T) { | 183 | func TestRemovePane_LastPane_ReturnsError(t *testing.T) { | ||
| 180 | // Arrange | 184 | // Arrange | ||
| 185 | + | ctx := context.Background() | |||
| 181 | mockFactory, mockBox := setupMockFactory(t) | 186 | mockFactory, mockBox := setupMockFactory(t) | ||
| 182 | mockTitleBar, _, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | 187 | mockTitleBar, _, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | ||
| 183 | 188 | ||||
| @@ -186,10 +191,10 @@ func TestRemovePane_LastPane_ReturnsError(t *testing.T) { | |||||
| 186 | mockTitleBar.EXPECT().AddCssClass("active").Once() | 191 | mockTitleBar.EXPECT().AddCssClass("active").Once() | ||
| 187 | 192 | ||||
| 188 | sv := layout.NewStackedView(mockFactory) | 193 | sv := layout.NewStackedView(mockFactory) | ||
| 189 | - | sv.AddPane("Only Page", "", mockContainer) | 194 | + | sv.AddPane(ctx, "Only Page", "", mockContainer) |
| 190 | 195 | ||||
| 191 | // Act | 196 | // Act | ||
| 192 | - | err := sv.RemovePane(0) | 197 | + | err := sv.RemovePane(ctx, 0) |
| 193 | 198 | ||||
| 194 | // Assert | 199 | // Assert | ||
| 195 | assert.ErrorIs(t, err, layout.ErrCannotRemoveLastPane) | 200 | assert.ErrorIs(t, err, layout.ErrCannotRemoveLastPane) | ||
| @@ -198,11 +203,12 @@ func TestRemovePane_LastPane_ReturnsError(t *testing.T) { | |||||
| 198 | 203 | ||||
| 199 | func TestRemovePane_EmptyStack_ReturnsError(t *testing.T) { | 204 | func TestRemovePane_EmptyStack_ReturnsError(t *testing.T) { | ||
| 200 | // Arrange | 205 | // Arrange | ||
| 206 | + | ctx := context.Background() | |||
| 201 | mockFactory, _ := setupMockFactory(t) | 207 | mockFactory, _ := setupMockFactory(t) | ||
| 202 | sv := layout.NewStackedView(mockFactory) | 208 | sv := layout.NewStackedView(mockFactory) | ||
| 203 | 209 | ||||
| 204 | // Act | 210 | // Act | ||
| 205 | - | err := sv.RemovePane(0) | 211 | + | err := sv.RemovePane(ctx, 0) |
| 206 | 212 | ||||
| 207 | // Assert | 213 | // Assert | ||
| 208 | assert.ErrorIs(t, err, layout.ErrStackEmpty) | 214 | assert.ErrorIs(t, err, layout.ErrStackEmpty) | ||
| @@ -210,6 +216,7 @@ func TestRemovePane_EmptyStack_ReturnsError(t *testing.T) { | |||||
| 210 | 216 | ||||
| 211 | func TestRemovePane_IndexOutOfBounds(t *testing.T) { | 217 | func TestRemovePane_IndexOutOfBounds(t *testing.T) { | ||
| 212 | // Arrange | 218 | // Arrange | ||
| 219 | + | ctx := context.Background() | |||
| 213 | mockFactory, mockBox := setupMockFactory(t) | 220 | mockFactory, mockBox := setupMockFactory(t) | ||
| 214 | mockTitleBar, _, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | 221 | mockTitleBar, _, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | ||
| 215 | 222 | ||||
| @@ -218,10 +225,10 @@ func TestRemovePane_IndexOutOfBounds(t *testing.T) { | |||||
| 218 | mockTitleBar.EXPECT().AddCssClass("active").Once() | 225 | mockTitleBar.EXPECT().AddCssClass("active").Once() | ||
| 219 | 226 | ||||
| 220 | sv := layout.NewStackedView(mockFactory) | 227 | sv := layout.NewStackedView(mockFactory) | ||
| 221 | - | sv.AddPane("Page", "", mockContainer) | 228 | + | sv.AddPane(ctx, "Page", "", mockContainer) |
| 222 | 229 | ||||
| 223 | // Act | 230 | // Act | ||
| 224 | - | err := sv.RemovePane(5) | 231 | + | err := sv.RemovePane(ctx, 5) |
| 225 | 232 | ||||
| 226 | // Assert | 233 | // Assert | ||
| 227 | assert.ErrorIs(t, err, layout.ErrIndexOutOfBounds) | 234 | assert.ErrorIs(t, err, layout.ErrIndexOutOfBounds) | ||
| @@ -229,6 +236,7 @@ func TestRemovePane_IndexOutOfBounds(t *testing.T) { | |||||
| 229 | 236 | ||||
| 230 | func TestSetActive_ValidIndex(t *testing.T) { | 237 | func TestSetActive_ValidIndex(t *testing.T) { | ||
| 231 | // Arrange | 238 | // Arrange | ||
| 239 | + | ctx := context.Background() | |||
| 232 | mockFactory, mockBox := setupMockFactory(t) | 240 | mockFactory, mockBox := setupMockFactory(t) | ||
| 233 | 241 | ||||
| 234 | containers := make([]*mocks.MockWidget, 2) | 242 | containers := make([]*mocks.MockWidget, 2) | ||
| @@ -243,11 +251,11 @@ func TestSetActive_ValidIndex(t *testing.T) { | |||||
| 243 | } | 251 | } | ||
| 244 | 252 | ||||
| 245 | sv := layout.NewStackedView(mockFactory) | 253 | sv := layout.NewStackedView(mockFactory) | ||
| 246 | - | sv.AddPane("Page 1", "", containers[0]) | 254 | + | sv.AddPane(ctx, "Page 1", "", containers[0]) |
| 247 | - | sv.AddPane("Page 2", "", containers[1]) | 255 | + | sv.AddPane(ctx, "Page 2", "", containers[1]) |
| 248 | 256 | ||||
| 249 | // Act - switch back to first pane | 257 | // Act - switch back to first pane | ||
| 250 | - | err := sv.SetActive(0) | 258 | + | err := sv.SetActive(ctx, 0) |
| 251 | 259 | ||||
| 252 | // Assert | 260 | // Assert | ||
| 253 | require.NoError(t, err) | 261 | require.NoError(t, err) | ||
| @@ -256,6 +264,7 @@ func TestSetActive_ValidIndex(t *testing.T) { | |||||
| 256 | 264 | ||||
| 257 | func TestSetActive_OutOfBounds(t *testing.T) { | 265 | func TestSetActive_OutOfBounds(t *testing.T) { | ||
| 258 | // Arrange | 266 | // Arrange | ||
| 267 | + | ctx := context.Background() | |||
| 259 | mockFactory, mockBox := setupMockFactory(t) | 268 | mockFactory, mockBox := setupMockFactory(t) | ||
| 260 | mockTitleBar, _, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | 269 | mockTitleBar, _, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | ||
| 261 | 270 | ||||
| @@ -264,10 +273,10 @@ func TestSetActive_OutOfBounds(t *testing.T) { | |||||
| 264 | mockTitleBar.EXPECT().AddCssClass("active").Once() | 273 | mockTitleBar.EXPECT().AddCssClass("active").Once() | ||
| 265 | 274 | ||||
| 266 | sv := layout.NewStackedView(mockFactory) | 275 | sv := layout.NewStackedView(mockFactory) | ||
| 267 | - | sv.AddPane("Page", "", mockContainer) | 276 | + | sv.AddPane(ctx, "Page", "", mockContainer) |
| 268 | 277 | ||||
| 269 | // Act | 278 | // Act | ||
| 270 | - | err := sv.SetActive(5) | 279 | + | err := sv.SetActive(ctx, 5) |
| 271 | 280 | ||||
| 272 | // Assert | 281 | // Assert | ||
| 273 | assert.ErrorIs(t, err, layout.ErrIndexOutOfBounds) | 282 | assert.ErrorIs(t, err, layout.ErrIndexOutOfBounds) | ||
| @@ -275,11 +284,12 @@ func TestSetActive_OutOfBounds(t *testing.T) { | |||||
| 275 | 284 | ||||
| 276 | func TestSetActive_EmptyStack(t *testing.T) { | 285 | func TestSetActive_EmptyStack(t *testing.T) { | ||
| 277 | // Arrange | 286 | // Arrange | ||
| 287 | + | ctx := context.Background() | |||
| 278 | mockFactory, _ := setupMockFactory(t) | 288 | mockFactory, _ := setupMockFactory(t) | ||
| 279 | sv := layout.NewStackedView(mockFactory) | 289 | sv := layout.NewStackedView(mockFactory) | ||
| 280 | 290 | ||||
| 281 | // Act | 291 | // Act | ||
| 282 | - | err := sv.SetActive(0) | 292 | + | err := sv.SetActive(ctx, 0) |
| 283 | 293 | ||||
| 284 | // Assert | 294 | // Assert | ||
| 285 | assert.ErrorIs(t, err, layout.ErrStackEmpty) | 295 | assert.ErrorIs(t, err, layout.ErrStackEmpty) | ||
| @@ -287,6 +297,7 @@ func TestSetActive_EmptyStack(t *testing.T) { | |||||
| 287 | 297 | ||||
| 288 | func TestUpdateTitle(t *testing.T) { | 298 | func TestUpdateTitle(t *testing.T) { | ||
| 289 | // Arrange | 299 | // Arrange | ||
| 300 | + | ctx := context.Background() | |||
| 290 | mockFactory, mockBox := setupMockFactory(t) | 301 | mockFactory, mockBox := setupMockFactory(t) | ||
| 291 | mockTitleBar, _, mockLabel, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | 302 | mockTitleBar, _, mockLabel, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | ||
| 292 | 303 | ||||
| @@ -295,7 +306,7 @@ func TestUpdateTitle(t *testing.T) { | |||||
| 295 | mockTitleBar.EXPECT().AddCssClass("active").Once() | 306 | mockTitleBar.EXPECT().AddCssClass("active").Once() | ||
| 296 | 307 | ||||
| 297 | sv := layout.NewStackedView(mockFactory) | 308 | sv := layout.NewStackedView(mockFactory) | ||
| 298 | - | sv.AddPane("Old Title", "", mockContainer) | 309 | + | sv.AddPane(ctx, "Old Title", "", mockContainer) |
| 299 | 310 | ||||
| 300 | mockLabel.EXPECT().SetText("New Title").Once() | 311 | mockLabel.EXPECT().SetText("New Title").Once() | ||
| 301 | 312 | ||||
| @@ -320,6 +331,7 @@ func TestUpdateTitle_InvalidIndex(t *testing.T) { | |||||
| 320 | 331 | ||||
| 321 | func TestUpdateFavicon(t *testing.T) { | 332 | func TestUpdateFavicon(t *testing.T) { | ||
| 322 | // Arrange | 333 | // Arrange | ||
| 334 | + | ctx := context.Background() | |||
| 323 | mockFactory, mockBox := setupMockFactory(t) | 335 | mockFactory, mockBox := setupMockFactory(t) | ||
| 324 | mockTitleBar, mockFavicon, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | 336 | mockTitleBar, mockFavicon, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | ||
| 325 | 337 | ||||
| @@ -328,7 +340,7 @@ func TestUpdateFavicon(t *testing.T) { | |||||
| 328 | mockTitleBar.EXPECT().AddCssClass("active").Once() | 340 | mockTitleBar.EXPECT().AddCssClass("active").Once() | ||
| 329 | 341 | ||||
| 330 | sv := layout.NewStackedView(mockFactory) | 342 | sv := layout.NewStackedView(mockFactory) | ||
| 331 | - | sv.AddPane("Page", "", mockContainer) | 343 | + | sv.AddPane(ctx, "Page", "", mockContainer) |
| 332 | 344 | ||||
| 333 | mockFavicon.EXPECT().SetFromIconName("new-icon").Once() | 345 | mockFavicon.EXPECT().SetFromIconName("new-icon").Once() | ||
| 334 | 346 | ||||
| @@ -341,6 +353,7 @@ func TestUpdateFavicon(t *testing.T) { | |||||
| 341 | 353 | ||||
| 342 | func TestGetContainer(t *testing.T) { | 354 | func TestGetContainer(t *testing.T) { | ||
| 343 | // Arrange | 355 | // Arrange | ||
| 356 | + | ctx := context.Background() | |||
| 344 | mockFactory, mockBox := setupMockFactory(t) | 357 | mockFactory, mockBox := setupMockFactory(t) | ||
| 345 | mockTitleBar, _, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | 358 | mockTitleBar, _, _, _, mockContainer := setupPaneMocks(t, mockFactory, mockBox) | ||
| 346 | 359 | ||||
| @@ -349,7 +362,7 @@ func TestGetContainer(t *testing.T) { | |||||
| 349 | mockTitleBar.EXPECT().AddCssClass("active").Once() | 362 | mockTitleBar.EXPECT().AddCssClass("active").Once() | ||
| 350 | 363 | ||||
| 351 | sv := layout.NewStackedView(mockFactory) | 364 | sv := layout.NewStackedView(mockFactory) | ||
| 352 | - | sv.AddPane("Page", "", mockContainer) | 365 | + | sv.AddPane(ctx, "Page", "", mockContainer) |
| 353 | 366 | ||||
| 354 | // Act | 367 | // Act | ||
| 355 | container, err := sv.GetContainer(0) | 368 | container, err := sv.GetContainer(0) | ||
| @@ -386,6 +399,7 @@ func TestWidget_ReturnsBoxWidget(t *testing.T) { | |||||
| 386 | 399 | ||||
| 387 | func TestNavigateNext_WrapsAround(t *testing.T) { | 400 | func TestNavigateNext_WrapsAround(t *testing.T) { | ||
| 388 | // Arrange | 401 | // Arrange | ||
| 402 | + | ctx := context.Background() | |||
| 389 | mockFactory, mockBox := setupMockFactory(t) | 403 | mockFactory, mockBox := setupMockFactory(t) | ||
| 390 | 404 | ||||
| 391 | containers := make([]*mocks.MockWidget, 2) | 405 | containers := make([]*mocks.MockWidget, 2) | ||
| @@ -400,14 +414,14 @@ func TestNavigateNext_WrapsAround(t *testing.T) { | |||||
| 400 | } | 414 | } | ||
| 401 | 415 | ||||
| 402 | sv := layout.NewStackedView(mockFactory) | 416 | sv := layout.NewStackedView(mockFactory) | ||
| 403 | - | sv.AddPane("Page 1", "", containers[0]) | 417 | + | sv.AddPane(ctx, "Page 1", "", containers[0]) |
| 404 | - | sv.AddPane("Page 2", "", containers[1]) | 418 | + | sv.AddPane(ctx, "Page 2", "", containers[1]) |
| 405 | 419 | ||||
| 406 | // Currently at index 1 (last added) | 420 | // Currently at index 1 (last added) | ||
| 407 | assert.Equal(t, 1, sv.ActiveIndex()) | 421 | assert.Equal(t, 1, sv.ActiveIndex()) | ||
| 408 | 422 | ||||
| 409 | // Act - navigate next should wrap to 0 | 423 | // Act - navigate next should wrap to 0 | ||
| 410 | - | err := sv.NavigateNext() | 424 | + | err := sv.NavigateNext(ctx) |
| 411 | 425 | ||||
| 412 | // Assert | 426 | // Assert | ||
| 413 | require.NoError(t, err) | 427 | require.NoError(t, err) | ||
| @@ -416,6 +430,7 @@ func TestNavigateNext_WrapsAround(t *testing.T) { | |||||
| 416 | 430 | ||||
| 417 | func TestNavigatePrevious_WrapsAround(t *testing.T) { | 431 | func TestNavigatePrevious_WrapsAround(t *testing.T) { | ||
| 418 | // Arrange | 432 | // Arrange | ||
| 433 | + | ctx := context.Background() | |||
| 419 | mockFactory, mockBox := setupMockFactory(t) | 434 | mockFactory, mockBox := setupMockFactory(t) | ||
| 420 | 435 | ||||
| 421 | containers := make([]*mocks.MockWidget, 2) | 436 | containers := make([]*mocks.MockWidget, 2) | ||
| @@ -430,14 +445,14 @@ func TestNavigatePrevious_WrapsAround(t *testing.T) { | |||||
| 430 | } | 445 | } | ||
| 431 | 446 | ||||
| 432 | sv := layout.NewStackedView(mockFactory) | 447 | sv := layout.NewStackedView(mockFactory) | ||
| 433 | - | sv.AddPane("Page 1", "", containers[0]) | 448 | + | sv.AddPane(ctx, "Page 1", "", containers[0]) |
| 434 | - | sv.AddPane("Page 2", "", containers[1]) | 449 | + | sv.AddPane(ctx, "Page 2", "", containers[1]) |
| 435 | 450 | ||||
| 436 | // Set to first pane | 451 | // Set to first pane | ||
| 437 | - | sv.SetActive(0) | 452 | + | sv.SetActive(ctx, 0) |
| 438 | 453 | ||||
| 439 | // Act - navigate previous should wrap to 1 | 454 | // Act - navigate previous should wrap to 1 | ||
| 440 | - | err := sv.NavigatePrevious() | 455 | + | err := sv.NavigatePrevious(ctx) |
| 441 | 456 | ||||
| 442 | // Assert | 457 | // Assert | ||
| 443 | require.NoError(t, err) | 458 | require.NoError(t, err) | ||
| @@ -446,11 +461,12 @@ func TestNavigatePrevious_WrapsAround(t *testing.T) { | |||||
| 446 | 461 | ||||
| 447 | func TestNavigateNext_EmptyStack(t *testing.T) { | 462 | func TestNavigateNext_EmptyStack(t *testing.T) { | ||
| 448 | // Arrange | 463 | // Arrange | ||
| 464 | + | ctx := context.Background() | |||
| 449 | mockFactory, _ := setupMockFactory(t) | 465 | mockFactory, _ := setupMockFactory(t) | ||
| 450 | sv := layout.NewStackedView(mockFactory) | 466 | sv := layout.NewStackedView(mockFactory) | ||
| 451 | 467 | ||||
| 452 | // Act | 468 | // Act | ||
| 453 | - | err := sv.NavigateNext() | 469 | + | err := sv.NavigateNext(ctx) |
| 454 | 470 | ||||
| 455 | // Assert | 471 | // Assert | ||
| 456 | assert.ErrorIs(t, err, layout.ErrStackEmpty) | 472 | assert.ErrorIs(t, err, layout.ErrStackEmpty) | ||
| @@ -458,11 +474,12 @@ func TestNavigateNext_EmptyStack(t *testing.T) { | |||||
| 458 | 474 | ||||
| 459 | func TestNavigatePrevious_EmptyStack(t *testing.T) { | 475 | func TestNavigatePrevious_EmptyStack(t *testing.T) { | ||
| 460 | // Arrange | 476 | // Arrange | ||
| 477 | + | ctx := context.Background() | |||
| 461 | mockFactory, _ := setupMockFactory(t) | 478 | mockFactory, _ := setupMockFactory(t) | ||
| 462 | sv := layout.NewStackedView(mockFactory) | 479 | sv := layout.NewStackedView(mockFactory) | ||
| 463 | 480 | ||||
| 464 | // Act | 481 | // Act | ||
| 465 | - | err := sv.NavigatePrevious() | 482 | + | err := sv.NavigatePrevious(ctx) |
| 466 | 483 | ||||
| 467 | // Assert | 484 | // Assert | ||
| 468 | assert.ErrorIs(t, err, layout.ErrStackEmpty) | 485 | assert.ErrorIs(t, err, layout.ErrStackEmpty) | ||
M internal/ui/layout/tree_test.go +50 -33
| @@ -1,9 +1,9 @@ | |||
| 1 | 1 | package layout_test | |
| 2 | 2 | ||
| 3 | 3 | import ( | |
| 4 | + | "context" | |
| 4 | 5 | "testing" | |
| 5 | 6 | ||
| 6 | - | "github.com/rs/zerolog" | |
| 7 | 7 | "github.com/stretchr/testify/assert" | |
| 8 | 8 | "github.com/stretchr/testify/mock" | |
| 9 | 9 | "github.com/stretchr/testify/require" | |
| @@ -15,11 +15,12 @@ import ( | |||
| 15 | 15 | ||
| 16 | 16 | func TestNewTreeRenderer_CreatesRenderer(t *testing.T) { | |
| 17 | 17 | // Arrange | |
| 18 | + | ctx := context.Background() | |
| 18 | 19 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 19 | 20 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | |
| 20 | 21 | ||
| 21 | 22 | // Act | |
| 22 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | |
| 23 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) | |
| 23 | 24 | ||
| 24 | 25 | // Assert | |
| 25 | 26 | require.NotNil(t, renderer) | |
| @@ -28,13 +29,14 @@ func TestNewTreeRenderer_CreatesRenderer(t *testing.T) { | |||
| 28 | 29 | ||
| 29 | 30 | func TestBuild_NilRoot_ReturnsError(t *testing.T) { | |
| 30 | 31 | // Arrange | |
| 32 | + | ctx := context.Background() | |
| 31 | 33 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 32 | 34 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | |
| 33 | 35 | ||
| 34 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | |
| 36 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) | |
| 35 | 37 | ||
| 36 | 38 | // Act | |
| 37 | - | widget, err := renderer.Build(nil) | |
| 39 | + | widget, err := renderer.Build(ctx, nil) | |
| 38 | 40 | ||
| 39 | 41 | // Assert | |
| 40 | 42 | assert.Nil(t, widget) | |
| @@ -43,6 +45,7 @@ func TestBuild_NilRoot_ReturnsError(t *testing.T) { | |||
| 43 | 45 | ||
| 44 | 46 | func TestBuild_SingleLeafPane(t *testing.T) { | |
| 45 | 47 | // Arrange | |
| 48 | + | ctx := context.Background() | |
| 46 | 49 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 47 | 50 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | |
| 48 | 51 | mockWidget := mocks.NewMockWidget(t) | |
| @@ -55,10 +58,10 @@ func TestBuild_SingleLeafPane(t *testing.T) { | |||
| 55 | 58 | ||
| 56 | 59 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | |
| 57 | 60 | ||
| 58 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | |
| 61 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) | |
| 59 | 62 | ||
| 60 | 63 | // Act | |
| 61 | - | widget, err := renderer.Build(node) | |
| 64 | + | widget, err := renderer.Build(ctx, node) | |
| 62 | 65 | ||
| 63 | 66 | // Assert | |
| 64 | 67 | require.NoError(t, err) | |
| @@ -71,6 +74,7 @@ func TestBuild_SingleLeafPane(t *testing.T) { | |||
| 71 | 74 | ||
| 72 | 75 | func TestBuild_HorizontalSplit(t *testing.T) { | |
| 73 | 76 | // Arrange | |
| 77 | + | ctx := context.Background() | |
| 74 | 78 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 75 | 79 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | |
| 76 | 80 | mockPaned := mocks.NewMockPanedWidget(t) | |
| @@ -105,10 +109,10 @@ func TestBuild_HorizontalSplit(t *testing.T) { | |||
| 105 | 109 | mockPaned.EXPECT().ConnectMap(mock.Anything).Return(uint32(0)).Once() | |
| 106 | 110 | mockPaned.EXPECT().AddTickCallback(mock.Anything).Return(uint(0)).Once() | |
| 107 | 111 | ||
| 108 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | |
| 112 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) | |
| 109 | 113 | ||
| 110 | 114 | // Act | |
| 111 | - | widget, err := renderer.Build(splitNode) | |
| 115 | + | widget, err := renderer.Build(ctx, splitNode) | |
| 112 | 116 | ||
| 113 | 117 | // Assert | |
| 114 | 118 | require.NoError(t, err) | |
| @@ -118,6 +122,7 @@ func TestBuild_HorizontalSplit(t *testing.T) { | |||
| 118 | 122 | ||
| 119 | 123 | func TestBuild_VerticalSplit(t *testing.T) { | |
| 120 | 124 | // Arrange | |
| 125 | + | ctx := context.Background() | |
| 121 | 126 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 122 | 127 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | |
| 123 | 128 | mockPaned := mocks.NewMockPanedWidget(t) | |
| @@ -152,10 +157,10 @@ func TestBuild_VerticalSplit(t *testing.T) { | |||
| 152 | 157 | mockPaned.EXPECT().ConnectMap(mock.Anything).Return(uint32(0)).Once() | |
| 153 | 158 | mockPaned.EXPECT().AddTickCallback(mock.Anything).Return(uint(0)).Once() | |
| 154 | 159 | ||
| 155 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | |
| 160 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) | |
| 156 | 161 | ||
| 157 | 162 | // Act | |
| 158 | - | widget, err := renderer.Build(splitNode) | |
| 163 | + | widget, err := renderer.Build(ctx, splitNode) | |
| 159 | 164 | ||
| 160 | 165 | // Assert | |
| 161 | 166 | require.NoError(t, err) | |
| @@ -164,6 +169,7 @@ func TestBuild_VerticalSplit(t *testing.T) { | |||
| 164 | 169 | ||
| 165 | 170 | func TestBuild_NestedSplits(t *testing.T) { | |
| 166 | 171 | // Arrange | |
| 172 | + | ctx := context.Background() | |
| 167 | 173 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 168 | 174 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | |
| 169 | 175 | mockOuterPaned := mocks.NewMockPanedWidget(t) | |
| @@ -230,10 +236,10 @@ func TestBuild_NestedSplits(t *testing.T) { | |||
| 230 | 236 | mockOuterPaned.EXPECT().ConnectMap(mock.Anything).Return(uint32(0)).Once() | |
| 231 | 237 | mockOuterPaned.EXPECT().AddTickCallback(mock.Anything).Return(uint(0)).Once() | |
| 232 | 238 | ||
| 233 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | |
| 239 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) | |
| 234 | 240 | ||
| 235 | 241 | // Act | |
| 236 | - | widget, err := renderer.Build(outerSplit) | |
| 242 | + | widget, err := renderer.Build(ctx, outerSplit) | |
| 237 | 243 | ||
| 238 | 244 | // Assert | |
| 239 | 245 | require.NoError(t, err) | |
| @@ -248,6 +254,7 @@ func TestBuild_NestedSplits(t *testing.T) { | |||
| 248 | 254 | ||
| 249 | 255 | func TestLookup_ExistingNode(t *testing.T) { | |
| 250 | 256 | // Arrange | |
| 257 | + | ctx := context.Background() | |
| 251 | 258 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 252 | 259 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | |
| 253 | 260 | mockWidget := mocks.NewMockWidget(t) | |
| @@ -257,8 +264,8 @@ func TestLookup_ExistingNode(t *testing.T) { | |||
| 257 | 264 | ||
| 258 | 265 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | |
| 259 | 266 | ||
| 260 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | |
| 261 | - | _, _ = renderer.Build(node) | |
| 267 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) | |
| 268 | + | _, _ = renderer.Build(ctx, node) | |
| 262 | 269 | ||
| 263 | 270 | // Act | |
| 264 | 271 | result := renderer.Lookup("test-node-id") | |
| @@ -269,6 +276,7 @@ func TestLookup_ExistingNode(t *testing.T) { | |||
| 269 | 276 | ||
| 270 | 277 | func TestLookup_NonExistentNode(t *testing.T) { | |
| 271 | 278 | // Arrange | |
| 279 | + | ctx := context.Background() | |
| 272 | 280 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 273 | 281 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | |
| 274 | 282 | mockWidget := mocks.NewMockWidget(t) | |
| @@ -278,8 +286,8 @@ func TestLookup_NonExistentNode(t *testing.T) { | |||
| 278 | 286 | ||
| 279 | 287 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | |
| 280 | 288 | ||
| 281 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | |
| 282 | - | _, _ = renderer.Build(node) | |
| 289 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) | |
| 290 | + | _, _ = renderer.Build(ctx, node) | |
| 283 | 291 | ||
| 284 | 292 | // Act | |
| 285 | 293 | result := renderer.Lookup("non-existent-id") | |
| @@ -290,6 +298,7 @@ func TestLookup_NonExistentNode(t *testing.T) { | |||
| 290 | 298 | ||
| 291 | 299 | func TestLookupNode_Existing(t *testing.T) { | |
| 292 | 300 | // Arrange | |
| 301 | + | ctx := context.Background() | |
| 293 | 302 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 294 | 303 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | |
| 295 | 304 | mockWidget := mocks.NewMockWidget(t) | |
| @@ -299,8 +308,8 @@ func TestLookupNode_Existing(t *testing.T) { | |||
| 299 | 308 | ||
| 300 | 309 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | |
| 301 | 310 | ||
| 302 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | |
| 303 | - | _, _ = renderer.Build(node) | |
| 311 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) | |
| 312 | + | _, _ = renderer.Build(ctx, node) | |
| 304 | 313 | ||
| 305 | 314 | // Act | |
| 306 | 315 | widget, found := renderer.LookupNode("node-1") | |
| @@ -312,10 +321,11 @@ func TestLookupNode_Existing(t *testing.T) { | |||
| 312 | 321 | ||
| 313 | 322 | func TestLookupNode_NonExistent(t *testing.T) { | |
| 314 | 323 | // Arrange | |
| 324 | + | ctx := context.Background() | |
| 315 | 325 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 316 | 326 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | |
| 317 | 327 | ||
| 318 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | |
| 328 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) | |
| 319 | 329 | ||
| 320 | 330 | // Act | |
| 321 | 331 | widget, found := renderer.LookupNode("non-existent") | |
| @@ -327,6 +337,7 @@ func TestLookupNode_NonExistent(t *testing.T) { | |||
| 327 | 337 | ||
| 328 | 338 | func TestClear_RemovesAllMappings(t *testing.T) { | |
| 329 | 339 | // Arrange | |
| 340 | + | ctx := context.Background() | |
| 330 | 341 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 331 | 342 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | |
| 332 | 343 | mockWidget := mocks.NewMockWidget(t) | |
| @@ -336,8 +347,8 @@ func TestClear_RemovesAllMappings(t *testing.T) { | |||
| 336 | 347 | ||
| 337 | 348 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | |
| 338 | 349 | ||
| 339 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | |
| 340 | - | _, _ = renderer.Build(node) | |
| 350 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) | |
| 351 | + | _, _ = renderer.Build(ctx, node) | |
| 341 | 352 | ||
| 342 | 353 | require.Equal(t, 1, renderer.NodeCount()) | |
| 343 | 354 | ||
| @@ -352,6 +363,7 @@ func TestClear_RemovesAllMappings(t *testing.T) { | |||
| 352 | 363 | func TestGetNodeIDs_ReturnsAllIDs(t *testing.T) { | |
| 353 | 364 | // Arrange | |
| 354 | 365 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 366 | + | ctx := context.Background() | |
| 355 | 367 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | |
| 356 | 368 | mockPaned := mocks.NewMockPanedWidget(t) | |
| 357 | 369 | mockWidget1 := mocks.NewMockWidget(t) | |
| @@ -384,8 +396,8 @@ func TestGetNodeIDs_ReturnsAllIDs(t *testing.T) { | |||
| 384 | 396 | mockPaned.EXPECT().ConnectMap(mock.Anything).Return(uint32(0)).Once() | |
| 385 | 397 | mockPaned.EXPECT().AddTickCallback(mock.Anything).Return(uint(0)).Once() | |
| 386 | 398 | ||
| 387 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | |
| 388 | - | _, _ = renderer.Build(splitNode) | |
| 399 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) | |
| 400 | + | _, _ = renderer.Build(ctx, splitNode) | |
| 389 | 401 | ||
| 390 | 402 | // Act | |
| 391 | 403 | ids := renderer.GetNodeIDs() | |
| @@ -399,6 +411,7 @@ func TestGetNodeIDs_ReturnsAllIDs(t *testing.T) { | |||
| 399 | 411 | ||
| 400 | 412 | func TestBuild_ClearsPreviousMappings(t *testing.T) { | |
| 401 | 413 | // Arrange | |
| 414 | + | ctx := context.Background() | |
| 402 | 415 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 403 | 416 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | |
| 404 | 417 | mockWidget1 := mocks.NewMockWidget(t) | |
| @@ -413,15 +426,15 @@ func TestBuild_ClearsPreviousMappings(t *testing.T) { | |||
| 413 | 426 | mockPaneViewFactory.EXPECT().CreatePaneView(node1).Return(mockWidget1).Once() | |
| 414 | 427 | mockPaneViewFactory.EXPECT().CreatePaneView(node2).Return(mockWidget2).Once() | |
| 415 | 428 | ||
| 416 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | |
| 429 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) | |
| 417 | 430 | ||
| 418 | 431 | // First build | |
| 419 | - | _, _ = renderer.Build(node1) | |
| 432 | + | _, _ = renderer.Build(ctx, node1) | |
| 420 | 433 | require.Equal(t, 1, renderer.NodeCount()) | |
| 421 | 434 | require.NotNil(t, renderer.Lookup("old-node")) | |
| 422 | 435 | ||
| 423 | 436 | // Act - second build should clear old mappings | |
| 424 | - | _, _ = renderer.Build(node2) | |
| 437 | + | _, _ = renderer.Build(ctx, node2) | |
| 425 | 438 | ||
| 426 | 439 | // Assert | |
| 427 | 440 | assert.Equal(t, 1, renderer.NodeCount()) | |
| @@ -431,15 +444,16 @@ func TestBuild_ClearsPreviousMappings(t *testing.T) { | |||
| 431 | 444 | ||
| 432 | 445 | func TestBuild_NilPaneViewFactory_ReturnsNilForLeaves(t *testing.T) { | |
| 433 | 446 | // Arrange | |
| 447 | + | ctx := context.Background() | |
| 434 | 448 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 435 | 449 | ||
| 436 | 450 | pane := entity.NewPane(entity.PaneID("pane-1")) | |
| 437 | 451 | node := &entity.PaneNode{ID: "node-1", Pane: pane} | |
| 438 | 452 | ||
| 439 | - | renderer := layout.NewTreeRenderer(mockFactory, nil, zerolog.Nop()) | |
| 453 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, nil) | |
| 440 | 454 | ||
| 441 | 455 | // Act | |
| 442 | - | widget, err := renderer.Build(node) | |
| 456 | + | widget, err := renderer.Build(ctx, node) | |
| 443 | 457 | ||
| 444 | 458 | // Assert | |
| 445 | 459 | require.NoError(t, err) | |
| @@ -448,6 +462,7 @@ func TestBuild_NilPaneViewFactory_ReturnsNilForLeaves(t *testing.T) { | |||
| 448 | 462 | ||
| 449 | 463 | func TestBuild_EmptyNodeID_NotStored(t *testing.T) { | |
| 450 | 464 | // Arrange | |
| 465 | + | ctx := context.Background() | |
| 451 | 466 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 452 | 467 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | |
| 453 | 468 | mockWidget := mocks.NewMockWidget(t) | |
| @@ -457,10 +472,10 @@ func TestBuild_EmptyNodeID_NotStored(t *testing.T) { | |||
| 457 | 472 | ||
| 458 | 473 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | |
| 459 | 474 | ||
| 460 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | |
| 475 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) | |
| 461 | 476 | ||
| 462 | 477 | // Act | |
| 463 | - | widget, err := renderer.Build(node) | |
| 478 | + | widget, err := renderer.Build(ctx, node) | |
| 464 | 479 | ||
| 465 | 480 | // Assert | |
| 466 | 481 | require.NoError(t, err) | |
| @@ -471,6 +486,7 @@ func TestBuild_EmptyNodeID_NotStored(t *testing.T) { | |||
| 471 | 486 | func TestUpdateSplitRatio_ExistingNode(t *testing.T) { | |
| 472 | 487 | // Arrange | |
| 473 | 488 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 489 | + | ctx := context.Background() | |
| 474 | 490 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | |
| 475 | 491 | mockPaned := mocks.NewMockPanedWidget(t) | |
| 476 | 492 | mockWidget1 := mocks.NewMockWidget(t) | |
| @@ -503,8 +519,8 @@ func TestUpdateSplitRatio_ExistingNode(t *testing.T) { | |||
| 503 | 519 | mockPaned.EXPECT().ConnectMap(mock.Anything).Return(uint32(0)).Once() | |
| 504 | 520 | mockPaned.EXPECT().AddTickCallback(mock.Anything).Return(uint(0)).Once() | |
| 505 | 521 | ||
| 506 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | |
| 507 | - | _, _ = renderer.Build(splitNode) | |
| 522 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) | |
| 523 | + | _, _ = renderer.Build(ctx, splitNode) | |
| 508 | 524 | ||
| 509 | 525 | // Act | |
| 510 | 526 | err := renderer.UpdateSplitRatio("split-node", 0.7) | |
| @@ -516,9 +532,10 @@ func TestUpdateSplitRatio_ExistingNode(t *testing.T) { | |||
| 516 | 532 | func TestUpdateSplitRatio_NonExistentNode(t *testing.T) { | |
| 517 | 533 | // Arrange | |
| 518 | 534 | mockFactory := mocks.NewMockWidgetFactory(t) | |
| 535 | + | ctx := context.Background() | |
| 519 | 536 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | |
| 520 | 537 | ||
| 521 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | |
| 538 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) | |
| 522 | 539 | ||
| 523 | 540 | // Act | |
| 524 | 541 | err := renderer.UpdateSplitRatio("non-existent", 0.7) | |
| @@ -1,9 +1,9 @@ | |||||
| 1 | package layout_test | 1 | package layout_test | ||
| 2 | 2 | ||||
| 3 | import ( | 3 | import ( | ||
| 4 | + | "context" | |||
| 4 | "testing" | 5 | "testing" | ||
| 5 | 6 | ||||
| 6 | - | "github.com/rs/zerolog" | |||
| 7 | "github.com/stretchr/testify/assert" | 7 | "github.com/stretchr/testify/assert" | ||
| 8 | "github.com/stretchr/testify/mock" | 8 | "github.com/stretchr/testify/mock" | ||
| 9 | "github.com/stretchr/testify/require" | 9 | "github.com/stretchr/testify/require" | ||
| @@ -15,11 +15,12 @@ import ( | |||||
| 15 | 15 | ||||
| 16 | func TestNewTreeRenderer_CreatesRenderer(t *testing.T) { | 16 | func TestNewTreeRenderer_CreatesRenderer(t *testing.T) { | ||
| 17 | // Arrange | 17 | // Arrange | ||
| 18 | + | ctx := context.Background() | |||
| 18 | mockFactory := mocks.NewMockWidgetFactory(t) | 19 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 19 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | 20 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | ||
| 20 | 21 | ||||
| 21 | // Act | 22 | // Act | ||
| 22 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | 23 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) |
| 23 | 24 | ||||
| 24 | // Assert | 25 | // Assert | ||
| 25 | require.NotNil(t, renderer) | 26 | require.NotNil(t, renderer) | ||
| @@ -28,13 +29,14 @@ func TestNewTreeRenderer_CreatesRenderer(t *testing.T) { | |||||
| 28 | 29 | ||||
| 29 | func TestBuild_NilRoot_ReturnsError(t *testing.T) { | 30 | func TestBuild_NilRoot_ReturnsError(t *testing.T) { | ||
| 30 | // Arrange | 31 | // Arrange | ||
| 32 | + | ctx := context.Background() | |||
| 31 | mockFactory := mocks.NewMockWidgetFactory(t) | 33 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 32 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | 34 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | ||
| 33 | 35 | ||||
| 34 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | 36 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) |
| 35 | 37 | ||||
| 36 | // Act | 38 | // Act | ||
| 37 | - | widget, err := renderer.Build(nil) | 39 | + | widget, err := renderer.Build(ctx, nil) |
| 38 | 40 | ||||
| 39 | // Assert | 41 | // Assert | ||
| 40 | assert.Nil(t, widget) | 42 | assert.Nil(t, widget) | ||
| @@ -43,6 +45,7 @@ func TestBuild_NilRoot_ReturnsError(t *testing.T) { | |||||
| 43 | 45 | ||||
| 44 | func TestBuild_SingleLeafPane(t *testing.T) { | 46 | func TestBuild_SingleLeafPane(t *testing.T) { | ||
| 45 | // Arrange | 47 | // Arrange | ||
| 48 | + | ctx := context.Background() | |||
| 46 | mockFactory := mocks.NewMockWidgetFactory(t) | 49 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 47 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | 50 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | ||
| 48 | mockWidget := mocks.NewMockWidget(t) | 51 | mockWidget := mocks.NewMockWidget(t) | ||
| @@ -55,10 +58,10 @@ func TestBuild_SingleLeafPane(t *testing.T) { | |||||
| 55 | 58 | ||||
| 56 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | 59 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | ||
| 57 | 60 | ||||
| 58 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | 61 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) |
| 59 | 62 | ||||
| 60 | // Act | 63 | // Act | ||
| 61 | - | widget, err := renderer.Build(node) | 64 | + | widget, err := renderer.Build(ctx, node) |
| 62 | 65 | ||||
| 63 | // Assert | 66 | // Assert | ||
| 64 | require.NoError(t, err) | 67 | require.NoError(t, err) | ||
| @@ -71,6 +74,7 @@ func TestBuild_SingleLeafPane(t *testing.T) { | |||||
| 71 | 74 | ||||
| 72 | func TestBuild_HorizontalSplit(t *testing.T) { | 75 | func TestBuild_HorizontalSplit(t *testing.T) { | ||
| 73 | // Arrange | 76 | // Arrange | ||
| 77 | + | ctx := context.Background() | |||
| 74 | mockFactory := mocks.NewMockWidgetFactory(t) | 78 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 75 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | 79 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | ||
| 76 | mockPaned := mocks.NewMockPanedWidget(t) | 80 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| @@ -105,10 +109,10 @@ func TestBuild_HorizontalSplit(t *testing.T) { | |||||
| 105 | mockPaned.EXPECT().ConnectMap(mock.Anything).Return(uint32(0)).Once() | 109 | mockPaned.EXPECT().ConnectMap(mock.Anything).Return(uint32(0)).Once() | ||
| 106 | mockPaned.EXPECT().AddTickCallback(mock.Anything).Return(uint(0)).Once() | 110 | mockPaned.EXPECT().AddTickCallback(mock.Anything).Return(uint(0)).Once() | ||
| 107 | 111 | ||||
| 108 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | 112 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) |
| 109 | 113 | ||||
| 110 | // Act | 114 | // Act | ||
| 111 | - | widget, err := renderer.Build(splitNode) | 115 | + | widget, err := renderer.Build(ctx, splitNode) |
| 112 | 116 | ||||
| 113 | // Assert | 117 | // Assert | ||
| 114 | require.NoError(t, err) | 118 | require.NoError(t, err) | ||
| @@ -118,6 +122,7 @@ func TestBuild_HorizontalSplit(t *testing.T) { | |||||
| 118 | 122 | ||||
| 119 | func TestBuild_VerticalSplit(t *testing.T) { | 123 | func TestBuild_VerticalSplit(t *testing.T) { | ||
| 120 | // Arrange | 124 | // Arrange | ||
| 125 | + | ctx := context.Background() | |||
| 121 | mockFactory := mocks.NewMockWidgetFactory(t) | 126 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 122 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | 127 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | ||
| 123 | mockPaned := mocks.NewMockPanedWidget(t) | 128 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| @@ -152,10 +157,10 @@ func TestBuild_VerticalSplit(t *testing.T) { | |||||
| 152 | mockPaned.EXPECT().ConnectMap(mock.Anything).Return(uint32(0)).Once() | 157 | mockPaned.EXPECT().ConnectMap(mock.Anything).Return(uint32(0)).Once() | ||
| 153 | mockPaned.EXPECT().AddTickCallback(mock.Anything).Return(uint(0)).Once() | 158 | mockPaned.EXPECT().AddTickCallback(mock.Anything).Return(uint(0)).Once() | ||
| 154 | 159 | ||||
| 155 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | 160 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) |
| 156 | 161 | ||||
| 157 | // Act | 162 | // Act | ||
| 158 | - | widget, err := renderer.Build(splitNode) | 163 | + | widget, err := renderer.Build(ctx, splitNode) |
| 159 | 164 | ||||
| 160 | // Assert | 165 | // Assert | ||
| 161 | require.NoError(t, err) | 166 | require.NoError(t, err) | ||
| @@ -164,6 +169,7 @@ func TestBuild_VerticalSplit(t *testing.T) { | |||||
| 164 | 169 | ||||
| 165 | func TestBuild_NestedSplits(t *testing.T) { | 170 | func TestBuild_NestedSplits(t *testing.T) { | ||
| 166 | // Arrange | 171 | // Arrange | ||
| 172 | + | ctx := context.Background() | |||
| 167 | mockFactory := mocks.NewMockWidgetFactory(t) | 173 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 168 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | 174 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | ||
| 169 | mockOuterPaned := mocks.NewMockPanedWidget(t) | 175 | mockOuterPaned := mocks.NewMockPanedWidget(t) | ||
| @@ -230,10 +236,10 @@ func TestBuild_NestedSplits(t *testing.T) { | |||||
| 230 | mockOuterPaned.EXPECT().ConnectMap(mock.Anything).Return(uint32(0)).Once() | 236 | mockOuterPaned.EXPECT().ConnectMap(mock.Anything).Return(uint32(0)).Once() | ||
| 231 | mockOuterPaned.EXPECT().AddTickCallback(mock.Anything).Return(uint(0)).Once() | 237 | mockOuterPaned.EXPECT().AddTickCallback(mock.Anything).Return(uint(0)).Once() | ||
| 232 | 238 | ||||
| 233 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | 239 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) |
| 234 | 240 | ||||
| 235 | // Act | 241 | // Act | ||
| 236 | - | widget, err := renderer.Build(outerSplit) | 242 | + | widget, err := renderer.Build(ctx, outerSplit) |
| 237 | 243 | ||||
| 238 | // Assert | 244 | // Assert | ||
| 239 | require.NoError(t, err) | 245 | require.NoError(t, err) | ||
| @@ -248,6 +254,7 @@ func TestBuild_NestedSplits(t *testing.T) { | |||||
| 248 | 254 | ||||
| 249 | func TestLookup_ExistingNode(t *testing.T) { | 255 | func TestLookup_ExistingNode(t *testing.T) { | ||
| 250 | // Arrange | 256 | // Arrange | ||
| 257 | + | ctx := context.Background() | |||
| 251 | mockFactory := mocks.NewMockWidgetFactory(t) | 258 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 252 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | 259 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | ||
| 253 | mockWidget := mocks.NewMockWidget(t) | 260 | mockWidget := mocks.NewMockWidget(t) | ||
| @@ -257,8 +264,8 @@ func TestLookup_ExistingNode(t *testing.T) { | |||||
| 257 | 264 | ||||
| 258 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | 265 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | ||
| 259 | 266 | ||||
| 260 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | 267 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) |
| 261 | - | _, _ = renderer.Build(node) | 268 | + | _, _ = renderer.Build(ctx, node) |
| 262 | 269 | ||||
| 263 | // Act | 270 | // Act | ||
| 264 | result := renderer.Lookup("test-node-id") | 271 | result := renderer.Lookup("test-node-id") | ||
| @@ -269,6 +276,7 @@ func TestLookup_ExistingNode(t *testing.T) { | |||||
| 269 | 276 | ||||
| 270 | func TestLookup_NonExistentNode(t *testing.T) { | 277 | func TestLookup_NonExistentNode(t *testing.T) { | ||
| 271 | // Arrange | 278 | // Arrange | ||
| 279 | + | ctx := context.Background() | |||
| 272 | mockFactory := mocks.NewMockWidgetFactory(t) | 280 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 273 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | 281 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | ||
| 274 | mockWidget := mocks.NewMockWidget(t) | 282 | mockWidget := mocks.NewMockWidget(t) | ||
| @@ -278,8 +286,8 @@ func TestLookup_NonExistentNode(t *testing.T) { | |||||
| 278 | 286 | ||||
| 279 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | 287 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | ||
| 280 | 288 | ||||
| 281 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | 289 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) |
| 282 | - | _, _ = renderer.Build(node) | 290 | + | _, _ = renderer.Build(ctx, node) |
| 283 | 291 | ||||
| 284 | // Act | 292 | // Act | ||
| 285 | result := renderer.Lookup("non-existent-id") | 293 | result := renderer.Lookup("non-existent-id") | ||
| @@ -290,6 +298,7 @@ func TestLookup_NonExistentNode(t *testing.T) { | |||||
| 290 | 298 | ||||
| 291 | func TestLookupNode_Existing(t *testing.T) { | 299 | func TestLookupNode_Existing(t *testing.T) { | ||
| 292 | // Arrange | 300 | // Arrange | ||
| 301 | + | ctx := context.Background() | |||
| 293 | mockFactory := mocks.NewMockWidgetFactory(t) | 302 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 294 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | 303 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | ||
| 295 | mockWidget := mocks.NewMockWidget(t) | 304 | mockWidget := mocks.NewMockWidget(t) | ||
| @@ -299,8 +308,8 @@ func TestLookupNode_Existing(t *testing.T) { | |||||
| 299 | 308 | ||||
| 300 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | 309 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | ||
| 301 | 310 | ||||
| 302 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | 311 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) |
| 303 | - | _, _ = renderer.Build(node) | 312 | + | _, _ = renderer.Build(ctx, node) |
| 304 | 313 | ||||
| 305 | // Act | 314 | // Act | ||
| 306 | widget, found := renderer.LookupNode("node-1") | 315 | widget, found := renderer.LookupNode("node-1") | ||
| @@ -312,10 +321,11 @@ func TestLookupNode_Existing(t *testing.T) { | |||||
| 312 | 321 | ||||
| 313 | func TestLookupNode_NonExistent(t *testing.T) { | 322 | func TestLookupNode_NonExistent(t *testing.T) { | ||
| 314 | // Arrange | 323 | // Arrange | ||
| 324 | + | ctx := context.Background() | |||
| 315 | mockFactory := mocks.NewMockWidgetFactory(t) | 325 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 316 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | 326 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | ||
| 317 | 327 | ||||
| 318 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | 328 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) |
| 319 | 329 | ||||
| 320 | // Act | 330 | // Act | ||
| 321 | widget, found := renderer.LookupNode("non-existent") | 331 | widget, found := renderer.LookupNode("non-existent") | ||
| @@ -327,6 +337,7 @@ func TestLookupNode_NonExistent(t *testing.T) { | |||||
| 327 | 337 | ||||
| 328 | func TestClear_RemovesAllMappings(t *testing.T) { | 338 | func TestClear_RemovesAllMappings(t *testing.T) { | ||
| 329 | // Arrange | 339 | // Arrange | ||
| 340 | + | ctx := context.Background() | |||
| 330 | mockFactory := mocks.NewMockWidgetFactory(t) | 341 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 331 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | 342 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | ||
| 332 | mockWidget := mocks.NewMockWidget(t) | 343 | mockWidget := mocks.NewMockWidget(t) | ||
| @@ -336,8 +347,8 @@ func TestClear_RemovesAllMappings(t *testing.T) { | |||||
| 336 | 347 | ||||
| 337 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | 348 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | ||
| 338 | 349 | ||||
| 339 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | 350 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) |
| 340 | - | _, _ = renderer.Build(node) | 351 | + | _, _ = renderer.Build(ctx, node) |
| 341 | 352 | ||||
| 342 | require.Equal(t, 1, renderer.NodeCount()) | 353 | require.Equal(t, 1, renderer.NodeCount()) | ||
| 343 | 354 | ||||
| @@ -352,6 +363,7 @@ func TestClear_RemovesAllMappings(t *testing.T) { | |||||
| 352 | func TestGetNodeIDs_ReturnsAllIDs(t *testing.T) { | 363 | func TestGetNodeIDs_ReturnsAllIDs(t *testing.T) { | ||
| 353 | // Arrange | 364 | // Arrange | ||
| 354 | mockFactory := mocks.NewMockWidgetFactory(t) | 365 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 366 | + | ctx := context.Background() | |||
| 355 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | 367 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | ||
| 356 | mockPaned := mocks.NewMockPanedWidget(t) | 368 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| 357 | mockWidget1 := mocks.NewMockWidget(t) | 369 | mockWidget1 := mocks.NewMockWidget(t) | ||
| @@ -384,8 +396,8 @@ func TestGetNodeIDs_ReturnsAllIDs(t *testing.T) { | |||||
| 384 | mockPaned.EXPECT().ConnectMap(mock.Anything).Return(uint32(0)).Once() | 396 | mockPaned.EXPECT().ConnectMap(mock.Anything).Return(uint32(0)).Once() | ||
| 385 | mockPaned.EXPECT().AddTickCallback(mock.Anything).Return(uint(0)).Once() | 397 | mockPaned.EXPECT().AddTickCallback(mock.Anything).Return(uint(0)).Once() | ||
| 386 | 398 | ||||
| 387 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | 399 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) |
| 388 | - | _, _ = renderer.Build(splitNode) | 400 | + | _, _ = renderer.Build(ctx, splitNode) |
| 389 | 401 | ||||
| 390 | // Act | 402 | // Act | ||
| 391 | ids := renderer.GetNodeIDs() | 403 | ids := renderer.GetNodeIDs() | ||
| @@ -399,6 +411,7 @@ func TestGetNodeIDs_ReturnsAllIDs(t *testing.T) { | |||||
| 399 | 411 | ||||
| 400 | func TestBuild_ClearsPreviousMappings(t *testing.T) { | 412 | func TestBuild_ClearsPreviousMappings(t *testing.T) { | ||
| 401 | // Arrange | 413 | // Arrange | ||
| 414 | + | ctx := context.Background() | |||
| 402 | mockFactory := mocks.NewMockWidgetFactory(t) | 415 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 403 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | 416 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | ||
| 404 | mockWidget1 := mocks.NewMockWidget(t) | 417 | mockWidget1 := mocks.NewMockWidget(t) | ||
| @@ -413,15 +426,15 @@ func TestBuild_ClearsPreviousMappings(t *testing.T) { | |||||
| 413 | mockPaneViewFactory.EXPECT().CreatePaneView(node1).Return(mockWidget1).Once() | 426 | mockPaneViewFactory.EXPECT().CreatePaneView(node1).Return(mockWidget1).Once() | ||
| 414 | mockPaneViewFactory.EXPECT().CreatePaneView(node2).Return(mockWidget2).Once() | 427 | mockPaneViewFactory.EXPECT().CreatePaneView(node2).Return(mockWidget2).Once() | ||
| 415 | 428 | ||||
| 416 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | 429 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) |
| 417 | 430 | ||||
| 418 | // First build | 431 | // First build | ||
| 419 | - | _, _ = renderer.Build(node1) | 432 | + | _, _ = renderer.Build(ctx, node1) |
| 420 | require.Equal(t, 1, renderer.NodeCount()) | 433 | require.Equal(t, 1, renderer.NodeCount()) | ||
| 421 | require.NotNil(t, renderer.Lookup("old-node")) | 434 | require.NotNil(t, renderer.Lookup("old-node")) | ||
| 422 | 435 | ||||
| 423 | // Act - second build should clear old mappings | 436 | // Act - second build should clear old mappings | ||
| 424 | - | _, _ = renderer.Build(node2) | 437 | + | _, _ = renderer.Build(ctx, node2) |
| 425 | 438 | ||||
| 426 | // Assert | 439 | // Assert | ||
| 427 | assert.Equal(t, 1, renderer.NodeCount()) | 440 | assert.Equal(t, 1, renderer.NodeCount()) | ||
| @@ -431,15 +444,16 @@ func TestBuild_ClearsPreviousMappings(t *testing.T) { | |||||
| 431 | 444 | ||||
| 432 | func TestBuild_NilPaneViewFactory_ReturnsNilForLeaves(t *testing.T) { | 445 | func TestBuild_NilPaneViewFactory_ReturnsNilForLeaves(t *testing.T) { | ||
| 433 | // Arrange | 446 | // Arrange | ||
| 447 | + | ctx := context.Background() | |||
| 434 | mockFactory := mocks.NewMockWidgetFactory(t) | 448 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 435 | 449 | ||||
| 436 | pane := entity.NewPane(entity.PaneID("pane-1")) | 450 | pane := entity.NewPane(entity.PaneID("pane-1")) | ||
| 437 | node := &entity.PaneNode{ID: "node-1", Pane: pane} | 451 | node := &entity.PaneNode{ID: "node-1", Pane: pane} | ||
| 438 | 452 | ||||
| 439 | - | renderer := layout.NewTreeRenderer(mockFactory, nil, zerolog.Nop()) | 453 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, nil) |
| 440 | 454 | ||||
| 441 | // Act | 455 | // Act | ||
| 442 | - | widget, err := renderer.Build(node) | 456 | + | widget, err := renderer.Build(ctx, node) |
| 443 | 457 | ||||
| 444 | // Assert | 458 | // Assert | ||
| 445 | require.NoError(t, err) | 459 | require.NoError(t, err) | ||
| @@ -448,6 +462,7 @@ func TestBuild_NilPaneViewFactory_ReturnsNilForLeaves(t *testing.T) { | |||||
| 448 | 462 | ||||
| 449 | func TestBuild_EmptyNodeID_NotStored(t *testing.T) { | 463 | func TestBuild_EmptyNodeID_NotStored(t *testing.T) { | ||
| 450 | // Arrange | 464 | // Arrange | ||
| 465 | + | ctx := context.Background() | |||
| 451 | mockFactory := mocks.NewMockWidgetFactory(t) | 466 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 452 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | 467 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | ||
| 453 | mockWidget := mocks.NewMockWidget(t) | 468 | mockWidget := mocks.NewMockWidget(t) | ||
| @@ -457,10 +472,10 @@ func TestBuild_EmptyNodeID_NotStored(t *testing.T) { | |||||
| 457 | 472 | ||||
| 458 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | 473 | mockPaneViewFactory.EXPECT().CreatePaneView(node).Return(mockWidget).Once() | ||
| 459 | 474 | ||||
| 460 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | 475 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) |
| 461 | 476 | ||||
| 462 | // Act | 477 | // Act | ||
| 463 | - | widget, err := renderer.Build(node) | 478 | + | widget, err := renderer.Build(ctx, node) |
| 464 | 479 | ||||
| 465 | // Assert | 480 | // Assert | ||
| 466 | require.NoError(t, err) | 481 | require.NoError(t, err) | ||
| @@ -471,6 +486,7 @@ func TestBuild_EmptyNodeID_NotStored(t *testing.T) { | |||||
| 471 | func TestUpdateSplitRatio_ExistingNode(t *testing.T) { | 486 | func TestUpdateSplitRatio_ExistingNode(t *testing.T) { | ||
| 472 | // Arrange | 487 | // Arrange | ||
| 473 | mockFactory := mocks.NewMockWidgetFactory(t) | 488 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 489 | + | ctx := context.Background() | |||
| 474 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | 490 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | ||
| 475 | mockPaned := mocks.NewMockPanedWidget(t) | 491 | mockPaned := mocks.NewMockPanedWidget(t) | ||
| 476 | mockWidget1 := mocks.NewMockWidget(t) | 492 | mockWidget1 := mocks.NewMockWidget(t) | ||
| @@ -503,8 +519,8 @@ func TestUpdateSplitRatio_ExistingNode(t *testing.T) { | |||||
| 503 | mockPaned.EXPECT().ConnectMap(mock.Anything).Return(uint32(0)).Once() | 519 | mockPaned.EXPECT().ConnectMap(mock.Anything).Return(uint32(0)).Once() | ||
| 504 | mockPaned.EXPECT().AddTickCallback(mock.Anything).Return(uint(0)).Once() | 520 | mockPaned.EXPECT().AddTickCallback(mock.Anything).Return(uint(0)).Once() | ||
| 505 | 521 | ||||
| 506 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | 522 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) |
| 507 | - | _, _ = renderer.Build(splitNode) | 523 | + | _, _ = renderer.Build(ctx, splitNode) |
| 508 | 524 | ||||
| 509 | // Act | 525 | // Act | ||
| 510 | err := renderer.UpdateSplitRatio("split-node", 0.7) | 526 | err := renderer.UpdateSplitRatio("split-node", 0.7) | ||
| @@ -516,9 +532,10 @@ func TestUpdateSplitRatio_ExistingNode(t *testing.T) { | |||||
| 516 | func TestUpdateSplitRatio_NonExistentNode(t *testing.T) { | 532 | func TestUpdateSplitRatio_NonExistentNode(t *testing.T) { | ||
| 517 | // Arrange | 533 | // Arrange | ||
| 518 | mockFactory := mocks.NewMockWidgetFactory(t) | 534 | mockFactory := mocks.NewMockWidgetFactory(t) | ||
| 535 | + | ctx := context.Background() | |||
| 519 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | 536 | mockPaneViewFactory := mocks.NewMockPaneViewFactory(t) | ||
| 520 | 537 | ||||
| 521 | - | renderer := layout.NewTreeRenderer(mockFactory, mockPaneViewFactory, zerolog.Nop()) | 538 | + | renderer := layout.NewTreeRenderer(ctx, mockFactory, mockPaneViewFactory) |
| 522 | 539 | ||||
| 523 | // Act | 540 | // Act | ||
| 524 | err := renderer.UpdateSplitRatio("non-existent", 0.7) | 541 | err := renderer.UpdateSplitRatio("non-existent", 0.7) | ||