Improves helder

This commit is contained in:
2026-10-05 09:24:25 +02:00
parent 8fafea4fc3
commit 336987d821
44 changed files with 3454 additions and 542 deletions
@@ -13,7 +13,52 @@ import Testing
}
@Test func fittingKeepsTheEditorMinimum() {
let fitted = ColumnLayout.fitted(ColumnWidths(sourceControl: 400, explorer: 400, agent: 400), windowWidth: 1000, sourceControlVisible: true)
let fitted = ColumnLayout.fitted(ColumnWidths(sourceControl: 400, explorer: 400, agent: 400), windowWidth: 1000, visible: .all)
#expect(fitted.sourceControl + fitted.explorer + fitted.agent <= 1000 - 3 - ColumnLayout.minEditorWidth)
}
@Test func aHiddenColumnIsNeitherCountedNorScaled() {
let widths = ColumnWidths(sourceControl: 400, explorer: 400, agent: 400)
let visible = ColumnVisibility(sourceControl: false)
let fitted = ColumnLayout.fitted(widths, windowWidth: 1000, visible: visible)
#expect(fitted.sourceControl == 400)
#expect(fitted.explorer + fitted.agent <= 1000 - 2 - ColumnLayout.minEditorWidth)
}
@Test func withTheEditorHiddenTheAgentIsTheFlexColumn() {
let widths = ColumnWidths(sourceControl: 400, explorer: 400, agent: 900)
let fitted = ColumnLayout.fitted(widths, windowWidth: 1000, visible: ColumnVisibility(editor: false))
#expect(fitted.agent == 900)
#expect(fitted.sourceControl + fitted.explorer <= 1000 - 2 - ColumnLayout.minEditorWidth)
}
@Test func withoutAFlexColumnTheFixedOnesOnlyHaveToFitTheWindow() {
let widths = ColumnWidths(sourceControl: 300, explorer: 300, agent: 480)
let visible = ColumnVisibility(editor: false, agent: false)
#expect(ColumnLayout.fitted(widths, windowWidth: 1000, visible: visible) == widths)
let narrow = ColumnLayout.fitted(widths, windowWidth: 501, visible: visible)
#expect(narrow.sourceControl + narrow.explorer <= 500)
#expect(narrow.agent == 480)
}
@Test func fittingWithOnlyTheAgentBesideTheEditor() {
let widths = ColumnWidths(sourceControl: 300, explorer: 300, agent: 900)
let fitted = ColumnLayout.fitted(widths, windowWidth: 1000, visible: ColumnVisibility(sourceControl: false, explorer: false))
#expect(fitted.sourceControl == 300)
#expect(fitted.agent <= 1000 - 1 - ColumnLayout.minEditorWidth)
#expect(fitted.agent >= 1000 - 2 - ColumnLayout.minEditorWidth)
}
@Test func splittersSitOnlyBetweenVisibleColumns() {
#expect(ColumnVisibility.all.splitterCount == 3)
#expect(ColumnVisibility(sourceControl: false, editor: false).splitterCount == 1)
#expect(ColumnVisibility(sourceControl: false, explorer: false, editor: false, agent: false).splitterCount == 0)
}
@Test func theAgentLimitCountsOnlyVisibleColumns() {
let widths = ColumnWidths(sourceControl: 300, explorer: 300, agent: 480)
#expect(ColumnLayout.maxAgentWidth(windowWidth: 1600, widths: widths, visible: .all) == 1600 - 3 - 600 - ColumnLayout.minEditorWidth)
#expect(ColumnLayout.maxAgentWidth(windowWidth: 1600, widths: widths, visible: ColumnVisibility(explorer: false))
== 1600 - 2 - 300 - ColumnLayout.minEditorWidth)
}
}