(t *testing.T, cfg common.ConfigType, testPath string)
| 98 | } |
| 99 | |
| 100 | func testWithConfig(t *testing.T, cfg common.ConfigType, testPath string) { |
| 101 | origConfig := common.Config |
| 102 | defer common.SetConfig(origConfig) |
| 103 | common.SetConfig(cfg) |
| 104 | |
| 105 | m := defaultTestModelWithFooterAndFilePreview(testPath) |
| 106 | |
| 107 | resizeSizes := []struct { |
| 108 | width, height int |
| 109 | }{ |
| 110 | {60, 24}, // Minimum |
| 111 | {80, 30}, // Small HeightBreakC (<35) |
| 112 | {100, 39}, // HeightBreakC |
| 113 | {130, 44}, // HeightBreakD |
| 114 | {200, 60}, // Large |
| 115 | {400, 120}, // Extra large |
| 116 | {91, 41}, // Back to medium |
| 117 | {60, 24}, // Back to minimum |
| 118 | } |
| 119 | |
| 120 | // Run resize tests |
| 121 | for _, size := range resizeSizes { |
| 122 | t.Run(fmt.Sprintf("w=%d;h=%d", size.width, size.height), func(t *testing.T) { |
| 123 | updateModelDimensionsAndValidate(t, m, size.width, size.height) |
| 124 | }) |
| 125 | } |
| 126 | |
| 127 | t.Run("Edge cases", func(t *testing.T) { |
| 128 | edgeCases := []struct { |
| 129 | name string |
| 130 | width, height int |
| 131 | }{ |
| 132 | {"Ultra-narrow", 70, 100}, |
| 133 | {"Ultra-wide", 500, 30}, |
| 134 | {"Boundary-79", 79, 30}, |
| 135 | {"Boundary-80", 80, 30}, |
| 136 | {"Boundary-81", 81, 30}, |
| 137 | {"Below-minimum", 59, 23}, |
| 138 | } |
| 139 | |
| 140 | for _, tc := range edgeCases { |
| 141 | t.Run(tc.name, func(t *testing.T) { |
| 142 | TeaUpdate(m, tea.WindowSizeMsg{Width: tc.width, Height: tc.height}) |
| 143 | assertLayoutValidity(t, m) |
| 144 | }) |
| 145 | } |
| 146 | }) |
| 147 | } |
| 148 | |
| 149 | // Note: this will create as many panels possible and leave the model in that state |
| 150 | // This is to ensure that at time of resize operations, there are more panels |
no test coverage detected