MCPcopy
hub / github.com/yorukot/superfile / assertLayoutValidity

Function assertLayoutValidity

src/internal/model_layout_test.go:288–316  ·  view source on GitHub ↗
(t *testing.T, m *model)

Source from the content-addressed store, hash-verified

286}
287
288func assertLayoutValidity(t *testing.T, m *model) {
289 // Skip for edge conditions where terminal is too small
290 if m.fullHeight < common.MinimumHeight || m.fullWidth < common.MinimumWidth {
291 return // Terminal too small for valid layout
292 }
293 if m.fileModel.SinglePanelWidth < filepanel.MinWidth {
294 return // Panels too narrow for valid layout
295 }
296
297 returnFirstError := func() error {
298 if err := m.validateLayout(); err != nil {
299 return err
300 }
301 if err := m.validateComponentRender(); err != nil {
302 return err
303 }
304 if err := m.validateFinalRender(); err != nil {
305 return err
306 }
307 return nil
308 }
309 err := returnFirstError()
310 // Not using assert to prevent `getLayoutInfoForDebug` getting called
311 // in happy case. This is hot-path for 906 tests
312 if err != nil {
313 t.Errorf("validations failed, error : %v, layout info : %v",
314 err, getLayoutInfoForDebug(m))
315 }
316}
317
318func getLayoutInfoForDebug(m *model) string {
319 firstPanel := m.fileModel.FilePanels[0]

Callers 3

testWithConfigFunction · 0.85
testModelScrollingCoreFunction · 0.85

Calls 4

getLayoutInfoForDebugFunction · 0.85
validateLayoutMethod · 0.80
validateFinalRenderMethod · 0.80

Tested by

no test coverage detected